Reputation: 85
When executing this piece of code
FBSDKShareDialog *dialog = [[FBSDKShareDialog alloc] init];
dialog.fromViewController = viewController;
dialog.shareContent = content;
dialog.mode = FBSDKShareDialogModeFeedWeb;
dialog.delegate = self;
[dialog show];
the app crashes at [dialog show]; with this stack trace:
0 CoreFoundation 0x2b9effa7 <redacted> + 150
1 libobjc.A.dylib 0x3a0a0c8b objc_exception_throw + 38
2 CoreFoundation 0x2b9f53a9 <redacted> + 0
3 CoreFoundation 0x2b9f32c7 <redacted> + 714
4 CoreFoundation 0x2b922ba8 _CF_forwarding_prep_0 + 24
5 uCiC 0x003cf1ef +[FBSDKInternalUtility isBrowserURL:] + 22
6 uCiC 0x0044c9f5 +[FBSDKShareUtility _validateNetworkURL:name:error:] + 64
7 uCiC 0x0044b17d +[FBSDKShareUtility validateShareLinkContent:error:] + 176
8 uCiC 0x0044ad71 +[FBSDKShareUtility validateShareContent:error:] + 284
9 uCiC 0x004433ad -[FBSDKShareDialog validateWithError:] + 84
10 uCiC 0x004431c5 -[FBSDKShareDialog show] + 36
11 uCiC 0x002028c7 -[ICSocialSharer fbSharingInAppWebViewContent:inViewController:] + 306
12 uCiC 0x002031f5 -[ICSocialSharer fbSharingForPostModel:inViewController:] + 2316
13 uCiC 0x00203549 -[ICSocialSharer postMessageForModel:socialNetwork:inViewController:] + 568
14 uCiC 0x000ea2e5 -[PostFotoViewController postSocial:] + 1528
15 UIKit 0x2f0a2c4b <redacted> + 70
16 UIKit 0x2f0a2bf1 <redacted> + 44
17 UIKit 0x2f08d7e3 <redacted> + 582
18 UIKit 0x2f0a265d <redacted> + 588
19 UIKit 0x2f0a2337 <redacted> + 522
20 UIKit 0x2f09bc11 <redacted> + 544
21 UIKit 0x2f071e05 <redacted> + 196
22 UIKit 0x2f2e86fb <redacted> + 14414
23 UIKit 0x2f070819 <redacted> + 1352
24 CoreFoundation 0x2b9b5d8f <redacted> + 14
25 CoreFoundation 0x2b9b519f <redacted> + 218
26 CoreFoundation 0x2b9b3805 <redacted> + 772
27 CoreFoundation 0x2b8fff31 CFRunLoopRunSpecific + 476
28 CoreFoundation 0x2b8ffd43 CFRunLoopRunInMode + 106
29 GraphicsServices 0x333da201 GSEventRunModal + 136
30 UIKit 0x2f0d1879 UIApplicationMain + 1440
31 uCiC 0x0010d07d main + 108
32 libdyld.dylib 0x3a652aaf <redacted> + 2
And the reason being: '-[__NSCFString scheme]: unrecognized selector sent to instance 0x187a8030'.
This happens since we've built using iOS9.
Now, the plist contains the correct schemes for FaceBookSDK 4.6 and also the AppTranspotPolicy is allowed.
Do you guys have any idea about how to fix this?
Thanks, D.
Upvotes: 1
Views: 327
Reputation: 85
Apparently Facebook doesn't check if content urls are actually urls and they call [NSURL scheme] even though the object is an NSString.
So the content image url was written like this without any warning or problem from the compiler:
content.imageURL = [sharedData valueForKey:@"link"]; //which is an NSString
and after making it an NSURL like this
content.imageURL = [NSURL URLWithString:[sharedData valueForKey:@"link"]];
everything seems to work ok.
Pretty bad because the compiler doesn't complain but the app crashes at runtime. I will also file a bug on Facebook.
PS: I've wrote this here for anyone that will bump into this.
Upvotes: 2