Reputation: 11
I'm having a problem with this the first line of code, it says that there is an "expected identifier '('" Not sure if it has something to do with UIApplication. I've already declared UIApplication as a class. Someone please help me with this
@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
}
}];
}
Upvotes: 1
Views: 882
Reputation: 15015
You need to put "}]" at the end like this.
[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.
}
}];
Upvotes: 1