ios conditionally switch off facebook sdk - ios

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

Related

iOS app compiles but crashes on launch when using unsupported 3rd party SDK

I have recently dropped the support of iOS 9 in one of my SDKs and set the minimum target version to iOS 10. This has caused some of the users of my SDK who updated to the latest version of SDK to face an unusual crash in their apps as they are still supporting iOS 9.
My SDK is a dynamically linked library, and the app running on iOS 9 devices crashes even before main() is called. I have tried setting the library to be optional in the build phases, but that doesn't stop linking the library at run time. I can't seem to capture the point where the library is linked and somehow make an exception for the unsupported iOS versions.
Is there anyway to avoid this crash on the lower versioned devices right within the SDK? Or this can only be handled from the app integrators end?
Any help or pointers would be highly appreciated!

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.

iOS 9 (Xcode 7) Facebook API/FBSDKCoreKit.framework/FBSDKCoreKit(FBSDKAccessToken.o)' does not contain bitcode

I am trying to build the my app containing Facebook SDK with Xcode 7 in iOS 9.0. I am getting this error.
Thanks
Update your Facebook SDK version to 4.6
The SDK supports various iOS 9 features including Bitcode. In
addition, the SDK dialogs such as Login, Like, Share Dialogs
automatically determine the best UI based on the device, including
SFSafariViewController instead of Safari. Follow the our Preparing for
iOS 9 guide.
https://developers.facebook.com/docs/ios/downloads
Facebook SDK 4.6 Download Link
Also check this for upgrading to iOS 9 Facebook SDK https://developers.facebook.com/docs/ios/ios9
If you getting another bitcode error from other SDK then you can disable bitcode from setting of Xcode target.
For Bitcode issue you can check this question : New warnings in iOS 9
If you have all SDK (Frameworks) with the bitcode enabled then you will not get the bitcode error. If you get that error then Disable it from settings.
Okay I'm just gonna add my own answer.
Import using Cocoapods.
https://github.com/facebook/facebook-ios-sdk.git
That will get bitcode compiled into the framework.

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 app Facebook integration - fallback for iOS 5.0

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/

Resources