Frank LaRosa
Frank LaRosa

Reputation: 3623

unrecognized selector sent to class coming from Facebook SDK

Around a year ago I installed the Facebook SDK into my iOS app, solely for the purpose of ad tracking. The only SDK calls I invoke in my app are the three that they tell you to put into your app delegate. There were no issues and my app ran fine (and the ad tracking worked).

Recently Facebook sent out an email asking me to update the SDK, so I did. Now my app crashes a few seconds after launching with a string of "unrecognized selector sent to class" errors.

Since I don't have Facebook's source code, I have no way to debug this, no idea where it's coming from, and no real option other than to remove the SDK entirely from my app, which will make my marketing people very upset.

What is this problem? Has anyone found a fix?

Upvotes: 3

Views: 2742

Answers (2)

Jadent
Jadent

Reputation: 1364

See RN FBK SDK iOS issue 472 and RN Unity SDK issue 208 also reporting similar crashes.

For me the addition of the -ObjC linker flag was not enough to prevent the crash.

I also had to include the force_load flag and the correct path to the FBSDKLoginKit Framework.

So in Other Link Flags within the project Build Settings in XCode I added:

-ObjC
-force_load
-${PROJECT_DIR}/FacebookSDK/FBSDKCoreKit.framework/FBSDKCoreKit

Note that your path to the FBSDKCoreKit framework may be different.

There are more details on the reason for this crash in the Github issues linked above.

Upvotes: 0

edelaney05
edelaney05

Reputation: 6987

In Build Settings, do you have -ObjC set for "Other Linker Flags?"

That resolved the issue for me.

Also, if you're not using CocoaPods, you could look at the podspec and try making sure you've got the required dependencies linked.

Specifically:

  "ios": {
    "weak_frameworks": [
      "Accounts",
      "CoreLocation",
      "Social",
      "Security",
      "QuartzCore",
      "CoreGraphics",
      "UIKit",
      "Foundation",
      "AudioToolbox",
      "WebKit"
    ]
  },

Upvotes: 6

Related Questions