1
在我的iPhone應用程序我訪問我的Facebook信息並將其發送到服務器。從服務器的Facebook共享應該發生 我已經在FB中創建了我的應用程序,同時點擊同步按鈕,我可以去FB登錄頁面。它在嵌入後請求身份驗證facebook分享從iPhone應用程序
但它只是要求「基本信息「不爲公衆共享等(我已經包含在我的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];
}
我在哪裏可以使用這個...? –
我在這裏得到一個錯誤 - [self sessionStateChanged:session state:state error:error]; –
在你的appdelegate。我相信你正在使用FacebookSDK。對? – Harikrishnan