Facebook-sdk-for-unity: v7.16.1 iOS crash in FB.FeedShare API

Created on 16 Jul 2019  路  10Comments  路  Source: facebook/facebook-sdk-for-unity

unity 2018.3.4f1

i have upgrade facebook sdk from v7.15.0 to v7.16.1

it works on webgl and android

2019-07-16 12:13:59.692006+0900 xxxxxx[795:499714] -[FBSDKShareLinkContent setFeedParameters:]: unrecognized selector sent to instance 0x282053e30
2019-07-16 12:14:00.189665+0900 xxxxxx[795:499714] Uncaught exception: NSInvalidArgumentException: -[FBSDKShareLinkContent setFeedParameters:]: unrecognized selector sent to instance 0x282053e30
(
0 CoreFoundation 0x00000001a04cd294 + 252
1 libobjc.A.dylib 0x000000019f6a79f8 objc_exception_throw + 56
2 CoreFoundation 0x00000001a03e9ab8 + 0
3 CoreFoundation 0x00000001a04d2ac4 + 1408
4 CoreFoundation 0x00000001a04d475c _CF_forwarding_prep_0 + 92
5 xxxxxxx 0x000000010127d998 -[FBUnityInterface shareFeedWithRequestId:toId:link:linkName:linkCaption:linkDescription:picture:mediaSource:] + 460

Most helpful comment

ok. I found out how to fix this bug.

i have tested in SDK version 7.18.0
it's maybe same all SDK version from 7.16.x to 7.18.0

try to comment line in Assets/FacebookSDK/SDK/Editor/iOS/FBUnityInterface.mm

  • (void)shareFeedWithRequestId:(int)requestId
    toId:(const char *)toID
    link:(const char *)link
    linkName:(const char *)linkName
    linkCaption:(const char *)linkCaption
    linkDescription:(const char *)linkDescription
    picture:(const char *)picture
    mediaSource:(const char *)mediaSource
    {
    FBSDKShareLinkContent *linkContent = [[FBSDKShareLinkContent alloc] init];
    NSString *contentUrlStr = [FBUnityUtility stringFromCString:link];
    if (contentUrlStr) {
    linkContent.contentURL = [NSURL URLWithString:contentUrlStr];
    }

    NSMutableDictionary *feedParameters = [[NSMutableDictionary alloc] init];
    NSString *toStr = [FBUnityUtility stringFromCString:toID];
    if (toStr) {
    [feedParameters setObject:toStr forKey:@"to"];
    }

    NSString *captionStr = [FBUnityUtility stringFromCString:linkCaption];
    if (captionStr) {
    [feedParameters setObject:captionStr forKey:@"caption"];
    }

    NSString *sourceStr = [FBUnityUtility stringFromCString:mediaSource];
    if (sourceStr) {
    [feedParameters setObject:sourceStr forKey:@"source"];
    }

    //linkContent.feedParameters = feedParameters; // <<<=========== comment this line
    [self shareContentWithRequestId:requestId
    shareContent:linkContent
    dialogMode:FBSDKShareDialogModeFeedWeb];
    }

All 10 comments

Hi, I get same error in FB.FeedShare
I use FB sdk v7.17.2 and "-ObjC" flag already exist in xcode project.
I tried :

  1. Add "-all_load" flag
  2. change "-all_load" to "-force_load"

and always get error :
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[FBSDKShareLinkContent setFeedParameters:]: unrecognized selector sent to instance

Anybody solved this?

Hi, I'm getting the same error in FB.FeedShare.

Unity version: 2018.3.14f1
SDK: 7.17.1
Platform: iOS

Error:

Uncaught exception: NSInvalidArgumentException: -[FBSDKShareLinkContent setFeedParameters:]: unrecognized selector sent to instance 0x516125f0

Any fixes?

Hi,
I am getting the same error in 7.17.2 on IOS.
Unity Version: 2019.1.8f1.
Did anyone get any fix?

Same error using FB.FeedShare!
Application crashes immediately after getting this error.

Unity version: 2019.1.1f1
SDK: 7.17.2
Platform: iOS

Same error using FB.FeedShare!

Unity version: 2019.2.3f1
SDK: 7.18.0
Platform: iOS

ok. I found out how to fix this bug.

i have tested in SDK version 7.18.0
it's maybe same all SDK version from 7.16.x to 7.18.0

try to comment line in Assets/FacebookSDK/SDK/Editor/iOS/FBUnityInterface.mm

  • (void)shareFeedWithRequestId:(int)requestId
    toId:(const char *)toID
    link:(const char *)link
    linkName:(const char *)linkName
    linkCaption:(const char *)linkCaption
    linkDescription:(const char *)linkDescription
    picture:(const char *)picture
    mediaSource:(const char *)mediaSource
    {
    FBSDKShareLinkContent *linkContent = [[FBSDKShareLinkContent alloc] init];
    NSString *contentUrlStr = [FBUnityUtility stringFromCString:link];
    if (contentUrlStr) {
    linkContent.contentURL = [NSURL URLWithString:contentUrlStr];
    }

    NSMutableDictionary *feedParameters = [[NSMutableDictionary alloc] init];
    NSString *toStr = [FBUnityUtility stringFromCString:toID];
    if (toStr) {
    [feedParameters setObject:toStr forKey:@"to"];
    }

    NSString *captionStr = [FBUnityUtility stringFromCString:linkCaption];
    if (captionStr) {
    [feedParameters setObject:captionStr forKey:@"caption"];
    }

    NSString *sourceStr = [FBUnityUtility stringFromCString:mediaSource];
    if (sourceStr) {
    [feedParameters setObject:sourceStr forKey:@"source"];
    }

    //linkContent.feedParameters = feedParameters; // <<<=========== comment this line
    [self shareContentWithRequestId:requestId
    shareContent:linkContent
    dialogMode:FBSDKShareDialogModeFeedWeb];
    }

FBSDK version 7.17.2 still have this issue, and @sonjoono 's solution works, thanks

Unity 2019.2.16f1
Unity Facebook SDK 7.18.1
XCode 11.3.1

The same issue still not fixed on iOS and Facebook threatens to place a restriction on the app.
Fun times. almost a year without an official fix from Facebook.

The issue is still present in Unity Facebook SDK 7.19.0

The issue should be fixed in 7.19.2

Was this page helpful?
0 / 5 - 0 ratings

Related issues

1901 picture 1901  路  6Comments

michelleran picture michelleran  路  6Comments

Shaitan1805 picture Shaitan1805  路  6Comments

edscodeblenders picture edscodeblenders  路  4Comments

michelleran picture michelleran  路  4Comments