How to use "distanceTo", "advancedBy" to handle String in Xcode7 beta6 - xcode

I have an extension on String, it works fine on Xcode7 beta5.
However, I upgraded to beta 6 yesterday. It seems Swift syntax has some changes. There are some errors while compiling my code.
==================================================
Yes. it shows which methods I should use and also finds some information on apple website. https://developer.apple.com/library/prerelease/ios/releasenotes/General/iOS81APIDiffs/modules/Swift.html
When I change the "distance" => "distanceTo". I got the error "Use of unresolved identifier 'distance to'". Does anyone know how to use "distanceTo", "advancedBy" exactly ??

What's happened is that the global functions distance and advance have been replaced by instance methods distanceTo and advancedBy.

OK, I figure out how to use these.

Related

Swift find() method throwing error

When i opened my app today, Xcode asked if i wanted to update some syntax. I followed through the update prompts and after all was said and done my app now has this error on one of the "find" methods. Ive been scratching my head over this one for about an hour now. Any advice on what might have changed?
As discussed here, Swift 2.0 removed the find method and replaced it with indexOf (as indicated by the error Xcode is giving you).
You can fix your code as follows:
if let index = playlistArray.indexOf(playlistImageView)
Read the error message carefully. It says
find(haystack, needle) is unavailable, call haystack.indexOf(needle)

'Set<NSObject>' does not have a member named 'containsObject' after updating XCode & Swift

I've been writing a Swift application over the last week using the latest Facebook iOS SDK v4.0.1. After updating to the latest XCode 6.3 and Swift 1.2 today, I've got a lot of errors. I've been able to fix most of them, mainly new syntax errors like casting, but this error shows up and I haven't been able to find the cause.
if result.grantedPermissions.containsObject("email") {
...
}
'Set<NSObject>' does not have a member named 'containsObject'
If anyone has any advice that would be appreciated, thanks.
It seems that result.grantedPermissions is a native Swift Set
which was introduced with Swift 1.2 (Xcode 6.3) and bridges with NSSet.
To check for membership in a Set, you can use its contains()
method, for example:
if result.grantedPermissions.contains("email") {
...
}
For more information, see "Sets" in Collection Types in the Swift documentation.

How to update Kobold2D 2.1 project to MacOS10.10 / XCode 6.1?

we've got a major project written in Kobold2D by Steffen Itterheim, (which is itself a wrapper for Cocos 2.1), and since upgrading to XCode 6.1/OS X 10.10, the new iOS 8 framework seems to render many parts of the Kobold-library and the Cocos implementation unusable, or it seems to need a rewrite.
Has anyone updated a Kobold2D project successfully to iOS8 yet?
Are there simple ways to upgrade it, or is it necessary to rewrite the entire library?
If there are no simple ways to upgrade, has anyone migrated a project from Kobold to cocos 3 yet?
Any hints would be much appreciated!
Averett
PS. I have seen this question: How to convert Kobold2D into a new Cocos2D 3.x project? - but the answer is not very helpful, as this solution would omit iOS 8.
We actually have created a script to make the necessary changes to Kobold2D. You can find it in this post:
https://www.makegameswith.us/gamernews/406/xcode-6-fixes-for-kobold2d
Basically all you need to do is run
curl https://s3.amazonaws.com/mgwu-misc/xcode6_kobold_patch.sh | sh
in the terminal, when you are in the root folder of your project.
I have just compiled my Kobold2D 2.1 project using XCode 6.0.1. It breaks initially at several lines, but it's easy to fix. I only found a couple of errors:
Multiple methods named 'setPosition:' found
Example:
[_target setPosition: newPos];
Fix: cast the object to CCNode
[(CCNode*)_target setPosition: newPos];
Do this for all errors found
You also need to import "ccNode.h" at the top of the file.
Use of undeclared identifier 'MPMovieControlModeHidden'
I found that the #ifdef__ #endif enclosing the offending line was commented out. Uncomment them to fix the problem.

residual header space for TTTableViewController on iOS 5

I have a class that inherits from TTTableViewController, and overwrites the "createDelegate" method to use the TTTableViewDragRefreshDelegate instead of the default Delegate.
The problem that I am seeing right now is that there is some header space that appears before my table content (supplied by data source, of course) for iOS 5, but this isn't there on pre-iOS 5 versions.
I searched around and found this article (http://stackoverflow.com/questions/6651367/how-to-make-the-blue-bar-on-the-top-disappear-for-tttableview-with-list-datasourc), but it doesn't quite help me as I did not overwrite tableView:viewForHeaderInSection: method.
What I have noticed is that for all my TableViewControllers that have this problem, they all seem to overwrite the "createDelegate" method and return TTTableViewDragRefreshDelegate, as mentioned above.
My question is: anyone ran into the same issue? How can I fix this problem?
Okay, figured it out. The problem is with an old three20 library that I was using. Once I upgraded to the latest, it was fixed.

Integrateing openfeint in xcode using unity3d

I want to make an openfeint leaderboard in xcode using Unity3d.
I am using Unity 3.2 and openfeint 2.9.1.
I have built correctly as well as what they told in openfeint Unity support readme.txt and open feint web link.
But I'm getting error like
Command /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/g++-4.2 failed with exit code 1
What am I doing wrong?
I'm working with ios 4.2.
I have tried and corrected well all unity player settings and set the target ios platform from 3.0 to 3.2 but I am getting the same error.
Can any one point out what am doing wrong.?
Thank you.
The solution is easy but took time as it happens :)
In Editor\OpenFeint\XCode\Appcontroller+OpenFeint.mm You must remove UnitySetAudioSessionActive() in the methods dashboardDidDisappear() and dashboardWillDisappear().
And everything becomes OK. Don't understand why it is there at all when UnityPause() is there?
UPDATED: You must remove UnitySetAudioSessionActive() ONLY in the methods dashboardWillAppear() and dashboardDidDisappear() (or sound will stop playing after disabling device there...
by that I thought you will get out from your OpenFeint Problem ..
Vivek Shah

Resources