2013-07-30 43 views
16

我已經安裝了Phonegap(3.0.3)和Cordova CLI。Phonegap,Cordova - 插件問題

我也運行iOS爲平臺

我已經安裝的插件($ cordova plugins ls

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

然而,當我運行此控制檯命令($ cordova emulate ios),我得到(使用$ cordova platforms ls確認)以下錯誤。

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="[email protected]" 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> 

任何建議這個問題可能是什麼,以及我該如何解決它?

+0

我有同樣的確切問題加入這一行,你有沒有找到一個方法來解決這個問題? –

回答

0

您是否運行cordova build ios

那麼當你沒有源添加到構建階段編譯來源cordova emulate ios

此錯誤發生。 嘗試添加插件具有:

TargetSettings - >構建階段 - >編譯源代碼 - >添加您的m級

14

添加AudioToolbox框架在您的Xcode項目:

您的目標>構建階段>鏈接二進制與圖書館

點擊 '+' 按鈕

選擇AudioToolbox.framework

+0

沒有工作...沒有這麼多 – Michael

+2

這沒有辦法。 –

+0

我正在使用cordova-plugin-dialogs,這對我有用:) – micmia

0

查看CDVNotification.h - #import行告訴你需要添加到編譯源編譯階段的所有內容。

基金會/ Foundation.h 的UIKit/UIKit.h AudioToolbox/AudioServices.h

添加這些3,它將編譯。

更新 - 額外的變化CDVNotification.m

playBeep是必要的()調用soundCompletionCallback() soundCompletionCallback調用playBeep()

爲了playBeep沒有錯誤,soundCompletionCallback必須申報。簡單的解決方案是在playBeep之前聲明它,然後定義它。

之前靜態無效playBeep(詮釋計數)

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