Skip to content
This repository has been archived by the owner on Oct 1, 2018. It is now read-only.

Calling chcp.configure() throws error in iOS #77

Closed
TrevorMills opened this issue Dec 30, 2015 · 2 comments
Closed

Calling chcp.configure() throws error in iOS #77

TrevorMills opened this issue Dec 30, 2015 · 2 comments
Labels
Milestone

Comments

@TrevorMills
Copy link

Hi there,

I'm trying to do this:

function myDeviceReady() {
    var options = {
        'auto-download': false,
        'auto-install': false,
        'config-file': 'http://asdf.ngrok.com/chcp.json' // will eventually be a manufactured server URL
    } 
    chcp.configure( options );
}    

When I run the app in iOS simulator, I get the following in the Xcode console:

2015-12-30 15:57:22.531 Simple[3326:41957] -[__NSDictionaryM dataUsingEncoding:]: unrecognized selector sent to instance 0x7ff5a3cba5d0
2015-12-30 15:57:22.533 Simple[3326:41957] *** WebKit discarded an uncaught exception in the webView:decidePolicyForNavigationAction:request:frame:decisionListener: delegate: <NSInvalidArgumentException> -[__NSDictionaryM dataUsingEncoding:]: unrecognized selector sent to instance 0x7ff5a3cba5d0

It's as if the chcp.configure() function was expecting a string. I was able to get it working by using:

chcp.configure( JSON.stringify( options ) );

But, that seems wrong. I'm using the latest version of your plugin from npm - 1.1.2. In this phase of my development I am NOT using the dev add-on.

I'm building a Sencha Touch app, if that makes a difference, so the above code is not actually run on 'deviceready'. Rather, it's in a controller that gets initiated after 'deviceready' ( putting the code in a 'deviceready' listener doesn't make a difference ). It could be an issue with Sencha Touch, but I struggle to see how.

In Android, if I pass in the stringified version, then CHCP plugin does not work ( it doesn't have a config-file to load ).

Any thoughts?

@TrevorMills TrevorMills changed the title Calling chcp.configuration() throws error in iOS Calling chcp.configure() throws error in iOS Dec 30, 2015
@nikDemyankov
Copy link
Member

Hi,

Yes, that is a bug in v1.1.2. iOS expects it to be a string, but Android - an object. This is fixed in v1.2.0, that I'm currently working on. There is a development branch, so you can check it out, if you wish. Or just wait until the release. I'm planning to do this in the beginning of the January: need to do some testing and update the docs.

@nikDemyankov nikDemyankov added this to the v1.2 milestone Dec 30, 2015
@nikDemyankov
Copy link
Member

Should be fixed in v1.2.0. If not - reopen the issue.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants