首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >SLRequest给出分析错误:预期]

SLRequest给出分析错误:预期]
EN

Stack Overflow用户
提问于 2013-01-11 18:36:28
回答 1查看 420关注 0票数 1

我正在为iOS6编写一个Facebook解析器。昨天,我只用解析器做了一个测试项目。这样做效果很好。当我想在更大的项目中实现解析器(使用完全相同的方法代码)时,会给出一个"Parse Error: Expected ]“。设置了Social和Accounts的导入。这是给出错误的那一行:

代码语言:javascript
复制
SLRequest *retrieveWall = [SLRequest requestForServiceType:SLServiceTypeFacebook requestMethod:SLRequestMethodGET URL:newsFeed parameters:nil];

下面是完整的方法:

代码语言:javascript
复制
-(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");
         }
     }];

}

该错误特别指向方法调用中的"URL“。

这个愚蠢的错误已经让我抓狂了3个小时。我重新启动了XCode,清理了项目,并重新启动了我的Mac。谁看到了这个错误?

编辑:似乎这个特定的代码不是问题所在。我还添加了核心数据,它有一些方法名中带有URL的函数。方法名中包含URL的每个函数现在都会给出一个解析错误,并指向"URL“。越来越接近问题,但仍然不在那里!

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2013-01-14 15:55:28

我们在头文件中的某个地方定义了URL。移除它可以修复它。感谢您考虑解决方案!

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/14276293

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档