Ожидаемый идентификатор '(' в Xcode

У меня проблема с первой строкой кода, она говорит, что есть "ожидаемый идентификатор" ("Не уверен, что это как-то связано с UIApplication. Я уже объявил UIApplication как класс. помоги мне с этим

    @interface UIResponder : NSObject

    @end


    Class UIApplication; UIResponder




    // Error in the line below
    - (void)applicationDidBecomeActive:(UIApplication *) application  {

NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"http://foobar.com/news.plist"]];
request.cachePolicy = NSURLRequestReloadIgnoringLocalAndRemoteCacheData;
request.timeoutInterval = 5.0;

[NSURLConnection sendAsynchronousRequest:request
                                   queue:[NSOperationQueue mainQueue]
                       completionHandler:
 ^(NSURLResponse *response, NSData *data, NSError *error)
 {
     if (data)
     {
         NSPropertyListFormat format;

         self.dictionary = [NSPropertyListSerialization propertyListWithData:data options:NSPropertyListImmutable format:&format error:nil];

         // Todo: post an NSNotification to any other view controllers telling them that we have the new data.

     }
     else
     {
         // Tell user connection failed
     }
 }];

}

1 ответ

Вы должны поставить "}]" в конце, как это.

[NSURLConnection sendAsynchronousRequest:request
                                   queue:[NSOperationQueue mainQueue]
                       completionHandler:
 ^(NSURLResponse *response, NSData *data, NSError *error)
 {
     if (data)
     {
         NSPropertyListFormat format;

         self.dictionary = [NSPropertyListSerialization propertyListWithData:data options:NSPropertyListImmutable format:&format error:nil];

         // Todo: post an NSNotification to any other view controllers telling them that we have the new data.

     }
}];
Другие вопросы по тегам