0

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??

Community
  • 1
  • 1
Nick
  • 3,205
  • 9
  • 57
  • 108
  • does http://stackoverflow.com/a/3128299/440060 help? – maroux May 28 '13 at 10:54
  • @Mar0ux As I understand, the idea is to use "weak" or "optional" linking for frameworks. The problem is that I add FacebookSDK.framework manually to my project and it does not help to make it "optional". Can I add this framework "conditionally"? – Nick May 28 '13 at 11:36
  • Ah, I see the problem. You can't really add it "conditionally", since the check needs to happen at runtime. One option is to drop support for Facebook connect on iOS 5 (< 10% users), and weak link with `Social` framework. On a side note, have you considered dropping support for iOS 4? It would affect < 4% of your users. – maroux May 28 '13 at 11:59
  • @Mar0ux I have already marked Social, FacebookSDK, and a bunch of other frameworks "optional", but it did not help. What helped is marking Foundation.framework "optional" (see updated question). And I cannot understand it. – Nick May 28 '13 at 12:23

1 Answers1

1

Go to the build phases of your target. Under Link binary with Libraries select your framework and make it as optional

enter image description here

Anil Varghese
  • 42,757
  • 9
  • 93
  • 110
  • Thanks for detailed answer, but the framework is not a standard one. It is FacebookSDK.framework that I added manually into my project, and making it "optional" does not help. Please see my updated question. – Nick May 28 '13 at 12:20
  • It is, and I made it "optional" and it did not help. However, when I marked stadard "Foundation.framework" "optional", it stopped crashing. Sort of magic. – Nick May 28 '13 at 12:36
  • Actually facebook SDK uses NSJSonSerialization part of the foundation framework. That is not available in iOS4.3. Thats why it is crashing – Anil Varghese May 28 '13 at 12:52