在我的 iphone 应用程序中,我正在访问我的 facebook 信息并将其发送到服务器。从服务器 facebook 共享应该发生我已经在 FB 中创建了我的应用程序,并且在单击同步按钮时我能够转到 FB 登录页面。登录后它要求进行身份验证
但它只是要求“基本信息”而不是公开分享等(我已将其包含在我的 FB 应用程序中)
-(IBAction)fbConnect:(id)sender{
flag = 1;
AppDelegate *appDelegate = [[UIApplication sharedApplication]delegate];
if (appDelegate.session.isOpen) {
[self updateView];
} else {
if (appDelegate.session.state != FBSessionStateCreated) {
appDelegate.session = [[FBSession alloc] init];
}
[appDelegate.session openWithCompletionHandler:^(FBSession *session,
FBSessionState status,
NSError *error) {
[self updateView];
}];
}
NSLog(@"string issss %@",string);
}
- (void)updateView {
AppDelegate *appDelegate = [[UIApplication sharedApplication]delegate];
if (appDelegate.session.isOpen) {
string = [NSString stringWithFormat:@"%@",
appDelegate.session.accessToken];
NSLog(@"string issss %@",string);
NSString *urlstrng;
if(flag == 1){
urlstrng = [NSString stringWithFormat:@"https://graph.facebook.com/me?access_token=%@",string];
[self dataFetching:urlstrng];
}
if(flag == 2){
urlstrng = [NSString stringWithFormat:@"https://graph.facebook.com/me/friends? access_token=%@",string];
[self dataFetching:urlstrng];
}
} else {
string = [NSString stringWithFormat:@"%@",
appDelegate.session.accessToken];
NSString *urlstrng;
if(flag == 1){
urlstrng = [NSString stringWithFormat:@"https://graph.facebook.com/me?access_token=%@",string];
[self dataFetching:urlstrng];
}
if(flag == 2){
urlstrng = [NSString stringWithFormat:@"https://graph.facebook.com/me/friends?access_token=%@",string];
[self dataFetching:urlstrng];
}
}
}
-(void)dataFetching:(NSString*)strng1{
NSURL *url = [NSURL URLWithString:strng1];
ProfileConnector *obj = [[ProfileConnector alloc] init];
obj.delegate1 = self;
[obj parsingJson:url];
}