【问题标题】:Phonegap, Cordova - Issue with PluginsPhonegap,Cordova - 插件问题
【发布时间】:2013-07-30 08:30:35
【问题描述】:

我已经安装了 Phonegap (3.0.3) 和 Cordova CLI。

我还将 iOS 作为平台运行(使用 $ cordova platforms ls 确认)

我已经安装了插件 ($ cordova plugins ls)

org.apache.cordova.core.dialogs
org.apache.cordova.core.vibration

但是,当我运行此控制台命令 ($ cordova emulate ios) 时,我收到以下错误。

Undefined symbols for architecture i386:
  "_AudioServicesAddSystemSoundCompletion", referenced from:
      _playBeep in CDVNotification.o
  "_AudioServicesCreateSystemSoundID", referenced from:
      _playBeep in CDVNotification.o
  "_AudioServicesDisposeSystemSoundID", referenced from:
      _soundCompletionCallback in CDVNotification.o
  "_AudioServicesPlaySystemSound", referenced from:
      _playBeep in CDVNotification.o
      -[CDVVibration vibrate:] in CDVVibration.o
  "_AudioServicesRemoveSystemSoundCompletion", referenced from:
      _soundCompletionCallback in CDVNotification.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)


** BUILD FAILED **


The following build commands failed:
    Ld build/MyApp.app/MyApp normal i386
(1 failure)

我已按照此处 API 页面 (http://cordova.apache.org/docs/en/edge/cordova_notification_notification.md.html#Notification) 的说明进行操作,下面是导致错误的 MyApp > www > config.xml 文件中的我的 config.xml 文件。

<?xml version='1.0' encoding='utf-8'?>
<widget id="com.myapp.myapp" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
    <name>MyApp</name>
    <description>
        A sample Apache Cordova application that responds to the deviceready event.
    </description>
    <author email="dev@callback.apache.org" href="http://cordova.io">
        Apache Cordova Team
    </author>
    <plugin name="Notification" value="CDVNotification" />
    <access origin="*" />
    <preference name="fullscreen" value="true" />
    <preference name="webviewbounce" value="true" />   
</widget>

任何建议可能是什么问题,以及如何解决它?

【问题讨论】:

  • 我也有同样的问题,你找到解决方法了吗?

标签: javascript ios plugins cordova


【解决方案1】:

在您的 Xcode 项目中添加 AudioToolbox 框架:

您的目标 > 构建阶段 > 将二进制文件与库链接

点击“+”按钮

选择 AudioToolbox.framework

【讨论】:

  • 我正在使用cordova-plugin-dialogs,这对我有用:)
【解决方案2】:

你跑cordova build ios了吗?

然后cordova emulate ios

当您在构建阶段未将源添加到编译源时会发生此错误。 尝试添加插件:

TargetSettings -> 构建阶段 -> 编译源 -> 添加你的 .m 类

【讨论】:

    【解决方案3】:

    查看 CDVNotification.h - #import 行告诉您需要添加到编译源构建阶段的所有内容。

    基金会/Foundation.h UIKit/UIKit.h AudioToolbox/AudioServices.h

    添加这 3 个,它会编译。

    更新 - 需要在 CDVNotification.m 中进行额外更改

    playBeep() 调用 soundCompletionCallback() soundCompletionCallback 调用 playBeep()

    为了让 playBeep 没有错误,必须声明 soundCompletionCallback。简单的解决方案是在 playBeep 之前声明它,然后在之后定义它。

    在 static void playBeep(int count) 之前添加这一行

    // declared but not defined to avoid undeclared error in playBeep
    static void soundCompletionCallback(SystemSoundID  ssid, void* data);
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-10-29
      相关资源
      最近更新 更多