NSInvalidArgumentException in iOS 7.1

Hi,

I was developing an application for an assigment of the university and I encountered an NSInvalidArgumentException error when calling the Backendless API. After looking into it I realised that while it did not work on my physical device (iOS 7.1.3), it did work on the emulator (iOS 9.2). I double-checked the project was correctly configured following the quick start guide, but I could not find any error…

This is the error I receive: ‘NSInvalidArgumentException’, reason: '-[__NSCFConstantString containsString:]: unrecognized selector sent to instance

And this is the code the error happens in:
let username = “username”

   let password = password

    // The instance is correctly retrieved by the app


    let backendless = Backendless.sharedInstance()

    // This is the line the error happens. It does not get into the response or error sections, the console shows the exception and the application crashes


    backendless.userService.login(username, password: password, response: { (logedInUser) -> Void in

             print("You're in") },

        error: { (error) -> Void in

            print("Try again, please")

        })

Is there any known issue with old versions of iOS and the current Backendless iOS SDK? If so, I would prefer developing my app with the physical device, which SDK version should I use so that it supports my OS version (7.1.3)?

Thanks a lot for your help, :wink:

Manex

Please try your app on devices with iOS 8 >

Hi Vyacheslav,
First of all, thanks for your answer.

The iOS device I am using is rather old so I don’t think it could handle an upgrade… Is there any other alternative? An older version of the SDK perhaps? It’s for an assignment in the university so I don’t mind if the SDK does not have all the features that are currently available…
Manex

Hi Manex,

Please download this sample, load the project using TestFDMeal.xcworkspace and try to run it “as is” on your device. Let me know how it goes.

Regards,
Slava

Hi Slava,

I’ve tried it (first I had to change the deployment target to 7.1 so that I could execute it in my device) and the app crashes before printing the output about the meals, portions etc. The error I receive is the same I got with my code:
‘NSInvalidArgumentException’, reason: '-[__NSCFConstantString containsString:]: unrecognized selector sent to instance

Manex

So, you need iOS 8> device to use latest Backendless SDK (built with Xcode 7). It is a fact.

Ok Slava, thanks for your help, I’ll start using the simulator…

The containsString: method was only added in iOS 8.

This issue is fixed, please change fixed CommLibiOS.a in your project and try again with your iOS 7.1 device. Let we know how it goes.

Hi Slava,

I’ve tried it and it works now! Thank you very much for your help, :wink:
Manex

Dear Slava,

i have the same problem as described above again with an iOS-7-Device and the most current SDK. Can you make it compatible with iOS 7 again?

Best regards,

Bodo

iOS7 is rather old, here’s an article from a year ago, that shows that ios7 has only 25% of the devices use ios7:

I believe it would not worth the effort…

Dear Mark,

i checked my App-statics. There are just 8% iOS7-User that installed my app in december, so you are right. But it would be fine to support them to as Parse did with the latest SDK.
Is there an older release of the SDK available with official iOS7-Support?

Best Regards,

Bodo

If you go with an older SDK, it would not support the latest iOS, then you’re facing a new problem - how to support the majority of users downloading your app, right?