I have encountered a very strange and frustrating issue when building WatchKit and Today extensions using Xcode 7 (GM) as well as Xcode 7.1 (beta 1). Using AFNetworking 2.0 (up to date as of this posting), I call the following code from any of these extensions:
AFHTTPRequestOperation *op = [manager GET:endpoint parameters:parameters success:^(AFHTTPRequestOperation *operation, id responseObject) {
NSLog(@"Response: %@", responseObject);
} failure:^(AFHTTPRequestOperation *operation, NSError *error) {
NSLog(@"ERROR: %@", error);
}];
NSLog(@"Called!");
The expectation here would be that one of the two blocks would be called after Called!
is logged. However, neither one is ever executed.
Strangely, however, if I call the following line:
[op cancel];
I get the expected failure
block's log outputted. Nothing else I've tried (turning off Internet connectivity on my computer, creating a nonsense URL, etc.) has been able to get the failure
block to execute.
At this point I'm not sure if I've been trying to debug this too late into the night, if this is a bug with Xcode 7.x, or if I'm making a mistake somewhere. Any help is appreciated!