开发者

Weird bug with phonegap ios

开发者 https://www.devze.com 2023-04-12 02:46 出处:网络
I am writing a iphone application using phonegap and ios. I have a weird problem. I have a NSString which holds a 开发者_Python百科json string in my objective c plugin class. And then I call the callb

I am writing a iphone application using phonegap and ios. I have a weird problem. I have a NSString which holds a 开发者_Python百科json string in my objective c plugin class. And then I call the callback function provided by running Phonegap.exec, however the callback neither the success or failure gets called. Here is some code:

PluginResult* pluginResult = [PluginResult resultWithStatus: PGCommandStatus_OK messageAsString: jsonString ];
        [self writeJavascript:[pluginResult toSuccessCallbackString:self.callbackID]];

my success callback simply alerts the argument passed. The weird thing is that, if I pass in a non jsonString for example replacing jsonString with just some regular message, say @"Hello-word" then it works, and the success callback gets called and the argument gets alerted. Anyone have any idea what going on?


The problem was that I had a literal quote in my jsonString, but my jsonString was hardcoded. Instead of doing this, I just used a messageAsDictionary with the appropriate mapped values, and I could still interpret the data recieved my javascript as json object.

0

精彩评论

暂无评论...
验证码 换一张
取 消