iOS app Facebook integration - fallback for iOS 5.0 - ios

I'm using the native Facebook integration for my iOS app and it's working great, but my target is iOS 5.0 and above. The Facebook API is available only in iOS 6.0+, so my question is how can I "remove" the facebook integration for older iOS versions? Right now when I build I'm getting this:
dyld: Library not loaded: /System/Library/Frameworks/AdSupport.framework/AdSupport
Referenced from: /Users/me/Library/Application Support/iPhone Simulator/5.0/Applications/96919EDB-C9E9-4862-ABA2-67ABAFAFB9BE/Tlipo.app/Tlipo
Reason: image not found
I want to keep the FB integration only for iOS 6+ users, so I just want to remove it from iOS 5 devices. How do I remove the libraries so that my app doesn't crash in iOS 5?
Thanks! :)

Click on Xcode project.
Goto Build Phases
Expand "Link Binary With Libraries"
For (1)Social.framework(2)Account.framework(3)AdSupport.framework
Select Optional (At the far right hand side, by default they will have Required as selected)
Following the above mentioned steps, You are telling your App that only load those framworks if available (means for iOS 6.0 and upwards)
It should look like this after following the steps mentioned:
Most probably your problem will be solved.
Let me know, whether it worked or not!

I would recommend you to use the SDK from Facebook instead of the one from Apple. The officla SDK from Facebook supports iOS 5.0 as well, and it is pretty easy to use.
Have a look at https://developers.facebook.com/docs/getting-started/facebook-sdk-for-ios/

Related

Does Google Sign-in SDK iOS support iOS6?

My project must support iOS6.
I use Google Sign-In SDK v2.4.0.
But When I selected Target , the GoogleSignIn.framework (optional) in Xcode project and run on the iOS6 device, dyld log tells
dyld: Symbol not found: _OBJC_CLASS_$_NSURLSessionConfiguration.
Is there how to use this in iOS6 Device??
The GoogleSignIn guides don't state a minimum SDK version however...
NSURLSessionConfiguration was introduced in iOS7 so if you are getting that issue when trying to link to the SDK then iOS 6 certainly isn't supported.
Checking out the sample project (pod try Google) and it also has the Deployment target set to iOS 7.0 so it looks like you are out of luck I am afraid. Maybe look at using an older version but I can't help you with what version supports iOS 6 and I would not know if it is still supported/maintained by Google.

Xcode 6.3 App Submission Failed for iOS 7

I am currently using XCode 6.3. My project is using CocoaPods.
I have set Deployment Target to be iOS7.0 for both my project and Pods. Also, I have validated my archive and it was successful.
But, when I clicked "Submit to App Store...", it failed with the following errors.
"Invalid Info.plist value. The value for the key ‘MinimumOSVersion’ in bundle ActionSheetPicker_3_0.framework is invalid. The minimum value is 8.0"
"Invalid Segment Alignment. The app binary at ‘AHKActionSheet’ does not have proper segment alignment. Try rebuilding app with the latest Xcode version."
Please help!!! I really need my app to work for iOS 7+, because I am from Myanmar and lots of people here are still using iOS 7. Thanks a lot!!!
The error appears because you are using the ActionSheetPicker framework which apparently requires iOS 8.
So you should review your ActionSheetPicker framework. Is there a version which supports iOS 7? If not you should use another framework.
As Dung says ActionSheetPicker requires iOS8. You have several options:
Weakly link the ActionSheetPicker framework, and use an alternative for iOS7
Fix (or ask developer to fix) ActionSheetPicker so it works with iOS7 (according to his Readme it should work with iOS 5.1.1+). It is likely only the case of changing deployment target of the framework and rebuilding.
Use a different library for this purpose, or code this functionality yourself.
Always test on the target iOS versions before you release to apple!

Consequences of "Embedded dylibs/frameworks only run on iOS 8 or later" warning

