我正在使用Phonegap 3和Media插件.在iOS上测试我的应用时,我一直收到这些错误:
THREAD WARNING: ['Media'] took '205.391846' ms. Plugin should use a background thread.
Run Code Online (Sandbox Code Playgroud)
我从phonegap文档(http://docs.phonegap.com/en/edge/guide_platforms_ios_plugin.md.html)中看到了这一点:
- (void)myPluginMethod:(CDVInvokedUrlCommand*)command
{
// Check command.arguments here.
[self.commandDelegate runInBackground:^{
NSString* payload = nil;
// Some blocking logic...
CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsString:payload];
// The sendPluginResult method is thread-safe.
[self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
}];
}
Run Code Online (Sandbox Code Playgroud)
这是否会进入我的应用程序,或者我是否需要为每个插件编辑它?我把它放在哪里?
我在网上看到了一些关于此的帖子,但没有一个明确回答如何使用上述代码.