4

I have a phonegap project on android. This woeks well but when I compile on the phonegap website I have some problems on the ios version.

So I try using xcode using the xcode simulator but I have the folloing error:

2013-04-03 21:29:27.261 Assas[2339:c07] Multi-tasking -> Device: YES, App: YES
2013-04-03 21:29:28.455 Assas[2339:c07] [LOG] true
2013-04-03 21:29:28.940 Assas[2339:c07] -[__NSCFArray    dataUsingEncoding:allowLossyConversion:]: unrecognized selector sent to instance 0x8939150
2013-04-03 21:29:28.942 Assas[2339:c07] *** Terminating app due to uncaught exception     'NSInvalidArgumentException', reason: '-[__NSCFArray dataUsingEncoding:allowLossyConversion:]:     unrecognized selector sent to instance 0x8939150'
*** First throw call stack:
(0x14c012 0x25a2e7e 0x1d74bd 0x13bbbc 0x13b94e 0x163b0 0x16243 0x5bbdb 0x5b32c 0x5aedd     0x5b075 0x5af93 0x25b66b0 0x1125765 0xcff3f 0xcf96f 0xf2734 0xf1f44 0xf1e1b 0x33d37e3     0x33d3668 0x387ffc 0x214c 0x20a5)
libc++abi.dylib: terminate called throwing an exception

I take the content of my www folder in my android project, I just change the config.xml and the cordova jsfile

I'm using phonegap 2.4.0 on both projects

edit:

the error is in Others Sources/main.m

#import <UIKit/UIKit.h>

int main(int argc, char* argv[])
{
    @autoreleasepool {
        int retVal = UIApplicationMain(argc, argv, nil, @"AppDelegate");
        return retVal;
    }
}

on line 6

Thanks

4

3 回答 3

0

您的应用程序正在使用自动引用计数(这是新的),Phonegap 还不支持它。解决方案如下:

1. 转到项目的构建设置并关闭自动引用计数。构建设置-用户定义-CLANG_ENABLE_OBJC_ARC-从YES更改为NO

2.危险/坏但解决错误:删除@autoreleasepool,代码似乎是 int main(int argc, char* argv[]) { int retVal = UIApplicationMain(argc, argv, nil, @"AppDelegate"); return retVal; }

于 2013-04-03T23:49:56.710 回答
0

对于 Android 和 ios,cordova javascript 是不同的。因此,当您复制 www 时,请确保将 android 的 cordova.js 替换为 ios 的 cordova.js。

于 2013-04-03T20:37:08.957 回答
0

对我来说,我在插件的 javascript 文件中重新排列了插件参数的顺序,但我没有在 iOS 代码中反映这些更改。我在我的插件参数中发送字符串、长整数和整数的混合:

// Old javascript
cordova.exec(success, fail, "MyPlugin", "PluginMethod", [0, 758493037474, "String"]);

// New javascript
cordova.exec(success, fail, "MyPlugin", "PluginMethod", ["String", 0, 758493037474]);

确保也更新您的后端代码(不,对吧!!!)

// Old objective C
int myid              = [command.arguments objectAtIndex:0];
double mydouble       = [[command.arguments objectAtIndex:1] doubleValue];
NSString *mystring    = [command.arguments objectAtIndex:2];

// New objective C
NSString *mystring    = [command.arguments objectAtIndex:0];
int myid              = [command.arguments objectAtIndex:1];
double mydouble       = [[command.arguments objectAtIndex:2] doubleValue];
于 2013-12-05T21:51:49.340 回答