I've wrote a very simple plugin and added it to my config.xml:
<feature name="FileWriter">
<param name="ios-package" value="FileWriter" />
</feature>
after executing "Cordova prepare" it does not copy it to the staging/config.xml, and thus when I run the app I get an error:
2014-11-18 14:12:58.929 iOS Test[1280:723270] -[CDVCommandQueue executePending] [Line 158] FAILED pluginJSON = [
"FileWriter1220649673",
"FileWriter",
"cordovaGetFileContents",
[
]
]
If I manually add the feature to the config.xml found in the platform folder it works fine.
Basically there seems to be some sort of step missing in the "cordova prepare" step which is not copying this feature. All of the other elements in the base config.xml are copied properly to the platform specific one.
I've based the code off of the tutorial here
Follow the oficial tutorial instead
http://docs.phonegap.com/en/3.5.0/guide_hybrid_plugins_index.md.html#Plugin%20Development%20Guide
The one you linked is missing the part of the plugin.xml, that's the file read on cordova prepare to copy the necessary files to the iOS project.
Related
I'm attempting to use the new phonegap build with CLI 7.0.1
The build fails with this error:
The following build commands failed:
CompileAssetCatalog /Library/Developer/Xcode/DerivedData/Our_HNZC_Learning_space-ddfmniquktwfmabpvilymbvzreak/Build/Intermediates/ArchiveIntermediates/Our\ HNZC\ Learning\ space/InstallationBuildProductsLocation/Applications/Our\ HNZC\ Learning\ space.app Our\ HNZC\ Learning\ space/Images.xcassets
(1 failure)
Error code 65 for command: xcodebuild with args: -xcconfig,/private/project/cordova/build-release.xcconfig,-workspace,Our HNZC Learning space.xcworkspace,-scheme,Our HNZC Learning space,-configuration,Release,-destination,generic/platform=iOS,-archivePath,Our HNZC Learning space.xcarchive,archive,CONFIGURATION_BUILD_DIR=/private/project/build/device,SHARED_PRECOMPS_DIR=/private/project/build/sharedpch
I've added these to config.png
<icon src="res/icon.png" />
<splash src="res/splash.png" />
And I've added this plugin
<plugin name="cordova-plugin-splashscreen" />
And the files are in the right place.
Splash works fine, Icon is causing the error
Not sure what the exact problem is based upon the info you provided.
A starting point would be to remove the splashscreen plugin and re-add it:
cordova plugin remove cordova-plugin-splashscreen
cordova plugin add cordova-plugin-splashscreen
cordova prepare
I would suggest using an Icon and Splashscreen generator such as this one: http://phonegap.appiq.software/
It does all of the hard work for you and gives you the exact code for your config.xml
I hope this is helpful.
I'm trying to figure out how to create a Cordova iOS plugin with the PressReader framework. I'm an iOS developer and have no experience with Cordova, this is why I hope to find some guidance here.
This is what i have done:
Created a plugin
Added the Objective-C classes to src/iOS
Added the PressReader_SDK.framework to src/iOS (is this the right place ?)
Edited the src/www/js file
Edited the plugin.xml with the following in the iOS platform:
<config-file target="config.xml" parent="/widget">
<feature name="Hello">
<param name="ios-package" value="HWPHello" />
</feature>
</config-file>
<resource-file src="src/ios/PressReader_SDK.framework"/>
<framework src="src/ios/PressReader_SDK.framework" custom="true" />
<framework src="Foundation.framework"/>
<framework src="UIKit.framework"/>
<header-file src="src/ios/HWPHello.h" target-dir="HelloPlugin"/>
<source-file src="src/ios/HWPHello.m" target-dir="HelloPlugin"/>
After this I've created a new Cordova app, added the plugin and then the iOS platform.
When opening the Xcode project from platforms/iOS I get the following Build error:
error: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS10.1.sdk/System/Library/Frameworks/PressReader_SDK.framework: No such file or directory
Trying to run the app from terminal (cordova run ios --device) gives me the following error:
Error: Error code 65 for command: xcodebuild with args: -xcconfig,/Users/Andrei/desktop/hello/platforms/ios/cordova/build-debug.xcconfig,-workspace,Hello.xcworkspace,-scheme,Hello,-configuration,Debug,-destination,generic/platform=iOS,-archivePath,Hello.xcarchive,archive,CONFIGURATION_BUILD_DIR=/Users/Andrei/desktop/hello/platforms/ios/build/device,SHARED_PRECOMPS_DIR=/Users/Andrei/desktop/hello/platforms/ios/build/sharedpch
PS. the SDK does not seem to work on the simulator, and I need to test the app on a real device.
This is my first hybrid App. I'm getting about a dozen of these error message
C:\Users\Chloe\workspace\TypeFunctions>phonegap remote build ios
[phonegap] compressing the app...
rm: could not remove file (code EBUSY): C:\Users\Chloe\workspace\TypeFunctions\build\www/lib/images/icons-svg/mail-black.svg
There is only 1 search result on the entire web.
My target platform is Windows 8.1. I am using PhoneGap 5.4.0.
Strange, I tried it again, but now I got a different error. No mention of what the error was though. Terrible software.
C:\Users\Chloe\workspace\TypeFunctions>phonegap remote build ios
[phonegap] compressing the app...
skipping existing file: mail-black.svg
skipping existing file: tag-white.svg
skipping existing file: user-black.svg
skipping existing file: user-white.svg
[phonegap] uploading the app...
[phonegap] building the app...
[error] error occured while building the ios app
I managed to get a stack trace.
Error: ENOTEMPTY: directory not empty, rmdir 'C:\Users\Chloe\workspace\TypeFunctions\build'
at rethrow (fs.js:48:21)
at maybeCallback (fs.js:66:42)
at Object.fs.rmdir (fs.js:797:14)
at Object.module.exports.cleanup (C:\Users\Chloe\AppData\Roaming\npm\node_modules\phonegap\node_modules\phonegap-build\lib\phonegap-build\create\zip.js:119:16)
at Object.callback (C:\Users\Chloe\AppData\Roaming\npm\node_modules\phonegap\node_modules\phonegap-build\lib\phonegap-build\build\remote.js:71:21)
at Request._callback (C:\Users\Chloe\AppData\Roaming\npm\node_modules\phonegap\node_modules\phonegap-build-api\lib\api.js:229:26)
at Request.self.callback (C:\Users\Chloe\AppData\Roaming\npm\node_modules\phonegap\node_modules\phonegap-build-api\node_modules\request\main.js:122:22)
at emitTwo (events.js:87:13)
at Request.emit (events.js:172:7)
at Request. (C:\Users\Chloe\AppData\Roaming\npm\node_modules\phonegap\node_modules\phonegap-build-api\node_modules\request\main.js:655:16)
Additional Information
The EBUSY and ENOTEMPTY errors were caused by guard running. It might be possible to have it run with -w option.
I'm still getting the [error] error occured while building the ios app without reason. I'm using PhoneGap CLI and PhoneGap Build. I thought that part was obvious with the actual command line provided. The target platform was iOS. I thought that was given away by the command line too. The (default) platform tags in config.xml are
<platform name="ios">
<allow-intent href="itms:*" />
<allow-intent href="itms-apps:*" />
</platform>
<engine name="ios" spec="~3.9.2" />
The app was created with the jQuery template and command phonegap create myApp --template jquery-mobile-starter and then modified.
I just installed PhoneGap 3.5 and the PushPlugin using the PhoneGap CLI. I created a project using the PhoneGap CLI. In the receivedEvent method of index.js, I added these lines:
var pushNotification = window.plugins.pushNotification;
pushNotification.register(myTokenMethod, onError, {"badge": "true", "sound": "true", "alert":"true", "ecb": "mycallback"}
this leads to the error in xCode of:
CDVPlugin class PushPlugin (pluginName: PushPlugin) does not exist
ERROR: Plugin 'PushPlugin' not found or is not a CDVPlugin. Check your plugin mapping in config.xml
And although the instructions do not indicate I need to for automatic installation of the plugin, I went ahead and added
<feature name="PushPlugin">
<param name="ios-package" value="PushPlugin" />
</feature>
to my config.xml and receive the same error. The plugin version is 2.4, I am using an iPhone 6 as a test device and xCode 6.
Any ideas where to look?
Make sure your PushPlugin.m inside Build Phases > Compile Sources
I'm using wikitude and cordova plugin for my augmented reality iOS mobile app project in xcode5. I got this error when try to execute WikitudePlugin.loadARchitectWorld(successCallback, errorCallback, "path/to/your/world"); command.
2014-01-29 11:23:22.152 Bii[5441:60b] ERROR: Plugin 'WikitudePlugin' not found, or is not a CDVPlugin. Check your plugin mapping in config.xml.
2014-01-29 11:23:22.154 Bii[5441:60b] -[CDVCommandQueue executePending] [Line 117] FAILED pluginJSON = [
"WikitudePlugin308741238",
"WikitudePlugin",
"open",
[
"ENTER-YOUR-KEY-HERE",
null
]
]
I already add WTWikitudePlugin h/m into my project. This is my config.xml
<feature name="WTWikitudePlugin">
<param name="ios-package" value="WTWikitudePlugin"/>
</feature>
Why?
I would make sure your Wikitude plugin header and source files are in the Plugins folder in your Xcode project. I would then verify what the interface name of this plugin is.
<feature name="WTWikitudePlugin">
<param name="ios-package" value="WTWikitudePlugin"/>
</feature>
Particulary, you want to pair up the value in the <feature> tag to the interface name in your header/source file. This is how config.xml links the plugins. The JavaScript file will call the plugin using the "name" property - so this is how Cordova links the JavaScript to the config.xml, to the native library.
Seems to me that you're using a old version of PhoneGap. The current release (PhoneGap 3.3) uses Plugman to manage plugin installation.
Using Plugman, the feature name is WikitudePlugin.
So try to use WikitudePlugin instead of WTWikitudePlugin.
In my case, i removed and re-added wikitude plugin. In result it broke references in xcode project then starts showing this error.
I had to add all the frameworks and compile source files manually.
To do that go to Build Phases
Drag missing .m files in Plugins (possibly WTWikitudePlugin.m and WTARViewController.m) directory to 'Compile Sources' section
Drag all files in Frameworks to 'Link Binary With Libraries' section