I am using NSURLConnection for accessing webservices.
I am getting proper response in iOS 4.3 but If I run the same code in iOS5 I am getting NULL response.
What are the changes do I need to make to the existing NSURLConnection delegates to work successfully.
I have implemented NSURLConnectionDataDelegate & NSURLConnectionDelegate. Even then its not working.
Thanks in advance.
You have some changes with NSURLConnection class in iOS 5 (some delegate methods are now deprecated).
You can find a good post about it here : NSUrlConnection Class Changes
Related
I have an app working just fine on iOS 9 with a Custom NSURLProtocol implemented with NSURLSession. All the requests executed by the client are done with NSURLSession as well and each sessionConfiguration is registering to the protocol before executing the request.
I have an issue with iOS 8 that I don't have with iOS 9. With iOS8 the Custom NSURLProtocol is performing that request non stop, basically an infinite loop of the same request. canInitWithRequest: in the custom protocol gets called way more on iOS 8 than on iOS 9 which basically drives the method startLoading to get called and fire the request after some header modifications that my protocol is supposed to perform.
Is there a known issue with iOS8 where NSURLProtocols and NSURLSession don't behave as expected?
I'm not aware of any problems like that, no.
This sounds like your protocol is either:
Failing to detect its own header modifications for some reason
Failing to make the modifications for some reason
Failing to return NO when your protocol is asked if it should handle a request that already contains the modified headers
Be sure that you are using a header field for the purpose of detecting whether to handle the request. There's no guarantee that the specific NSURLRequest object that you pass down into the machinery will come back to you. I'm not even sure I would trust propertyForKey:inRequest:, but that might make me too paranoid.
Critically, don't ever subclass NSURLRequest when working with NSURLSession. In iOS 9, it almost works. The farther back you get, the more broken the behavior, until by iOS 7 you're pretty much relegated to using NSURLConnection. :-)
I use AFAmazonS3 (which is an extention of AFNetworking)
It has AFHTTPRequestOperation that is created and added to the operation queue
[self.operationQueue addOperation:requestOperation];
The thing is that when the app goes to background it stops uploading and doesn't resume when it goes back.
How can I acheive it?
I saw some solutions but it was for the old version of AFNetworking
AFNetworking supports Background operations.This post is mentioning setShouldExecuteAsBackgroundTaskWithExpirationHandler: and explaining how to use it https://stackoverflow.com/a/7881866/3033056 .
This method is in AFURLConnectionOperation and AFHTTPRequestOperation inherits from AFURLConnectionOperation
I am working on an iOS app that is communicating with a Worklight server thanks to the iOS SDK provided by Worklight.
I would like to integrate the AppConnect SDK (MDM) to the project in order to do some tunneling on communications.
For this, I have to overload an NSURLConnectionDelegate method to add some AppConnect-related certificate configuration to an HTTP request :
- (void) connection: (NSURLConnection *)connection willSendRequestForAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge;
The problem is that NSURLConnections and NSURLRequests are encapsulated by the Worklight iOS library : the method that I use to make calls is
[[WLClient sharedInstance] invokeProcedure:myInvocation withDelegate:self options:serviceOptions];
So I can't see the NSURLConnections and NSURLRequests, and I can't overload the NSURLConnectionDelegate method...
That's why I would like to know : is it possible to overload the HTTP behavior of the Worklight iOS library in this way ? And if it is possible, how can I do it ?
If you need to add header, you can use the options in invokeProcedure.
In case you need more complicated things, I would suggest using NSURLProtocol -> https://developer.apple.com/library/ios/documentation/Cocoa/Reference/Foundation/Classes/NSURLProtocol_Class/index.html
I am using HomeKit apis in my iOS application.
I am facing very weird issue whenever I do Add/Delete Home/Room/Acccessory/ActionSet
No callback method is getting called of HMHomeDelegate protocol.
Except the homeManagerDidUpdateHomes method no other callback method is getting called of HMHomeManagerDelegate protocol.
And I have set delegate properly.
I have gone through a stack over link having the same issue.
here it is
Please suggest if anybody faced the similar problem.
Caveat: I know that private frameworks won't fly in the App Store.
I'm trying to use the BluetoothManager framework to let me 1) check if Bluetooth is enabled on a device, and 2) if not on, turn it on.
I can successfully load BluetoothManager per the instructions found here, but once I've done so, BluetoothManager just doesn't seem to do anything.
Calling enabled always returns NO, even when Bluetooth is enabled. Calling setEnabled never changes its state. Absolutely every other BluetoothManager call I've tried always returns NO, nil, zero-element arrays, etc. In short, the BluetoothManager that gets returned seems totally neutered. (I'm running off my 4.2.1 iPhone, not the simulator.)
I've seen posts from people who claim to have gotten this working, yet I haven't been able to get a response from them. Can anyone shed light on why this might not be working?
Thanks very much.
It takes a second for the BluetoothManager to startup and attach to the BTServer. I just did a quick call to the shared instance - [BluetoothManager sharedInstance]; - to force it to init. Once it's finished init it will post a BluetoothAvailabilityChangedNotification. I'd just listen for that and try [[BluetoothManager sharedInstance] setEnabled:YES]; in the notification callback.
FYI, the object included in the NSNotification for BluetoothAvailabilityChangedNotification is a boolean, so you should be able to check that to make sure that Bluetooth is really available.
That's because of IPC. BluetoothManager communicates via sendMsg et el. Use for example NSTimer to query BluetoothManager sharedInstance so your program has time to receive and process messages.
There is a demo project on Github called BeeTee for demonstrating the private framework BluetoothManager.