2013-01-11 92 views
1

我正在爲iOS6編寫Facebook解析器。昨天,我只用解析器做了一個測試項目。這工作得很好。當我想在我更大的項目中實現解析器(使用完全相同的方法代碼)時,會給出「解析錯誤:期望的」。社交和帳戶的導入設置。 這是給出了錯誤行:SLRequest給出解析錯誤:預計]

SLRequest *retrieveWall = [SLRequest requestForServiceType:SLServiceTypeFacebook requestMethod:SLRequestMethodGET URL:newsFeed parameters:nil]; 

這是完整的方法:

-(void)fetchFacebookFrom:(NSString*)userID withAppKey:(NSString*)appKey 
{ 
    ACAccountStore *accountStore = [[ACAccountStore alloc] init]; 
    ACAccountType *accountType = [accountStore 
            accountTypeWithAccountTypeIdentifier:ACAccountTypeIdentifierFacebook]; 

    NSDictionary *options = @{ 
    @"ACFacebookAppIdKey" : appKey, 
    @"ACFacebookPermissionsKey" : @[@"email"], 
    @"ACFacebookAudienceKey" : ACFacebookAudienceEveryone 
    }; 

    [accountStore requestAccessToAccountsWithType:accountType 
              options:options completion:^(BOOL granted, NSError *error) { 
     if(granted) 
     { 
      NSArray *arrayOfAccounts = [accountStore 
             accountsWithAccountType:accountType]; 

      if ([arrayOfAccounts count] > 0) 
      { 
       ACAccount *facebookAccount = [arrayOfAccounts lastObject]; 

       NSURL *newsFeed = [NSURL URLWithString:@"https://graph.facebook.com/12345678901/feed"]; 

       SLRequest *retrieveWall = [SLRequest requestForServiceType:SLServiceTypeFacebook requestMethod:SLRequestMethodGET URL:newsFeed parameters:nil]; 

       retrieveWall.account = facebookAccount; 

       [retrieveWall performRequestWithHandler:^(NSData *responseData, NSHTTPURLResponse *urlResponse, NSError *error) 
        { 
         if (error) 
         { 
          NSLog(@"Error: %@", [error localizedDescription]); 
         } 
         else 
         { 
          // The output of the request is placed in the log. 
          NSDictionary *jsonResponse = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingAllowFragments error:nil]; 

          NSArray *statuses = [jsonResponse objectForKey:@"data"]; 
         } 
        }]; 

      } 
     } 
     else 
     { 
      NSLog(@"Not granted"); 
     } 
    }]; 

} 

錯誤specificly指向 「URL」 的方法調用..

這愚蠢的錯誤已經讓我瘋狂了3個小時了。我重新啓動了XCode,清理了項目並重新啓動了我的Mac。誰看到錯誤?

編輯:似乎這個特定的代碼不是問題。我也添加了核心數據,這些數據在方法名中包含一些URL。 現在,方法名中帶有URL的每個函數都會給出一個Parse Error並指向「URL」。更接近問題,但仍然不存在!

+0

我使用Xcode DP beta 4,SDK 6.1爲我的Facebook用戶成功執行了您的代碼。沒有錯誤。 – Jano

+1

它必須是框架導入的東西然後..這就是爲什麼開發iOS應用程序令我煩惱的原因:/ – harmjanr

回答

0

我們在頭文件中的某個地方定義了URL。刪除這個固定它。感謝您考慮解決方案!

相關問題