I’m trying really hard not to look at other solutions until I can know what is wrong with my own. I checked out the documentation for method and added (what I think) is the right code. I didn’t use an anonymous block; I used the typedef format. The program builds and compiles; the only warning I get is about an unused identifier for my block. Any insight would be appreciated.
[code]#import <Foundation/Foundation.h>
#import “BNRLogger.h”
typedef void (^NotificationBlock) (NSNotification *);
int main(int argc, const char * argv[])
{
@autoreleasepool
{
BNRLogger *logger = [[BNRLogger alloc]init];
NotificationBlock notifier;
[[NSNotificationCenter defaultCenter] addObserverForName:NSCurrentLocaleDidChangeNotification object:nil queue:nil usingBlock:^(NSNotification *notifier)
{
NSLog(@"The system time zone has changed!");
}];
NSURL *url = [NSURL URLWithString:@"http://www.guttenberg.org/cache/epub/205/pg205.txt"];
NSURLRequest *request = [NSURLRequest requestWithURL:url];
__unused NSURLConnection *fetchConn = [[NSURLConnection alloc]initWithRequest:request
delegate:logger
startImmediately:YES];
__unused NSTimer *timer = [NSTimer scheduledTimerWithTimeInterval:2.0
target:logger
selector: @selector(updateLastTime:)
userInfo:nil
repeats: YES];
[[NSRunLoop currentRunLoop] run];
}
return 0;
}[/code]
btw, if anyone would find it convenient to chat online about these code challenges, you can reach me via Google Hangouts at jdlace@gmail.com.