10.9 deprecated a bunch of SSL stuff, how do I hide the warnings or fix the issues?
You can turn deprecation warnings on and off in your target's build settings. To do so, click on your project in the Project Navigator, select the target you're working on and show the Build Settings for that target. You can use the search box to search for "deprecate", and you should find an LLVM warning for "Deprecated Functions" and set it to "No".
Be aware that if you do this, you can compile without (deprecation) warnings, but you're setting yourself up to have broken code in the future. At some point you really should rewrite that code using the new proper method as #CodaFi mentions above.
Related
I have an old computer that cannot upgrade to Lion, but I would like to use it for coding while still taking advantage of syntax such as instancetype and Objective-C literals. Has anyone tried to compile a newer Clang and LLVM to use with an older Xcode and been successful?
There are various ways to use the newest LLVM/Clang version.
(1) Plugins, as described in the comments above, e.g.:
http://blog.wadetregaskis.com/tot-clang-llvm-in-xcode/
As pointed out in the linked blog post, you may get errors/warnings from Xcode's real-time syntax checking as Xcode uses an older version of libclang (more on that under (3)). It is likely to compile fine, but editing source code won't be a lot of fun.
(2) Set the compiler via the CC flag. This is probably the easiest/fastest solution and the setting only affects one project. Go to the project's Build Settings, choose "Add Build Setting" -> "Add User-Defined Setting" (in Xcode 5, this is hidden in the Editor menu), name it CC and set the value to the path of your version of Clang. Worked fine for me, but as with (1), you might get conflicts with the live error reporting, especially if you want to use new syntax such as literals, or pass flags for warnings that the older version does not understand.
(3) Replace the compiler. Make sure you back up any files before replacing them. There are two files that need to be replaced: the Clang binary, and libclang.dylib. Go to /Applications/Xcode.app/ -> Option-Click -> "Show Package Contents" -> /Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr. clang is in /bin, libclang.dylib is in /lib.
Both binaries can either be compiled from source (which will give you an even newer version, of course) or just copied from the latest Xcode package. I ran into trouble using a customised version of libclang, but I suspect the problem originates from my modifications there. If in doubt, use libclang from a later Xcode version.
Note: My modified libclang binary used ARC and is therefore incompatible with Xcode 4 which runs with garbage collection. Xcode 5 itself uses ARC so the problem has vanished. If you compile libclang unmodified, you shouldn't come across the issue in either Xcode 4 or 5.
Just by accident, I saw that presentModalViewController:animated: is listed as deprecated in iOS 6.0, but it doesn't seem to generate any warnings in XCode 4.5 when I deliberately include code that sends this message. I am building against the "Latest iOS (iOS 6.0)" using the most recent version of XCode, but no warnings are generated when compiling. I've checked the LLVM compiler warnings for all languages and Objective-C in Build Settings, but I don't see a setting for warning on sending deprecated messages, only for overriding them. However I've searched StackOverflow and I've seen mentions of suppressing deprecation warnings for gcc on earlier versions of XCode. Is this a side effect of switching to LLVM, or is there a setting that I'm not understanding?
(And if not, would people like for me to write a tool that automatically scrapes the Apple SDK documentation and searches directories for deprecated message sends by SDK version?)
-Wdeprecated-declarations is the warning you're looking for. Or just build with -Wall.
i'm trying DISABLE ARC in some Facebook classes and still got Errors.
my steps was like that:
1) Build Settings:
i Activated ARC=YES.
Other linker flags = -ObjC -all_load
2) Build Settings>Compile Sources:
-fno-obj-arc for All clases i want to disable ARC.
after all that, i still gets an error build for all "release" in my project.
why? :/
It's -fno-objc-arc to disable ARC, not -fno-obj-arc. I'm sure you don't need it, but see the Use Compiler Flags to Enable and Disable ARC in the Transitioning to ARC Release Notes.
I'd also encourage you to check out the latest Facebook SDK, if you can, which is ARC compatible.
I made a single view app for the ipad, with a movie, webview and button, and I get this error when I try and run it. I have restarted the application, and reinstalled it, but nothing is working. This error keeps coming up in my MoviePlayer_Prefix.pch file. Can someone help me out?
I have had the same issue with being unable to compile project due to UIKit.h not being found + "unable to load standard library for target..."
The solution for me was very simple - to quit (CMD+Q) and relaunch Xcode. I have found out that with Xcode opened, macOS seems to have removed command line tools for Xcode because it was preparing for a update and relaunching Xcode triggered the "install additional components" update and it made the problem disappear.
Like Faul Textor said, most likely your XCode updated to 12.1 but your Command Line Tools didn't. You need to quit XCode completely and then start it again and you should get a pop-up saying "Install Additional Components"
Sorry, this should have been a comment to his reply but I cannot do that.
It sounds like you removed the UIKit.framework from your project at some point. Check if it is listed in your project navigator. If it's not there, go to your project in the project navigator pane, select your target, go to the build phases tab, click on link binary with libraries, hit the plus button, find the UIKit.framework there and add it to your project.
EDIT:
This answer suggests that there mayb be an issue with your framework search paths build setting. Check that out and if the path is empty and it still doesn't work, a re-install of Xcode would fix it, I think.
Just wanted to add my two cents on not making a dumb-ass mistake - came across this answer hoping to solve same problem.
Turns out I had written #import "<UIKit/UIKit.h>" instead of #import <UIKit/UIKit.h>.
Thought I would add in case someone else makes a simple mistake like me.
When I compile my application, I get an error stating that
/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/CFNetwork.framework/CFNetwork, missing required architecture arm in file.
I have checked all the frameworks, and they all point to the iPhone 3.0 SDK Frameworks...
What am I missing here?
Ok, so I finally solved the problem. The solution was to set the "Framework Search Paths" and "Library Search Paths" to "/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.0.sdk/System/Frameworks/CFNetwork.framework"
I removed the other values that were there and it seems to work. I am using more frameworks but only CFNetwork seems to be problematic (until now :) ).
Hope this helps!
That path is to one of your Mac's frameworks, which shouldn't be anywhere near your iPhone app.
Go to Targets in your Project's sidebar and check what's listed under "Link Binary with Libraries". None of them should point anywhere else but the SDK frameworks. If you don't find anything wrong there, have a look in the Build Results panel, preferably after doing a Clean. That should give you some clues as to what's happening.