Janrain and IOS 5 Compatibility - ios5

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

Related

iPhone ARC & Facebook SDK

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/

Conditionally including a library for different iOS SDK versions?

I'm sure this has got a simple answer, but it's stumping me :(
I'm trying to build an app that will run on iOS versions 4.3 and 5.0. I'm fine with the idea of checking for capabilities at runtime with -respondsToSelector, but in order to use the Twitter functionality I need to include the Twitter library.
That causes the compiler to fail when building for 4.3, which I'd expect. According to the Apple docs (at the very bottom of this page), it's possible to link frameworks conditionally - but I cannot for the life of me figure out how to set the Other Linker flags to do this. Can anyone tell me how this is done?
You should also link the framework with the flag "Optional".
You can set this at the "Build Phases" panel at the point "Link Binary With Libraries".
you can switch "Required" to "Optional"
In your Target -> Build Settings, search for Other Linker Flags and click on the type of release (Debug or Release) and then on the bottom right, click Add Build Setting -> Add Conditional Setting and that will give you the SDK popup and the ability to specify any additional flags.

Install Xcode 3.2.4, get "Base SDK Missing"

When you update Xcode to 3.2.4, your previously working Xcode iOS project gives you the message "Base SDK Missing". Something like this:
What gives? How to fix?
The Problem
iOS SDK 4.0 is gone in this release, replaced by iOS SDK 4.1. Details in "The Explanation" below. (NB: this repeats some information in my previous Q/A regarding 3.2.3).
The Fix
To fix this specific problem, you need to reset the Base SDK for your target(s), etc. You can either do that for the entire project (most folks), or for each target and/or configuration which applies. Rarely, you might need to do both.
Edit Project Settings
Load your project
From the menu, select Project > Edit Project Settings...
Click the "Build" tab.
Under "Configurations" select "All Configurations".
Go to the Change Base SDK section below.
Edit Specific Target/Configuration Settings
Load your project
From the menu, select Project > Active Target > "YourTarget"
From the menu, select Project > Edit Active Target "YourTarget"
Click the "Build" tab.
Under "Configurations" select "All Configurations", or the Configuration you want.
Go to the Change Base SDK section below.
Change Base SDK
Under Architecture > Base SDK, choose one of the available device
options: iOS Device 3.2 or iOS Device 4.1. If you are iPhone-only, 4.1 is the way to go.
If you want to target previous iOS versions, then in that same
window, under Deployment > iPhone OS Deployment Target, select the
lowest version you want to support. Note that support for 2.x versions
through the app store is deprecated.
The Explanation
iOS SDK 4.0 is gone in this release, replaced by iOS SDK 4.1. This is very similar with what happened with the 3.2.3 upgrade, which I covered in detail here. You can still use 3.2.4 to target iOS versions down to 3.0, but AFAIK, you must compile against the 4.1 SDK with Xcode 3.2.4. If this statement confuses you, study the following sentence closely:
The iOS SDK you compile against -- the "Base SDK" -- does not downward limit what iOS versions you can support.
In fact, there are two different settings, cf. Change Base SDK above. If you remain confused, take heart, and read my detailed post on the previous switchover, which is itself chockablock with links to good stuff.
I ran into the same problems for 3.2.5 and followed the same instructions. It didn't work for me, but I noticed that new projects would work properly. When I grepped ShareKit.xcodeproj/project.pbxproj, I noticed that there were still stray references to iphoneos4.0 in the file for SDKROOT param even after changing it in xcode. Manually editing this file and changing all references of SDKROOT to iphoneos fixed the problem. Hope that helps someone.
For all older projects, select the main window, select Option-Cmd-E, choose build and "latest ios...".
Close the build window.
In the main window, option-click the dropdown for Base SDK and you should see the latest build available.
It's still a pita, but it's easier than navigating, closing windows, etc....
If anyone knows a better method, I'd be happy to hear it...

There is no SDK with the name or path "iphoneos4.0"

I download a sample of UICatalog and run it.When I compile it ,it shows the failed message:There is no SDK with the name or path "iphoneos4.0".I find the "Base SDK" of UICatalog's Targets is iphone Device 4.0(missing).How can I solve this question and run it.
Thank you!
Select the root level of the project, in "Groups & Files". It's blue. Then hit command-I to get its Info.
Pick "Build" from the segmented controller at the top of the info window. In the first section of that panel you'll see Base SDK as one of the first few lines of options. Select the latest version of the SDK you find in there, and close the window to save your options.
Build-and-run the project, and you should be good to go.
EDIT, because I see from the comments that people are finding this answer who have a slightly different question than the OP's, so here's one other thing to try. It could also be you have "iOS Device" selected as your build target. If so, and if what you really want is for it to launch into the simulator, select "Simulator" instead.
After loading the project into XCode..
Under Groups and Files
right click on UICatalog<-(or your demo project name) and select Get Info
in Base SDK select IOS Simulator 4.1
Close and save info pane
expand Targets exposing UICatalog<-(or demo project name)
right click on UICatalog and select Get Info
in Base SDK select IOS Simulator 4.1
Combo box in UICatalog project pane (upper left corner) should switch to "Device - 4.1 | Debug" instead of "No Base SDK"
if you Build and Run at this point you might get another error. If so, open the UICatalog combo and switch from Device to Simulator
The "official link" mentioned above states…
"Note: Targets can override build settings defined at the Project level. "
..but should probably read "will" instead of "can"
Ok, I've solved it.
In Groups & Files go to Targets and select your target.
Press Ctrl+I (or open the info in some other way)
Set the Base SDK of your target
(The Base SDK should also be set at the project)
Steve nailed it. This is an Xcode bug. I loaded the NavBar sample and Xcode didn't even offer the simulator as an option, and it complained about the missing SDK even though it was set correctly in the project and wasn't set at all on the target.
Do what Steve said:
"The only way I could resolve it (in fact, the only way I could get the option of running in the simulator at all) was to change from debug to release and back. The dropdown still shows Base SDK Missing but if you click it, the simulator options are there and it builds."
My problem was that in the sample code another xcodeproj was embedded. So I looked after that file with Finder, opened it with Xcode and than the same as Dan said: Project -> Edit Project Settings -> Under "Architectures" set Base SDK to "iPhone Simulator x.x" (the latest one you have installed)
I had the same issue with another Apple sample app. The only way I could resolve it (in fact, the only way I could get the option of running in the simulator at all) was to change from debug to release and back. The dropdown still shows Base SDK Missing but if you click it, the simulator options are there and it builds.
I think that's a bug.
Many answers here, none seem to be complete enough about this, and it's all a mess. But they are all helpful. Here, I just want to compile all helpful pieces in one answer. Thanks to Larry (who have almost everything compiled into steps already), Steve, Dan Ray, dkk, geowar and lqf.
This picture from apple is a little decieving and outdated (talking about iOS SDK 4.0 and we're currently at 4.1) but it does show where you should change the project settings. Just select iPhone Simulator 4.0 if it was previously on iPhone Device 4.0.
Other than that, they say "Targets can override build settings defined at the Project level". So, yeah, also go ahead, open Targets and set all of their Base SDK back to default by pressing delete on it. If they were bolded, they'll become regular indicating a default value, which should be iPhone Simulator 4.0 if you did the first step right.
Just realize there are many places where Base SDK can be wrong:
Under Project Info
Under Target Info
Under different configurations for both Project and Target
And that under Target it should be set to default, which is value from Project.
There's still something about the overview combo sometimes having and sometimes not having more than 1 option such as "Device" and "Simulator" that I just couldn't understand yet, but this is another potential configuration place for Base SDK being wrong.
You have to make sure that you change to the "iPhone Simulator" under the project settings in the appropriate configuration (i.e. if you are building a debug build you have to change to the simulator under the debug configuration).
For some reason I was getting this error when I did change the simulator but realized that I was doing a debug build but changed to the simulator under the release configuration and not the debug configuration.
dkk's answer is what made things work for me. I had to change the Base SDK on the target and not just the project. Perhaps you have to do both.
I got a similar error after upgrading my iPhone to iOS4.2.1(8C148a). The situation is as following.
I was using Xcode 3.2.4, but it does not support iOS4.2.1. So I downloaded Xcode_3.2.5_and_ios-sdk_4.2_final.dmg which is 3.78GB requiring 9.53GB to install. Then I ran my ap with Xcode 3.2.5. That is where I got the above error message.
Now it is ok. I solve this based on Geowar's answer:
For the official answer:
http://developer.apple.com/library/ios/#qa/qa2010/qa1701.html
Please be noted that if you have done as Geowar said and the message is still there. Try to close Xcode 3.2.5 and restart it. That is how it works for me.
Another thing is that if you have just upgraded to iOS4.2.1 like me. When you try to load the a/p from Xcode 3.2.5 the first time. Xcode 3.2.5 may still give you "No provision iOS device connected". Please try to go to organizer and click on your iPhone under DEVICES on the left bar. Wait for a while to let Xcode in sync with your iPhone with iOS4.2.1. Then it will work. At least it work for me.
Jesse
Ok, so I struggled through this too. Based on some of the answers above and from the apple development forum, I was able to figure out what worked for me.
In XCODE, if you notice that the pull down at the top left of the window says "BASE SDK MISSING", you are going to get this error "There is no SDK with the name or path “iphoneos4.0”". To fix the problem:
double click on Group & Files in the upper part of the left pane of xcode. This will open a window
go to the Build tab of the new window
click on the row that says "BaseSDK" and select "Latest iOS (currently set to iOS 3.2)
The Configurations pull down near the top should now say "All Configurations". If not, set it.
close the window.
Now if you try to build, you will get a different error, something like: Code Sign error: The identity 'iPhone Developer: x Xxxxx' doesn't match any identity in any profile ...
So, now what you need to do in xcode is to click on the pull down in the upper left corner (the pull down that had the original BASE SDK MISSING indication, but probably has something different now), and make sure that both "Simulator" and "Debug" are checked as options in the pull-down.
now you should be good to go.
I just went Project -> Edit Project Settings -> Build -> then change the Base SDK to iPhone 4 simulator or I'm assuming whichever SDK you want to use.
I never had to specify the build for a given target, although my program was created on a mac that was already configured to use the iPhone 4.0 simulator.. so perhaps the targets were set for the simulator SDK and the project itself wasn't? Either way... just glad it works.
I was having the same problem and what I did to solve it was:
Go to Menu Project
Go to Set Active SdK
Select the option SIMULATOR instead of DEVICE
Build and Run and the ERROR has gonne!
I hope it works for you guys... =)
I just had a situation where I changed the Base SDK to 4.2 on my project after updating to Xcode 3.2.5, but I kept on getting the "There is no SDK..." error. I finally opened the project file (MyProject.xcodeproj/project.pbxproj) in a text editor and looked around. There was no mention of 4.0 anywhere, only 4.2. BUT when I then saved that file, it all started working in Xcode. Perhaps some permission on the file or something else. Have no idea really, but it worked.
I got this error when one of my configurations still referenced an old (iOS) SDK. Note that the error shouldn't have come up when I tried to build a totally different configuration (with correct Base SDK setting), so this smells like an XCode bug to me.
People suggesting that you don't set the base SDK in at target-level have probably never created projects which contain targets for different platforms all in one project file (in my case Mac and iOS targets, so setting the base SDK once in the project file is nonsense advice).

Adding SDK-specific frameworks to Xcode

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..."