我正在向 facebook 朋友发送应用请求,那么如何在 UIWebView 中打开应用请求?
NSDictionary *parametersDict = @{@"to":@""};
[FBWebDialogs presentRequestsDialogModallyWithSession:FBSession.activeSession
message:@"YouPin"
title:@"my title"
parameters:parametersDict
handler:^(FBWebDialogResult result, NSURL *resultURL, NSError *error)
{
if(error)
{
NSLog(@"Some errorr: %@", [error description]);
UIAlertView *alrt = [[UIAlertView alloc] initWithTitle:@"Invitiation Sending Failed" message:@"Unable to send inviation at this Moment, please make sure your are connected with internet" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles: nil];
[alrt show];
}
else
{
if (![resultURL query])
{
[self.navigationController popViewControllerAnimated:YES];
return;
}
NSDictionary *paramsStr = [self parseURLParamsSecond:[resultURL query]];
NSMutableArray *recipientIDs = [[NSMutableArray alloc] init];
for (NSString *paramKey in paramsStr)
{
if ([paramKey hasPrefix:@"to["])
{
[recipientIDs addObject:[paramsStr objectForKey:paramKey]];
}
}
if ([paramsStr objectForKey:@"request"])
{
NSLog(@"Request ID: %@", [paramsStr objectForKey:@"request"]);
}
if ([recipientIDs count] > 0)
{
NSLog(@"Recipient ID(s): %@", recipientIDs);
UIAlertView *alrt = [[UIAlertView alloc] initWithTitle:@"Success!" message:@"Invitation(s) sent successfuly!" delegate:self cancelButtonTitle:@"OK" otherButtonTitles: nil];
alrt.tag = 10;
[alrt show];
}
}
}friendCache:nil];
- (NSDictionary *)parseURLParamsSecond:(NSString *)query
{
NSArray *pairs = [query componentsSeparatedByString:@"&"];
NSMutableDictionary *paramsSECOND = [[NSMutableDictionary alloc] init];
for (NSString *pair in pairs)
{
NSArray *kv = [pair componentsSeparatedByString:@"="];
[paramsSECOND setObject:[[kv objectAtIndex:1] stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding]
forKey:[[kv objectAtIndex:0] stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding]];
}
return paramsSECOND;
}
我正在向 facebook 朋友发送应用请求,那么如何在 UIWebView 中打开应用请求?