I am working on an application using client-server communication. Everything worked fine until iOS 7.1. Now that the Xcode 6 GM Seed is running, I tried to create and run a project on the iOS8 simulator. However, all NSURLConnections do not seem to be working right now. I can not get a response from the server. This works on the iOS 7 and Xcode 6 simulator.
I tried using NSURLSession, hoping this solves the problem. But it does not have. Any help would be greatly appreciated! If anyone else has encountered this problem, let me know if you have a workaround.
UPDATE :
This is the code I used:
NSString *authStr = [NSString stringWithFormat:@"%@:%@", username, password]; NSData *authData = [authStr dataUsingEncoding:NSUTF8StringEncoding]; NSString *authValue = [NSString stringWithFormat: @"Basic %@",[authData base64EncodedStringWithOptions:0]]; [inURLRequest setValue:authValue forHTTPHeaderField:@"Authorization"];
Please note that inURLRequest is already italized with the desired URL.
After that, just use inURLRequest to start the transaction, as usual. For example, in the case of NSURLSession, create a download task using this request object and call the resume API on it.
source share