With Xcode 6.x we can use CocoaTouch Framework template to build a framework library and Xcode will create the .framework for us when we build, which is awesome. In our framework we want to support iOS 7.1 and up, so for Deployment Target (in our framework) we specified 7.1. Now when we build we see a warning: "Embedded dylibs/frameworks only run on iOS 8 or later". I've since read a number of blog posts on the subject that as far as running it on iOS 7.1 this warning can be ignored because it will run fine (still need to test to make sure). What concerns me is that I read a post on Stack Overflow which says an app may be rejected by Apple in the App Store (see: Xcode 6 and Embedded Frameworks only supported in iOS8)
Does it only apply when in Xcode the app links to it in General > Embedded Libraries?
The way we want our customers to link to our framework is:
Via CocoaPods
By referencing .framework in Build Phase > Link Binary With Libraries
I need to understand under what conditions App Store will reject an app which uses our CocoaTouch framework and supports 7.x iOS.
The app wont be rejected if you'll change the type of your framework to Static. See my answer here.
I believe that as long as the app deals with the framework correctly there shouldn't be any issues. Mixing with cocoapods could be tricky and honestly I don't know the best way to tackle it.
But from what I understand, if an app supports iOS 7.X -> 8.X and uses an embedded cocoa touch framework, as long as the compatibility checks are there to ensure the app doesn't crash in 7.X, there shouldn't be any reason for the app to be rejected.
We tried running the latest code on the following configurations:
iOS 8+ — iPhone 5s
iOS 7.1.2 — iPhone 4
iOS 6.1.3 — iPad 4
The App is working fine on all the three devices but the warning is present in the Xcode while compiling .
"embedded dylibs/frameworks only run on iOS 8 or later”
Also I tried to Archive the App in order to submit it to the app store it went on fine.
Also, found out a link where in an apple developer stated this to be a bug:
https://devforums.apple.com/message/999579#999579

ios conditionally switch off facebook sdk

I integrated Facebook Ads SDK to my app. However, minimal supported iOS version for SDK is 5.0, and deployment target for my app is 4.3.
And, as expected, it crashes on app launch saying
dyld: Symbol not found: OBJC_CLASS$_NSJSONSerialization.
It happens at a very early stage of app start. Call stack looks as
Thread1:
dyld_fatal_error
_dyld_start
So I want to switch off Facebook SDK for iOS 4.3 and keep it for iOS >= 5.0. Is it possible? How can I do it in xCode? Or the only way is to split my app into two apps: for 4.3 and for >= 5.0?
Update
Accordingly to NSJSONSerialization crash with Facebook iOS SDK 3.5 marking Foundation.framework as optional helps. It really helps, but I cannot understand it. What has Foundation.framework to do with Facebook stuff??
Go to the build phases of your target. Under Link binary with Libraries select your framework and make it as optional

NSJSONSerialization crash with Facebook iOS SDK 3.5

After I updated Facebook iOS SDK from 3.2 to 3.5 I'm getting this error when running my app in a device with iOS older than 5 (eg 4.3.5).
dyld: Symbol not found: _OBJC_CLASS_$_NSJSONSerialization
...
Expected in: /System/Library/Frameworks/Foundation.framework/Foundation
I can avoid this crash if I set Foundation framework as Optional, but I don't think this is the best option.
Is there another way to make Facebook SDK works in devices with iOS previous to version 5?
From Facebook iOS SDK changelog v3.5:
http://developers.facebook.com/ios/change-log-3.x/
Removes support for iOS 4.* Facebook 6.0 dropped support for iOS 4.x. To stay in sync, the Facebook SDK is also does not support iOS 4.x.
So, if you update to Facebook SDK 3.5 you lose support for iOS 4.x
That class was not available until ios5 - look at the class reference in the Xcode documentation window. What you need to do is grab JSONKit, an open source class, and use it. Usage is mostly the same. You will need to build this class into your app then test dynamically if the apple class exists, then use the appropriate class, or just always use the open source class.
Note that JSONKit is not ARCified, so you need to set the appropriate compile flag for it if the rest of your app is ARC.
Edit: so you may be able to get clever and write your own stub that bridges calls to JSONKit in older releases. Conceptually you should be able to make this work, but my fear would be that if the FB code was developed for ios5 then there may be other Api problems lurking in the code too - and you old spend a lot of time continually trying to find and fix them.

Resources