Different NSError localizedDescription between iOS 7 and 8 - ios

I was testing how my app displays erros when not connected to the internet and I noticed that iOS 7 and 8 return different error messages for NSURLErrorNotConnectedToInternet (-1009)
iOS 7 Error
Error Domain=NSURLErrorDomain
Code=-1009 "The Internet connection appears to be offline."
UserInfo=0x17d5edc0 {NSLocalizedDescription=The Internet connection appears to be offline.,
NSUnderlyingError=0x17ecdd20 "The Internet connection appears to be offline."}
iOS 8 error
Error Domain=NSURLErrorDomain
Code=-1009 "The operation couldn’t be completed. (NSURLErrorDomain error -1009.)"
UserInfo=0x1740f9c80 {_kCFStreamErrorDomainKey=12,
_kCFStreamErrorCodeKey=8,
NSUnderlyingError=0x17405dd90 "The operation couldn’t be completed. (kCFErrorDomainCFNetwork error -1009.)"}
Is there any way to have iOS generate an error message that would be the same on both iOS 7 and 8?

Use the code, it's the same.
If they choosed to update the error message in iOS8, you can't do anything.

Maybe the intent is that this is an error where you shouldn't just show an error message with the technical reason, but where you should think what it means in terms of the user. The Internet connection could be down because WiFi is turned off, or 3G data is turned off, so you could ask to turn it on depending on how important the data is. If you are doing some background update, you might just do nothing. Or you might suggest to the user to do the operation later if that makes sense.

You can use the error code mapping from http://nshipster.com/nserror/

Related

iOS app crashing when trying to create email

I am getting the following dialog pop up whenever I try and create an email from within my app:
I have tried deploying to 7, 7.1 & 8 and it crashed on each version.
Here is the error log:
2015-06-20 12:53:09.434 CDM App[1045:29809] Result: canceled
2015-06-20 12:53:09.446 CDM App[1045:29780] viewServiceDidTerminateWithError: Error Domain=_UIViewServiceInterfaceErrorDomain Code=3 "The operation couldn’t be completed. (_UIViewServiceInterfaceErrorDomain error 3.)" UserInfo=0x7ae62340 {Message=Service Connection Interrupted}
any help greatly appreciated!
Many Thanks,
Possibly duplication of this.
There is issue with composing mail on simulators, it will not effect on real device
You should also visit here.

ios 8 custom keyboard UIViewServiceInterfaceErrorDomain?

I'm pulling my hair for this error that i got when i tried to make a custom keyboard ,
MobileSafari[1234:36764] viewServiceDidTerminateWithError::
Error Domain=_UIViewServiceInterfaceErrorDomain Code=3
"The operation couldn’t be completed. (_UIViewServiceInterfaceErrorDomain
error 3.)" UserInfo=0x7f971da0f6a0 {Message=Service Connection Interrupted}
Can anyone knows what does this error means?!
If you're using the Simulator, it could entirely be the Simulator's fault.
Check out: I have REAL misunderstanding with MFMailComposeViewController in Swift (iOS8) in Simulator
For a workaround.

XCtest based testcase causing NSStream callback not to fire

I have a simple app that opens a NSStream connection to a server on pressing a button, this works fine as a normal IOS app with a connected Iphone device.
When I use XCTest for a unit test I don't get any data transfer over the NSStream connection.
I see the following at the beginning of my App under XCTest framework
2014-07-25 09:35:51.013 GolgiBird[33407:60b] Unable to get entitlements for client task. Error: Error Domain=NSPOSIXErrorDomain Code=-1 "The operation couldn’t be completed. (POSIX error -1 - Unknown error: -1)"
2014-07-25 09:35:51.020 GolgiBird[33407:60b] Unable to get entitlements for client task. Error: Error Domain=NSPOSIXErrorDomain Code=-1 "The operation couldn’t be completed. (POSIX error -1 - Unknown error: -1)"
I am using XCode 5.1, IOS 7.1, IPHone 5S
Anyone have an idea what might be going on here, The above errors might not be the cause of the NSStream problem but rather something in the XCTest framework itself
So basically the callback
(void)stream:(NSStream *)stream handleEvent:(NSStreamEvent)streamEvent
{
...
}
is not been called under the XCTest framework

Voip app IOS getting error Error Domain=NSPOSIXErrorDomain Code=61 "The operation couldn’t be completed. Connection refused

I'm trying to create a Voip application as this tutorial
http://www.raywenderlich.com/29948/backgrounding-for-ios
But when running its getting the error
Error Domain=NSPOSIXErrorDomain Code=61 "The operation couldn’t be completed. Connection refused
When I run the source from tutorial gets same error
I think its the problem with the port assigned.
How can I solve this problem.
What value to give for port?
If you read his tutorial he mentions this. I'm sure it's your issue.
Before you run the app, you need a server with which to test it. You
can use a handy little utility every Mac already has called netcat
that, among other things, allows you to easily create simple
text-based servers.

iAd refusing to display

iAd framework is doing my nut. AGAIN!
Please someone help me towards sanity.
Yesterday was working on the simulator, today it isn't. After an hour of raging at it I actually plug in my brain and log the error (iirc this is on the simulator)
Error Domain=ADErrorDomain
Code=3 "The operation couldn’t be completed. Ad inventory unavailable"
UserInfo=0x5a5bb50
{
ADInternalErrorCode=3,
NSLocalizedFailureReason=Ad inventory unavailable
}
then I try a reboot.
on the simulator:
Error Domain=ADErrorDomain
Code=4 "The operation couldn’t be completed. Application has iAd Network configuration error"
UserInfo=0x5839510
{
ADInternalErrorCode=4,
NSLocalizedFailureReason=Application has iAd Network configuration error
}
now try on the device:
Err Domain=ADErrorDomain
Code=1 "The operation couldn’t be completed. (ADErrorDomain error 1.)"
UserInfo=0x19c8c0 {}
finally I find something on Google:
http://useyourloaf.com/blog/2010/11/28/ad-inventory-unavailable-with-ios-42.html
This guy is saying it seems to be an issue with >= iOS 4.2.
So I try again using iOS 4.0 iPhone simulator
Yay, I get yet another error code.
Error Domain=ADErrorDomain Code=0 "Invalid data."
On your device, go to the Settings app. Tap Developer. Under iAd Developer App Testing, tap Fill Rate. Select the error rate you want to test.

Resources