ios8-Facebook sdk如何使用UIWebView打开应用程序请求url
我正在向facebook好友发送应用程序请求,那么如何在UIWebView中打开应用程序请求 NSDictionary*参数dict=@{@“to”:@“}ios8-Facebook sdk如何使用UIWebView打开应用程序请求url,ios,facebook,facebook-graph-api,webview,facebook-invite,Ios,Facebook,Facebook Graph Api,Webview,Facebook Invite,我正在向facebook好友发送应用程序请求,那么如何在UIWebView中打开应用程序请求 NSDictionary*参数dict=@{@“to”:@“} 我正在向facebook好友发送应用程序请求,那么如何在UIWebView中打开应用程序请求?要邀请用户,添加facebook sdk后可以使用以下代码 [FBWebDialogs presentRequestsDialogModallyWithSession:nil message:@"Your invite message" titl
我正在向facebook好友发送应用程序请求,那么如何在UIWebView中打开应用程序请求?要邀请用户,添加facebook sdk后可以使用以下代码
[FBWebDialogs
presentRequestsDialogModallyWithSession:nil
message:@"Your invite message"
title:nil
parameters:nil
handler:^(FBWebDialogResult result, NSURL *resultURL, NSError *error) {
if (error) {
// An error occurred, we need to handle the error
// See: https://developers.facebook.com/docs/ios/errors
NSLog(@"Error publishing story: %@", error.description);
} else {
if (result == FBWebDialogResultDialogNotCompleted) {
// User canceled.
NSLog(@"User cancelled.");
} else {
// Handle the publish feed callback
}
}
}];
/////////////////////////
在webview中显示应用程序请求:发送朋友的facebookId和消息
- (void)sendAppRequestToFacebookFriend:(NSString*)message andFacebookId:(NSString*)friendFBId {
NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
message, @"message",
@"", @"redirect_url",
friendFBId,@"to",
nil];
[FBWebDialogs
presentRequestsDialogModallyWithSession:nil
message:message
title:@"App Title App"
parameters:params
handler:^(FBWebDialogResult result, NSURL *resultURL, NSError *error) {
if (!error) {
if (result == FBWebDialogResultDialogNotCompleted) {
}
else if([[resultURL description] hasPrefix:@"fbconnect://success?request="]) {
//code after success
}
}
}
];
}
没关系,但是如何将此url传递到webview。如何在webview中打开应用程序请求。嘿,兄弟!!!我有FacebookHelper.h&m文件和sharedFacebookHelper.session,甚至未声明标识符作为错误,该怎么办?在-presentRequestsDialogModallyWithSession的块中:sharedFacebookHelper.delegate.session,我获取了“shareFacebookHelper.delegate.session”的未声明标识符。崩溃:由于未捕获的异常“NSInvalidArgumentException”而终止应用程序,原因:“-[FBDialog initWithURL:params:isViewInvisible:frictionlessSettings:delegate::未识别的选择器发送到实例0x78ed0260”。
- (void)sendAppRequestToFacebookFriend:(NSString*)message andFacebookId:(NSString*)friendFBId {
NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
message, @"message",
@"", @"redirect_url",
friendFBId,@"to",
nil];
[FBWebDialogs
presentRequestsDialogModallyWithSession:nil
message:message
title:@"App Title App"
parameters:params
handler:^(FBWebDialogResult result, NSURL *resultURL, NSError *error) {
if (!error) {
if (result == FBWebDialogResultDialogNotCompleted) {
}
else if([[resultURL description] hasPrefix:@"fbconnect://success?request="]) {
//code after success
}
}
}
];
}