DISABLE ADBLOCK

ADBlock is blocking some content on the site

ADBlock errore

SLRequest gives Parse Error: Expected ]

StackOverflow https://stackoverflow.com/questions/14276293

Question

I'm writing a Facebook Parser for iOS6. Yesterday, I made a test project with only the parser. This worked fine. When I want to implement the parser in my bigger project (with exactly the same method code), a "Parse Error: Expected ]" is given. The imports for Social and Accounts are set. This is the line that gives the error:

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

This is the full method:

-(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");
         }
     }];

}

The error specificly points to "URL" in the method call..

This stupid error is driving me crazy for 3 hours already. I restarted XCode, cleaned the project and rebooted my Mac. Who sees the error?

EDIT: It seems that this particular code is not the problem. I added core data too, which has some functions with URL in method names. Every function with URL in the method name now gives a Parse Error and points to "URL". Getting closer to the problem, but still not there!

Solution

We defined URL somewhere in a header file. Removing this fixed it. Thanks for thinking about a solution!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow