iOS 的 Cordova 应用,带插件
Cordova app for iOS with Plugins
我正在尝试为 iOS 创建一个 cordova 应用程序。我们也为 android 使用了相同的应用程序。我只是尝试添加 iOS 插件并启动应用程序。我在 CDVDevice.h
.
中添加了以下代码
http://developmobilesoftware.blogspot.in/2013/12/the-unique-identifier-in-ios-app-udid.html
我遇到异常,我的跟踪如下:
+[CDVDevice uniqueIDForDevice] : unrecognized selector sent to class 0xf30c4
** WebKit discarded an uncaught exception in the webView: decidePolicyForNavigationAction:request:frame:decisionListener:delegate"<NSInvalidArgumentException> +[CDVDevice uniqueIDForDevice]: unrecognized selector sent to class 0xf30c4
请帮助我 iOS 编程新手。
谢谢!
首先,编辑 CDVDevice 不是一个好主意
但是您可以做两种不同的事情来修复您的代码:
改变[devProps setObject:[[self class] uniqueIDForDevice] forKey:@"uniqueid"];
到[devProps setObject:[self uniqueIDForDevice] forKey:@"uniqueid"];
或更改-(NSString*)uniqueIDForDevice
到+(NSString*)uniqueIDForDevice
说明,class 方法以 +
开头,实例方法以 -
开头,您已经声明了一个实例方法,但您像调用 class 方法一样调用它,因此您可以将 class 方法更改为实例方法,将 -
更改为 +
或将其保留为实例方法并仅使用 self
而不是 [self class]
无论如何,正如我之前所说,您可以使用我的标识符作为供应商插件,而不是编辑设备插件
https://github.com/jcesarmobile/IDFVPlugin
window.IDFVPlugin.getIdentifier(function(identifier){ alert(identifier); },function(error){ alert(error); });
我正在尝试为 iOS 创建一个 cordova 应用程序。我们也为 android 使用了相同的应用程序。我只是尝试添加 iOS 插件并启动应用程序。我在 CDVDevice.h
.
http://developmobilesoftware.blogspot.in/2013/12/the-unique-identifier-in-ios-app-udid.html
我遇到异常,我的跟踪如下:
+[CDVDevice uniqueIDForDevice] : unrecognized selector sent to class 0xf30c4
** WebKit discarded an uncaught exception in the webView: decidePolicyForNavigationAction:request:frame:decisionListener:delegate"<NSInvalidArgumentException> +[CDVDevice uniqueIDForDevice]: unrecognized selector sent to class 0xf30c4
请帮助我 iOS 编程新手。
谢谢!
首先,编辑 CDVDevice 不是一个好主意
但是您可以做两种不同的事情来修复您的代码:
改变[devProps setObject:[[self class] uniqueIDForDevice] forKey:@"uniqueid"];
到[devProps setObject:[self uniqueIDForDevice] forKey:@"uniqueid"];
或更改-(NSString*)uniqueIDForDevice
到+(NSString*)uniqueIDForDevice
说明,class 方法以 +
开头,实例方法以 -
开头,您已经声明了一个实例方法,但您像调用 class 方法一样调用它,因此您可以将 class 方法更改为实例方法,将 -
更改为 +
或将其保留为实例方法并仅使用 self
而不是 [self class]
无论如何,正如我之前所说,您可以使用我的标识符作为供应商插件,而不是编辑设备插件
https://github.com/jcesarmobile/IDFVPlugin
window.IDFVPlugin.getIdentifier(function(identifier){ alert(identifier); },function(error){ alert(error); });