回到2016年12月我的iOS應用程序仍然正常工作。 但現在我發現共享功能不起作用。 沒有在我的源代碼改變ios上的ios Facebook SDK共享錯誤
這裏登錄我從設備控制檯有:
Feb 13 23:16:48 duc-lans-iPad Facebook[3787] : -canOpenURL: failed for URL: "fb123123123://bridge/share?cipher=AZpZOY%2BS6YXHfhtlqhaCH2l5dfoAnuTBZbNpwXODLhCIncH1CSahDjHaMOv2UMeIFtFs5l1xw1%2Bs4ZPM40rsKKCfnxdvn2HhOHkPRWZXVlGGapfRMFAOriQjNdv8IwOQ%2FKT84S%2BujvmSPcUOXR24Ss5oSrK19sHQHfWpF7xe28az4MRGAfjE9Jh7%2BCMBI8YtLdLSqp7v%2FW4DDECHztrXrI%2BFi9aV1u0pyLlJ3C8CEJWbm3dl903od6gxU9ErC39wZzsIMH7Fq1fK4cgjYj%2B8x0MLZ1qhQnKz1OmS5a%2FjyXSY7hWHLuvYogRO3LcmzDmdujSaahv%2BhXSbwGeO0cVhp4bT58EH4xzRjDi1HqhoYSqxJojKkSP53zShdNTsLP2iVySRMl4Da58ApbFq0YfLK7APtWmdQ676JQOjO33ole24LHDo%2FyjIfp%2FUukhOUj%2BJ7S2g4sNaQ1amRrYI9pTc7m6y0KEEzsvDJ9BR9o%2FaQ%2F6dvDUeHhhel4SIfd6g6so%2FS05J2VeztSVlLJqVZnUHD6DkOI%2BvOqA1QyVr09I02%2F0HtC%2BOTLg3VZATfMeXPiiXEo%2BMqgknJvyS89UFk7xUIPw7toVurM84jIb6YeNRLxpbH55Axv%2FpQJqmyQQ443GA2M72Y0q1p7wDghBR7XinIiXCeIlj%2FcxDBmHzB9IIk9GmtRCtum5pQET%2B%2BRs0FT7mE2epZvKhPEdpGSAN6SwC%2Fd4QEGlPDbM10On6z9x6gV%2BKTzWAchy2glpXGq6NBJcrSLo8XlH%2FPt80OP3iHVpsrBKkrh5GP2kRir%2BETr3b7%2FLXWJJgP6ScuiPjw1EmKwHQwvb%2FZqn756xXFcDbu7%2Ba8wTQUvF8bWs8bNcJpjnubN%2Fs6jWQ0cBN40Ke5k819NPr5ecRska1ESC1TPclug64KWlnOqB6aqF4gRXSDkg9uvAoVu5QIEFRtrZJZOzOKaV1sQNTrscf8Buw566c0YPwudovgFTUV1%2FD9tFLm3hhYMcwN1uYO4fqdznCG6knhns98dOW0o%2B%2FkbS2H9QfR8rIZNhT%2FFpfQfUIuTYsvgLH5WrJORm%2BKT9mraUM8s29owcqc%2Bbn9kq4ma3T8nV5dy3fY6Com0vK7w%2BDMTT9ZyP0WKZDPsgDkM4i%2FawZrO6zE9OaWb0WWKpn3uHm8FGuqldMkP19xYxBuhO1a13bnCi3ulZu4uQpIg1e93zEHS3LUr6JjBFSZf61bb5wlJmNGal50Js%3D&version=20130214" - error: "This app is not allowed to query for scheme fb123123123" Feb 13 23:16:48 duc-lans-iPad mediaserverd[2389] : '' com.facebook.Facebook(pid = 3787) setting DiscoveryMode = DiscoveryMode_None, currentDiscoveryMode = DiscoveryMode_None Feb 13 23:16:48 duc-lans-iPad mediaserverd[2389] : '' com.facebook.Facebook(pid = 3787) setting DiscoveryMode = DiscoveryMode_None, currentDiscoveryMode = DiscoveryMode_None Feb 13 23:16:48 duc-lans-iPad AppName[3837] : FB: ERROR=Error Domain=com.facebook.Facebook.platform Code=102 "(null)" UserInfo={error_code=102, error_description=An error occurred during publishing., app_id=123123123, error_reason=The operation couldn’t be completed. (FBAPIErrorDomain error 100.)} Feb 13 23:16:49 duc-lans-iPad AppName[3837] : ViewController::didBecomeActive Feb 13 23:16:49 duc-lans-iPad Facebook[3787] : [CoreBluetooth] API MISUSE: can only accept this command while in the powered on state
我拿Facebook的代表裏面的NSLog及以下結果:
2017-02-13 23:16:48.946 AppName[3837:2839472] FB: ERROR=Error Domain=com.facebook.Facebook.platform Code=102 "(null)" UserInfo={error_code=102, error_description=An error occurred during publishing., app_id=123123123, error_reason=The operation couldn’t be completed. (FBAPIErrorDomain error 100.)}
我比較顯示名稱中Facebook設置和.plist設置,它們是相同的。
info.plist中:
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>CFBundleURLName</key>
<string></string>
<key>CFBundleURLSchemes</key>
<array>
<string>fb123123123</string>
</array>
</dict>
</array>
和
<key>FacebookAppID</key>
<string>123123123</string>
<key>FacebookDisplayName</key>
<string>AppName</string>
和
<key>LSApplicationQueriesSchemes</key>
<array>
<string>fbapi</string>
<string>fb-messenger-api</string>
<string>fbauth2</string>
<string>fbshareextension</string>
<string>line</string>
<string>twitter</string>
</array>
在源代碼
:
FBSDKShareLinkContent *content = [FBSDKShareLinkContent new];
NSString *stringURL = [NSString stringWithFormat:@"%@sharemovie?movie=%@", BASE_URL, [dict getStringFromKey:@"movieId"]];
content.contentURL = [NSURL URLWithString:stringURL];
content.contentTitle = [NSString stringWithFormat:@"%@abcabcabc",[dict objectForKey:@"movieCreator"]];
content.ref = stringURL;
FBSDKShareDialog *dialog = [[FBSDKShareDialog alloc] init];
dialog.fromViewController = vc;
dialog.shareContent = content;
// dialog.mode = FBSDKShareDialogModeShareSheet;
if ([[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:@"fbauth2://"]]){
dialog.mode = FBSDKShareDialogModeNative;
}
else {
dialog.mode = FBSDKShareDialogModeBrowser; //or FBSDKShareDialogModeAutomatic
}
dialog.delegate = vc;
[dialog show];
它有什麼問題? 謝謝!