2
我使用的是貼在我前面的問題的代碼片段,Simple way to add Facebook/Twitter share to app?SLComposeViewController「臉譜不可用」
if ([SLComposeViewController isAvailableForServiceType:SLServiceTypeFacebook]) {
SLComposeViewController *slComposeViewController = [SLComposeViewController composeViewControllerForServiceType:SLServiceTypeFacebook];
[slComposeViewController setInitialText:@"Your text"];
[slComposeViewController addImage:[UIImage imageNamed:@"NameOfImage"]];
[self presentViewController:slComposeViewController animated:YES completion:nil];
} else {
//Show alert or in some way handle the fact that the device does not support this //feature
NSLog(@"Facebook not available");
}
但是,當我在設備上運行它,並在模擬器中所有我得到的是「Facebook不可用」,我可能做錯了什麼?
我已經看過可用的教程,我已經包含了所需的庫,所以我不知道我在做什麼錯了。
如果FaceBook的賬戶沒有在Setting.app中設置,那就是noral。 – Larme
那麼註冊Facebook/Twitter的人沒有問題嗎?只有當你沒有設置這些服務時,它纔會說它不可用? – Phil
SLComposerViewController允許用戶在FaceBook上發佈消息。但是,你怎麼知道要使用哪個帳戶?請記住,要使用FaceBook,您必須創建一個帳戶或登錄。 Apple從iOS6開始引入了來自Settings.app的登錄,這裏是您的問題的關鍵。如果用戶未登錄,則不會發布FaceBook。 – Larme