你最好的選擇可能是修改設備插件(帶有所有不希望的後果)。我能夠在./cordova/platforms/ios/[project名稱] /Plugins/org.apache.cordova.device/CDVDevice.m添加以下行deviceProperties
來獲得設備名稱:
- (NSDictionary*)deviceProperties
{
UIDevice* device = [UIDevice currentDevice];
NSMutableDictionary* devProps = [NSMutableDictionary dictionaryWithCapacity:4];
[devProps setObject:[device name] forKey:@"name"]; // <------------- new line
您還需要調整./cordova/plugins/org.apache.cordova.device/www/device.js相應的JavaScript對象:
channel.onCordovaReady.subscribe(function() {
me.getInfo(function(info) {
me.name = info.name; // <---------- new line
device.name
可能已被棄用,從插件刪除,但在iOS SDK 8.1 documentation中,分配的name
仍然是受支持的屬性。
您是否能夠正常工作? – sherb 2014-11-01 02:17:30