I have implemented Facebook's new 4.0 SDK App Invites Dialog for iOS as per: https://developers.facebook.com/docs/app-invites/ios
I am testing it out in the simulator.
When I login with my real Facebook account the App Invite dialog appears and I see all of my friends. To test the notifications though I want to use facebook test users as this is what the guide recommends:
We have internal logic that determines whether a push notification is sent to the client. If we detect that the person has installed the app, we may not trigger a push notification. The best way to test push notifications is to use test users .
However, when I login as a test user for my app and try to bring up the dialog it fails with the following error:
Error in invite Error Domain=com.facebook.sdk.core Code=2 "The operation couldn’t be completed. (com.facebook.sdk.core error 2.)" UserInfo=0x7f989d8cbe00 {com.facebook.sdk:FBSDKErrorDeveloperMessageKey=Invalid method_results., com.facebook.sdk:FBSDKErrorArgumentNameKey=method_results}
If I try with the same test user on the actual phone it works fine. It seems this issue only occurs on the simulator.
Updated to add the code I'm using:
var inviteDialog : FBSDKAppInviteDialog = FBSDKAppInviteDialog()
if (inviteDialog.canShow()) {
let appLinkUrl : NSURL = NSURL(string: "https://fb.me/1616988365211522")!
let previewImageUrl : NSURL = NSURL(string: "http://upload.wikimedia.org/wikipedia/commons/4/4f/Polistes_May_2013-2.jpg")!
var inviteContent : FBSDKAppInviteContent = FBSDKAppInviteContent()
inviteContent.previewImageURL = previewImageUrl
inviteContent.appLinkURL = appLinkUrl
inviteDialog.content = inviteContent
inviteDialog.delegate = self
inviteDialog.show()
}
elsewhere....
func appInviteDialog(appInviteDialog: FBSDKAppInviteDialog!, didCompleteWithResults results: [NSObject : AnyObject]!) {
// nothing to do here
println("Completed App Invite with results: \(results)")
}
func appInviteDialog(appInviteDialog: FBSDKAppInviteDialog!, didFailWithError error: NSError!) {
// don't know enough about the errors to let the user know
println("Error in App Invite: \(error)")
}
Note, this is a test version of my app. The Apple App Store id is not my app (obviously) but since my app is not yet on the store I needed to add something for testing.
i have encountered the same issue ,in my case when i was testing app invite , it was working fine for all user except for one , and the error was: Printing description of error:
Error Domain=com.facebook.sdk.core Code=2 "The operation couldn’t be completed. (com.facebook.sdk.core error 2.)" UserInfo=... {com.facebook.sdk:FBSDKErrorArgumentNameKey=method_results, com.facebook.sdk:FBSDKErrorDeveloperMessageKey=Invalid method_results.}
and this error was occurring for the user whose account i created on Facebook but didn't confirm that account from email link ,after confirming the account this error didn't appeared and i was able to send invite from that particular user.
Hope this will help :)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.