执行这段代码时
FBSDKShareDialog *dialog = [[FBSDKShareDialog alloc] init];
dialog.fromViewController = viewController;
dialog.shareContent = content;
dialog.mode = FBSDKShareDialogModeFeedWeb;
dialog.delegate = self;
[dialog show];
应用程序在[对话框显示]崩溃;使用此堆栈跟踪:
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
原因是:&#39; - [__ NSCFString scheme]:无法识别的选择器发送到实例0x187a8030&#39;。
这是因为我们使用iOS9构建了这个。
现在,plist包含FaceBookSDK 4.6的正确方案,并且允许AppTranspotPolicy。
你们有什么想法解决这个问题吗?
谢谢, d。
答案 0 :(得分:2)
显然Facebook并不检查内容网址是否真的是网址,即使对象是NSString,它们也会调用[NSURL方案]。
所以内容图像网址是这样编写的,编译器没有任何警告或问题:
content.imageURL = [sharedData valueForKey:@"link"]; //which is an NSString
并且在制作像这样的NSURL之后
content.imageURL = [NSURL URLWithString:[sharedData valueForKey:@"link"]];
似乎一切正常。
非常糟糕,因为编译器并没有抱怨,但应用程序在运行时崩溃了。我也会在Facebook上提交一个错误。
PS:我已经在这里为任何会碰到这个的人写过这个。