2013-01-09 69 views
0

我使用這些教程http://www.raywenderlich.com/1488/how-to-use-facebooks-new-graph-api-from-your-iphone-app 實現Facebook的圖形API在iPhone,但是當我拍了拍Facebook登錄BUTTOM得到錯誤的NSLog的文件中像這樣Facebook的圖形API教程得到錯誤

2013-01-09 18:50:54.509 FBFun[3279:11303] *** WebKit discarded an uncaught exception in the webView:decidePolicyForNavigationAction:request:frame:decisionListener: delegate: <NSInvalidArgumentException> Application tried to present modally an active controller <ViewController: 0x75446a0>. 

我嘗試去解決問題張貼此鏈接
New error in iOS 5: WebKit discarded an uncaught exception 的答案是這樣的鏈接

-(void)checkLoginRequired:(NSString *)urlString { 
    NSLog(@"Url: %@",urlString); 
    if ([urlString rangeOfString:@"login.php"].location != NSNotFound && [urlString rangeOfString:@"refid"].location == NSNotFound) { 
      [_delegate displayRequired]; 
    } else if ([urlString rangeOfString:@"user_denied"].location != NSNotFound) { 
     [_delegate closeTapped]; 
    } 
} 

的答案,但我沒有succeddedķ indly人有答案關於這篇文章,請與我分享

回答

1

離開該教程:

使用這一個,方便你在步驟:

下載Facebook新從這裏SDK,你不需要進行單獨的電話就像你在前面的射線的教程做:

教程爲初學者使用和
https://developers.facebook.com/ios/ 

最簡單的訪問圖形API/FQL等從Facebook的SDK:

https://developers.facebook.com/docs/tutorials/ios-sdk-tutorial/ 

希望它有幫助。

0

嘿那裏,我得到了同樣的問題,在代碼中使用 RayWenderLich tutorial 到impement圖形API,但研究和一些代碼調試小時後解決了這個問題。

爲了我的方便,我修改了代碼。

  • (BOOL)web視圖:(的UIWebView *)webView的shouldStartLoadWithRequest:(的NSURLRequest *)請求navigationType:(UIWebViewNavigationType)navigationType {

    的NSString * urlString = request.URL.absoluteString;

    [self checkForAccessToken:urlString];

    如果(self.isViewLoaded & & self.view.window){

    // viewController is visible 
    
        return TRUE; 
    

    }

    [自checkLoginRequired:urlString];

    return TRUE;

}

- (無效)checkLoginRequired:(的NSString *)urlString {

NSLog(@"Url: %@",urlString); 

    if ([urlString rangeOfString:@"login.php"].location != NSNotFound && [urlString rangeOfString:@"refid"].location == NSNotFound) { 
     NSLog(@"Login Required"); 
     [_delegate displayRequired]; 

    } else if ([urlString rangeOfString:@"login_success"].location != NSNotFound) { 
     NSLog(@"login_success"); 

     //any thing you want to do after log in success. 
    }