I'm getting all kinds of build errors with Facebook's SDK because my app uses ARC. I try to remove the Facebook files from the compiler to avoid this, but I get an Apple Mach-O error when I remove the Facebook.m file. If I put that back in the compile sources, I get the ARC errors.
Anyone run into this?
Do you exclude them from arc with Compiler flag
-fno-objc-arc
?
You can see a Answer here
And this is why distributing a shared library by copy and pasting files is bad. A library should be distributed as it's own Xcode projects with a static library target, so that the build setting requirements of your projects and the libraries you use can not screw up one or the other.
File a bug for the Facebook SDK here: https://github.com/facebook/facebook-ios-sdk/issues
And in the mean time add the -fno-objc-arc flag to the implementation files in the Facebook SDK. You can do this by;
Select your application target
Go to the Build Phases tab
Add for each file under the Compile Sources section.
The new SDK does not explicitly support ARC out of the box, but there is a shell scrip to build a static library that can be used within your ARC project. Just navigate to your local git repo and run
% ~/facebook-ios-sdk/scripts/build_facebook_ios_sdk_static_lib.sh
This will create the static library under the /lib/facebook-ios-sdk folder (e.g. ~/facebook-ios-sdk/lib/facebook-ios-sdk). You may then drag the facebook-ios-sdk folder into the app Xcode project to include the iOS Facebook SDK static library.
there are actually very few changes needed to make the Facebook iOS sdk compatible with ARC. I have made the changes in my code , but , I do not know who to send it back to the community, any pointers ?
here is a post I made to explain how to use it with ARC the simple way on Xcode 4.2:
http://nabtech.wordpress.com/2012/02/02/facebook-ios-sdk-and-arc/
Related
Is the Janrain iOS library for Engage compatible with IOS 5?
I am just getting started with the Engage iOS SDK too. The instructions on the Janrain site are not for iOS 5 / Xcode 4. They are targeted at earlier versions of iOS running under Xcode 3. It is still possible to drag/drop the JREngage source folder into your project. The trick is to not use a project that has ARC enabled. When you enable ARC you will get all sorts of compiler errors and warnings and it will fail to build. If you create a new project in Xcode 4 and uncheck the Use Automatic Reference Counting option it should build okay.
I have submitted a support request to Janrain in hopes of getting some clarification on whether this is expected behavior and what their plans are for supporting ARC. When I get a response I will update my comment here.
Here is the response I received from Janrain. It looks like the Engage SDK does not build with ARC enabled, but following their suggested steps you can have it built without ARC within a project that does use ARC.
To use ARC with the Janrain Engage for iOS library, please follow these steps:
Go to your project settings, select your application's target(s) and click the "Build Phases" tab
Expand the section named "Compile Sources"
Select all the files from the JREngage library, including SFHFKeychainUtils.m and JSONKit.m
Hit Enter, to edit all the files at once, and in the floating text box add the -fno-objc-arc compiler flag
I've been struggling with this for a few days now. When I create a new Static Library project under IOS in XCode 4 I am running into an issue. With or without adding files as headers or to be compiled I am able to successfully build but the .a file is always red. This happens in both Debug and Release. I've read about similar issues but haven't found someone who has fixed the problem. Any help would be appreciated. Thanks
XCode seems to have a bug in this regard when building for the simulator. Build once for device, right-click the library to show in finder, back up a level, and navigate to the simulator one. Your library will be there. (The path will look something like this: /Users/You/Library/Developer/Xcode/DerivedData/LibName-fylbqugtzucxyndtdddrjmbbdnet/Build/Products/Debug-iphonesimulator)
I wasn't able to figure out the answer to this problem but I did find a work around. I installed the XCode 4 project template to build universal frameworks from https://github.com/kstenerud/iOS-Universal-Framework. This allowed me to build a framework which fit my needs.
I'm fairly new to the iOS SDK and Xcode and I stumbled across this XML-RPC framework https://github.com/eczarny/xmlrpc that I'd really like to use in one of my projects. I downloaded the sources, the initial target was set to Mac OS, so I changed that to iOS 4.3 but got the following dependency error:
target specifies product type 'com.apple.product-type.framework', but there's no such product type for the 'iphoneos' platform
So I removed all the targets and added a new one from scratch using the Cocoa Touch Static Library, and it seems like it's been built just fine. Now my question is whether this is the correct way to build that library for iOS development, and where do I take it from here? I can't find the .framework directory anywhere (the install dir was set to "#executable_path/../Frameworks") so I can't embed it in my iOS project. How exactly does this go? Thanks!
Thanks for your help and sorry if this is too "newbish". Cheers!
If you're using Xcode 4.x open the Organizer, select the Projects tab and then down the left hand side you should see an entry relating to the XML-RPC project. Select that and under the Derived Data heading you'll see a path which if you follow using finder should lead you to the folder containing the static library you've built.
I recently moved my projects to a new mac, along with a newer version of Xcode.
When i opened my project i noticed that some files were red. So i remapped them by setting the path (by project path) and then providing the proper path location.
Now my problem is that the frameworks that i have are red, and i cant find their location! I did set the framework paths to be "relative to current SDK" however.
Can anybody help me get my frameworks mapped correctly?
The frameworks im using are:
- QuartzCore.framework
- libsqlite3.0.dylib
- UIKit.framework
- Foundation.frameowrk
- CoreGraphics.framework
The XCode version is 3.1.4 (the only one installed).
The iPhone app was originally created using a prior version of Xcode (i dont remember which version).
I still dont have an answer. Im going deeper into this mess of a problem that Apple created.
In all my .m files im importing
How can i add this UIKit framework to my project Target with respect to the current SDK?
In fact, forget about the ref w/ respect to the SDK, let's just get the framework from the 3.0 SDK as a referenced framework. Right now when i reference it is red.
Note: references related to frameworks, everything about it, is driving me insane, and making me more frustrated at apple for this sloppiness, more than ever.
Any help is greatly appreciated.
I had exactly this problem. Somehow 'Base SDK' in Build Settings of a project was set to Mac OS X after I have installed Xcode 4.2.
Click on your project, change Base SDK to 'Latest iOS' and enjoy the vibe.
If you double click on your target to bring up the info pane you will see a tab labeled "Linked Libraries". From here you can click the plus button to add the libraries and xcode will do the right thing when you add the desired frameworks
I was having the same issue with red frameworks and bad pathing. If you're getting an error that says, "Base SDK Missing" you'll need to Get Info on your Xcode Project and check that it can find the right SDK.
Near the bottom of the General Info tab there will be an option Base SDK for All Configurations. Select a different SDK and see if that helps.
I ran into issues when I upgraded to a beta SDK and it was loading up deprecated frameworks from an old SDK.
Xcode 3.2 kind of broke the build process of my iPhone app. I need to add a new framework to my project (MediaPlayer.framework).
So I go into my Target settings and try to add it to the "Linked Libraris" by hitting the [+] button. In the list the MediaPlayer.framework is missing, as well as other frameworks, such as UIKit, CoreGraphic and others. Some frameworks are still there.
I can add the frameworks by adding the SDK-specific ones (going into /Developer/Platforms/iPhoneOs.platform/...yadayadayada../frameworkd/) but then of course I can only compile for the iPhone platform and not for the simulator any more.
So basically I wonder how I can get Xcode back to chose the appropriate framework, depending on platform and SDK version for me?
Thanks and kind regards, Hans Schneider
Edit: Things I tried: Setting the Base SDK to 3.0 (was still 2.2.1), reinstalling 3.0 iPhone and Simulator SDK from the "packages" directory of the Xcode 3.2 DMG. Didn't help. The frameworks still wont show up in the list...
Edit 2: Ok, I now have the frameworks back in the list, I was previously in my AdHoc configuration. In Debug I have the frameworks back. But it still wont compile for the Simualtor (lots of Symbols(s) not found errors).
Looks like the linker doesn't choose the correct libraries and always uses the iPhoneOs3.0 path for the frameworks.
Goto 'Framework Search Path' in build section in target's property.
Add path:
$(SDKROOT)/Library/System/Frameworks
Then it should work well.
And once you press 'OK', you should be able to see the path is set to '/Library..."