2015-10-02 44 views
0

我是phonegap的新手,並且盡力學習儘可能多的東西。我跟着this tutorial建機自定義插件適用於iOS,但是當我建立在我的Xcode項目它給了我下面的:插件未找到錯誤在Xcode中構建一個自定義插件

ERROR: Plugin 'FileWriter' not found, or is not a CDVPlugin. Check your plugin mapping in config.xml.
2015-10-02 22:10:07.168 MyCPlug[2673:196404] -[CDVCommandQueue executePending] [Line 159] FAILED
pluginJSON = ["FileWriter247765134","FileWriter","cordovaGetFileContents",[]]

我已經按照每細節每一點,並試圖多次,但我沒能成功。

+0

編寫插件是做最難的事電話間隙。如果這是你的目標,我會先寫一些應用程序 - 這樣你就能理解這個過程。在這一點上,錯誤表明你不夠了解。 – JesseMonroy650

+0

@ JesseMonroy650我不明白爲什麼會發生這種情況。它與我正在使用的phonegap版本有關或者新的xcode不支持phonegap。我經歷了許多教程,每個教程都是一樣的,每個教程都遵循自定義插件,這給我帶來了同樣的錯誤。我想在我的phonegap應用程序中使用一些本地代碼。 –

+0

那個教程很老,閱讀官方插件開發指南http://cordova.apache.org/docs/en/5.1.1/guide_hybrid_plugins_index.md.html#Plugin%20Development%20Guide – jcesarmobile

回答

0

@Hassan,
正如我所說的,Cordova/Phonegap插件是人們可以承擔的最困難的任務之一。部分原因是因爲Cordova/Phonegap是一個移動目標。

首先,它會很醜。
例如,在過去兩(2)周內,Apple發佈了移動設備從8.x升級到iOS 9.0.1的升級。毋庸置疑,這引發了許多許多開發者的措手不及。然後幾天後,Phonegap Build,週末,做了一個* unannounced *升級從3.7.0cli-5.2.0。對於志願者支持小組,我們完全沒有意識到。直到20多個小時過去了,一位開發人員才發現,大部分都是從所看到的模式。 (2天后Adobe /電話admitted to as much in this tweet)不用說這很煩人,但不是問題的根源。再次,它是一個移動的目標。

我們得到您的answser
首先,我要給你一個常見問題我寫的一個環節。在您應用解決方案(如下)後,我會閱讀它,但不遵循許多鏈接。該文檔旨在爲應用程序開發人員提供快速閱讀,而非插件開發人員。你會找到有用的信息,但不是你需要的答案。
Top Mistakes by Developers new to Cordova/Phonegap
我假定你已經閱讀過這個,反正我包括Plugin Development Guide

以下是我對這個;這是一個罐頭答案。

的PhoneGap構建論壇,Petra Adds

I would add: without announcement, PGB changed the default PGB-version from 3.7.0 to cli-5.2.0. This causes all those who have not set 'phonegap-version' in config.xml to be confronted with the sudden need of splashscreen and whitelist plugins and additional whitelisting specifications in config and HTML.

Also, several plugins seem not to build correctly with cli-5.2.0, causing log file error messages about "Class ***.java".

FWIW:的PhoneGap構建admitted to as much in this tweet

速戰速決添加到您的​​3210
<preference name="phonegap-version" value="3.7.0" />

否則Top Mistakes by Developers new to Cordova/Phonegap你已經一:

  • #6 不設置 「的PhoneGap版」 爲你的編譯
  • #7 不設置 「版本」 爲您的插件
  • #10 不在config.xml中添加新的「白名單」和「白名單插件」參數。

對於#6 &#7

With the CLI version, if you do not assign a version for your platform OR in 'Phonegap Build' if you do not set the phonegap-version in config.xml, YOU WILL GET THE LATEST VERSION. If you are lucky, your program just works as expected. If you are not lucky, you'll get a set of cascading errors.

Luckily for all of us, Holly Schinsky has written a nice blog post to explain it all:

Cordova/PhoneGap Version Confusion
http://devgirl.org/2014/11/07/cordovaphonegap-version-confusion/

對於#10

This relatively * NEW * requirement means – to access ANY website or resources on the web, you MUST use the whitelist and the whitelist plugin. This requirement goes into affect, if you are using [email protected] or better; including cli-5.1.1. If however, your version is before 4.0.0, let's say 3.5.0 or 3.7.0, then you will not have to add the white-list requirement.

To be clear, the "whitelist" has been around for a bit, but the plugin and requirement is very new. As you would expect, when the "whitelist" was added, the de facto open-access feature was deprecated. Or said another way, the de facto open-access feature was planned and scheduled to be eliminated. This change marks a step in removal of the open-access feature.

In addition, the Content Security Policy (CSP) has caught numerous developers - because it was soooo poorly publicized. Depending on your use and the version of Phonegap you are using, the CSP needs to go in every single HTML page you used, just like you have to wait for 'deviceready'. However, there are cases where it is not needed at all. The documentation is confusing for some, please read it carefully. The documentation is buried in the bottom of many of the latest documentation pages.

相關鏈接

Phonegap Build Forum: Notes for upgrading to cli-5.1.1 on PGB and now required Whitelist

+0

我的phonegap版本是5.3.1我應用了你的快速修復,但它沒有幫助,然後我用'phonegap平臺添加ios @ 3.7.0',但它也沒有幫助。它給了我同樣的錯誤'找不到插件'FileWriter',或者不是CDVPlugin。檢查你的插件映射在config.xml中# –

+0

@Hassan,你得到的錯誤應該與編寫插件無關。你實際上有一個插件丟失。我建議現在刪除你的插件,並專注於這個問題。如果錯誤消失,那麼這是您插件的一個問題。如果錯誤仍然存​​在,我可以幫忙。但正如我所說,我的筆記是Apps的開發人員,而不是插件開發人員。 – JesseMonroy650

+0

只有在添加本教程中的自定義插件時纔會出現此錯誤[link](http://moduscreate.com/building-a-custom-phonegap-plugin-for-ios/) –

相關問題