[英]Communicating with objective-C from JS in phonegap?
I need to get the iCloud directory, so I'd like to have some iOS bridge to get the directory name. 我需要获取iCloud目录,所以我想要一些iOS桥来获取目录名称。
NSURL *ubiq = [[NSFileManager defaultManager]
URLForUbiquityContainerIdentifier:nil];
if (ubiq) {
NSLog(@"iCloud access at %@", ubiq);
} else {
NSLog(@"No iCloud access");
}
This gives me the url, but I'd like to be able to do something like this: 这给了我url,但是我希望能够做这样的事情:
window.ios.getICloudDirectory(function(directory){
//do stuff with the iCloud directory
});
What is the easiest and least-code method of doing this? 最简单,最少代码的方法是什么?
Create a plugin. 创建一个插件。 This is the fastest way to go.
这是最快的方法。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.