I'm getting a lot of unused variable errors after updating to the new version of and Xcode 5.1.
Compiler is saying unused variables are errors, and checked the compiler settings that i didn't modify treating warning as errors.
This only happened after I updated to Xcode 5.1
There seems to be indeed an issue with Facebook iOS SDK and compiling on Xcode 5.1 even if compiling it by itself.
I opened a bug in the Facebook support system:
https://developers.facebook.com/x/bugs/1449419898627543/
As a temporary workaround - you can fix it by turning off treating warnings as errors ( a very good practice by itself btw I use for our SDK) by:
1. Open the Facebook proj file (or the project inside an existing project
2. Go to build settings of the entire project
3. Change the "Treat Warnings as Errors" field from YES to NO.
This will let you compile it even with these warnings - but do be alert for an updated sdk in the coming days.
The problem was that we were unintentionally compiling for 64bit in the internal compiler settings somewhere inside our scripts. Please be aware.
Related
I have a project that compiled just fine in XCode 6 beta, but now, in the GM, it won't compile for an iOS device, giving the error:
myController.m:393:9: No visible #interface for 'UIDevice' declares the selector 'initialize:'
at this line:
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
It still compiles absolutely fine for the simulators; I've also tried these fixes:
Cleaned the whole project and re-built.
Deleted all Derived Data from ~/Library/Developer/XCode
Re-installed XCode
Checked XCode preferences and pointed Command Line Tools location to XCode 6 (XCode 5 is still installed on the machine and it was pointing there)
...but with no luck. Same error on compilation.
Help! We're on a tight timescale with iOS8 now approaching, and this is a real headache.
PS: We're also using Cocoapods in the workspace, for what it's worth.
OK, I solved this one after rather a lot of hair-pulling. The app in question is an iOS 8 app, with an embedded Today Extension.
It turned out that, when adding the Today Extension, XCode had added a build setting:
'Enable Modules (C and Objective-C': YES
Neither my project nor my containing app targets used this build setting, but setting it to YES caused issues to do with trying to link Frameworks automatically (and failing) and all sorts of related odd error messages that ultimately related to header files.
The problem was further compounded because there are source files that are members of both the containing app's target and also the Today Extension's target.
Hope this info helps somebody else.
Carl
I was building my project perfectly but after updating iOS to 7.1, I was then forced to update Xcode 5.1 and now I'm getting error and warning messages:
4S 7.04 – builds – no error or warning messages
5S 7.1 – doesn’t build – mixture of error and warning messages:
26 x Value conversion issue
Implicit conversion loses integer precision:
12 x Linker build errors
Then I do the steps outlined in this blog post to remove linker errors – delete all conditional architecture and make sure arm64 is in the all the projects and targets: http://shazronatadobe.wordpress.com/2014/03/12/xcode-5-1-and-cordova-ios/
4S 7.04 – builds – warning messages:
12 x Format String Issue
Values of type ‘NSInteger’ should not be used as format arguments; add an explicit cast to ‘long’ instead
5S 7.1 – doesn’t build – warning messages:
26 x Value conversion issue
Implicit conversion loses integer precision:
12 x Format String Issue
Values of type ‘NSInteger’ should not be used as format arguments; add an explicit cast to ‘long’ instead
I think the warning messages are now affecting the badges as they are not reseting correctly
Are the warning messages relevant? And would they likely be affecting resetting the badges?
Okay, so I have gone back and forth with this for a while and I've got a few possible solutions for you.
Make sure in Xcode you are selecting both your project and the target within that project also and make sure your settings are setup like the forum post you mentioned.
Make sure you also change the settings on the CordovaLib project as well. Both the project and the target need to be changed, but it's slightly different. you also need to add i386 as a supported platform in the cordova project, but is not needed in yours.
Other things to check are.... Make sure you are using the right kind of provisioning profile... ie. Distribution for production phone builds and Development for team builds and testing on your device.
Check and make sure you are not missing a library you needed to import. You can usually tell if you are missing a library by the mach-o linker errors though.
Example: I removed a plugin from my phonegap project via command line. Well then I added it back and my project would not build using the 'phonegap build ios' command. I had to open the XCode version of my project within xcode then re-import the AudioToolbox library under the Linked files and then I was able to build again via command line.
Good luck, comment here if you need more help.
Please check my attached images might be it will helpful for you.
I am using Phonegap 2.4.0 for iOS. when i create a cordova project and run it in iPad5.1 simulator i got this error
semantic issue expected method to read dictionary element not found on
object of type 'Nsdictionary *'
i following this tutorial guide_getting-started_ios
and i don't know where i made mistake.
Check your xcode version - it needs to be 4.5 or above.
Rebuild your cordova / phonegap project after upgrading xcode and the error should go away.
If you have an updated version of Xcode, make sure your project/platforms/ios/build directory wasn't removed somehow.
I recently switched to Xcode 4.5 and I no longer receive realtime compiler warnings. I only receive the warnings after building my project. I can literally type in "laskjflskdjf" and get no errors until compile time.
Additionally, after building a project, receiving a warning, and resolving the issue, the yellow or red warning icon is not removed until I build the project again.
Are there build settings that I must manually adjust to correct this?
Thanks!
In Xcode 4.5.2, the option is in Preferences > General > Show live issues. I was able to reproduce what you describe by unchecking this option.
Is there a way to have Xcode tell me when I'm calling a method that isn't available in the SDK of the minimum supported target?
For example, the method [NSURLConnection sendAsynchronousRequest:queue:completionHandler:]. This method is available on iOS5 and up. But my application's minimum target is iOS4.
If I use that method (sendAsync), I'd like Xcode to tell me that that method isn't available for the minimum target I'm trying to support.
I've tried putting __IPHONE_OS_VERSION_MAX_ALLOWED=40000 in the preprocessor settings, but that just triggers a bunch of Apple SDK errors that aren't helpful. (Probably because my active SDK is iOS5.1)
Is the only solution to get ahold of old SDKs and install them in Xcode?
Are there any easier solutions?
There is unfortunately no standard way of doing this. By setting the target OS to a lower number than the base SDK, Xcode will weakly link the libraries and frameworks. When doing that Xcode will not warn you for using methods that may not be available on the target OS.
You could temporarily set the base SDK lower, but that might not always work. Since you want to ignore most of the errors and warnings produced (because they are only called conditionally in your code path), and many warnings and errors are dependant on other error that you may need to resolve before the compiler will give any meaningful output.
I do not think there exist any static analysis tools for this, neither from Apple nor third party.
After doing some research, reading the Apple Doc about it, and trying a number of things. The solution is downloading an old Xcode DMG from Apple, grab the .pkg file for the same SDK as your deployment target and install it in your version of Xcode. Here's how:
Download older Xcode.dmg from Apple
Open the DMG
In Terminal, go into packages: "cd /Volumes/[DMG]/Packages; open ."
Find the SDK you want, something like iPhoneSDK_4.0.pkg
Install that package, but change the install directory to /Applications/Xcode/Contents/Developer
Restart Xcode if it was open.
Now that you have the same SDK as your deployment target, set your BaseSDK to the same. When you build you'll get warnings about missing methods. Your project may or may not successfully build with an older BaseSDK in a new version of Xcode, but that doesn't matter - you've just found the method calls you need to wrap in a feature check with respondsToSelector:.
As of Xcode 7.3, the compiler can now generate these warnings for you. All you need to do is set the -Wpartial-availability warning flag in the Build Settings, as described in this answer.