【问题标题】:Cordova ActionSheet pluginCordova ActionSheet 插件
【发布时间】:2014-06-15 23:53:48
【问题描述】:

我正在尝试使用位于以下位置的 ActionSheet 插件 https://github.com/acyl/phonegap-plugins-1

按照设置说明进行操作:

使用此插件需要 Cordova iOS。

Make sure your Xcode project has been updated for Cordova
Drag and drop the ActionSheet folder from Finder to your Plugins folder in XCode, using         "Create groups for any added folders"
Add the .js files to your www folder on disk, and add reference(s) to the .js files using
Add new entry with key ActionSheet and value ActionSheet to Plugins in     Cordova.plist/Cordova.plist

我不确定最后一步,但我找到了 HelloCordova-Info.plist 并在那里添加了一个条目。

编译失败:

** BUILD FAILED **


The following build commands failed:CompileC build/HelloCordova.build/Debug-iphonesimulator/HelloCordova.build/Objects-normal/i386/ActionSheet-2887A8A627033B74.o /Users/Anthony/dev/phonegap_plugins/phonegap-plugins-1-master/iOS/ActionSheet/ActionSheet.m normal i386 objective-c com.apple.compilers.llvm.clang.1_0.compiler
Ld build/emulator/HelloCordova.app/HelloCordova normal i386
GenerateDSYMFile build/emulator/HelloCordova.app.dSYM build/emulator/HelloCordova.app/HelloCordova

(3 次失败)

【问题讨论】:

标签: ios cordova phonegap-plugins cordova-plugins


【解决方案1】:

试试这个,我昨天刚刚为 iOS 创建了它,它运行良好:https://github.com/EddyVerbruggen/cordova-plugin-actionsheet

【讨论】:

  • 线程警告:['ActionSheet'] 花费了 '16.089111' 毫秒。插件应该使用后台线程。这是关于什么的?
  • 这是iOS的警告,不用担心。这表明您的视图可能会因为前台线程上的繁重处理而变慢。显示操作表是一项艰巨的操作,但我认为您会同意它按原样运行非常顺利。
【解决方案2】:

我也收到了同样的警告。我的观点是我们应该尽可能地重视 iOS 警告以提高效率。下面是修复上述警告的代码,

THREAD WARNING: ['ActionSheet'] took '16.089111' ms. Plugin should use a background thread. 

修复代码 - 目标 C:

dispatch_queue_t myQueue = dispatch_queue_create("My Queue",NULL);
dispatch_async(myQueue, ^{
    dispatch_async(dispatch_get_main_queue(), ^{
        // Place where you need to display action sheet. 
        [actionSheet showInView:self.webView.superview];
    });
});

【讨论】:

猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2017-11-16
  • 2016-12-24
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多