I´m getting this error in XCode:
2013-08-23 14:36:18.284 Tell The DJ[14955:c07] ERROR: Plugin 'Device' not found, or is not a CDVPlugin. Check your plugin mapping in config.xml.
2013-08-23 14:36:18.284 Tell The DJ[14955:c07] -[CDVCommandQueue executePending] [Line 116] FAILED pluginJSON = [
"Device1096677259",
"Device",
"getDeviceInfo",
[
]
]
2013-08-23 14:36:18.285 Tell The DJ[14955:c07] CDVPlugin class CDVConnection (pluginName: NetworkStatus) does not exist.
2013-08-23 14:36:18.285 Tell The DJ[14955:c07] ERROR: Plugin 'NetworkStatus' not found, or is not a CDVPlugin. Check your plugin mapping in config.xml.
2013-08-23 14:36:18.285 Tell The DJ[14955:c07] -[CDVCommandQueue executePending] [Line 116] FAILED pluginJSON = [
"NetworkStatus1096677260",
"NetworkStatus",
"getConnectionInfo",
[
]
]
I installed Phonegap 3.0 with the Command Line Interface and paste my www files into the project folders. The app works fine but when i come to native functions like device ID, camera, network connections it fails and gets me this error. But I think my config.xml is right?
<?xml version='1.0' encoding='utf-8'?>
<widget id="io.cordova.helloCordova" version="2.0.0" xmlns="http://www.w3.org/ns/widgets">
<name>Hello Cordova</name>
<description>
A sample Apache Cordova application that responds to the deviceready event.
</description>
<author email="dev#cordova.apache.org" href="http://cordova.io">
Apache Cordova Team
</author>
<content src="index.html" />
<feature name="LocalStorage">
<param name="ios-package" value="CDVLocalStorage" />
</feature>
<access origin="http://dev.tellthedj.de" />
<preference name="KeyboardDisplayRequiresUserAction" value="true" />
<preference name="SuppressesIncrementalRendering" value="false" />
<preference name="UIWebViewBounce" value="true" />
<preference name="TopActivityIndicator" value="gray" />
<preference name="EnableLocation" value="false" />
<preference name="EnableViewportScale" value="false" />
<preference name="AutoHideSplashScreen" value="true" />
<preference name="ShowSplashScreenSpinner" value="true" />
<preference name="MediaPlaybackRequiresUserAction" value="false" />
<preference name="AllowInlineMediaPlayback" value="false" />
<preference name="OpenAllWhitelistURLsInWebView" value="false" />
<preference name="BackupWebStorage" value="cloud" />
<preference name="orientation" value="portrait" />
<preference name="webviewbounce" value="false" />
<preference name="prerendered-icon" value="true" />
<preference name="phonegap-version" value="3.0.0" />
<preference name="fullscreen" value="false" />
<preference name="stay-in-webview" value="false" />
<preference name="android-minSdkVersion" value="7" />
<preference name="android-installLocation" value="internalOnly" />
<preference name="target-device" value="universal" />
<preference name="autohide-splashscreen" value="true" />
<preference name="load-url-timeout" value="60000" />
<preference name="show-splashscreen-spinner" value="true" />
<preference name="show-splash-screen-spinner" value="true" />
<preference name="allow-inline-media-playback" value="false" />
<preference name="launch-mode" value="standard" />
<feature name="Media">
<param name="ios-package" value="CDVSound" />
</feature>
<feature name="Camera">
<param name="ios-package" value="CDVCamera" />
</feature>
<feature name="Console">
<param name="ios-package" value="CDVLogger" />
</feature>
<feature name="Device">
<param name="ios-package" value="CDVDevice" />
</feature>
<feature name="Notification">
<param name="ios-package" value="CDVNotification" />
</feature>
<feature name="File">
<param name="ios-package" value="CDVFile" />
</feature>
<feature name="FileTransfer">
<param name="ios-package" value="CDVFileTransfer" />
</feature>
<feature name="Geolocation">
<param name="ios-package" value="CDVLocation" />
</feature>
<feature name="Capture">
<param name="ios-package" value="CDVCapture" />
</feature>
<feature name="NetworkStatus">
<param name="ios-package" value="CDVConnection" />
</feature>
<feature name="SplashScreen">
<param name="ios-package" value="CDVSplashScreen" />
</feature>
<plugins>
<plugin name="Device" value="CDVDevice" />
</plugins>
</widget>
I was using PhoneGap 3.0/3.1 and was removing the local build folder before rebuilding (since I had to copy icons and stuff in a secondary build script). This broke my plugins and produced this same error message.
In the end I found I had to remove ./plugins/ios.json when removing ./platforms/ios to make sure the plugins were rebuilt.
Deleting the platforms/ios folder is not a solution for me as all manual customizations to the xcode project will be lost.
But there is a simple way around:
In XCode, goto Build Phases -> open the Compiled Sources dropdown.
Click + and add the missing plugin .m file that should be in your
Plugins directory (but is missing from the compiled sources).
This solution came from another stack overflow answer, here: https://stackoverflow.com/a/21148428/80254
Another alternative:
In xcode make sure the source files of the plugin has the 'target membership' settings set: In File-Explorer go to Plugins > CDVDevice.m and check if there is a tick next to your app name at "target membership" on the right side of xcode window. This actually does the same as the other solution but is a bit more convenient.
From here: https://stackoverflow.com/a/20576744/80254
I encountered the same issue. I have followed the solution given by Jeffrey Van Alstine. This is my script for building and testing an iOS app developed using Phonegap 3.0/3.1.
#!/bin/bash
echo "Killing xcode..."
kill $(ps aux | grep 'Xcode' | awk '{print $2}')
rm -r platforms/ios
rm plugins/ios.json
phonegap build ios
open platforms/ios/*.xcodeproj
Save it as a bash file, for example, ios.sh into your working directory (directory that contains www folder) and run ./ios.sh
This seems to be a known issue for 3.* versions
https://issues.apache.org/jira/browse/CB-4971
you can solve this by upgrading Phonegap to release 3.4.
Try reinstalling the plugin:
phonegap local plugin add https://git-wip-us.apache.org/repos/asf/cordova-plugin-device.git
I use Cordova 3.7 and I solved the problem with Kobkrit Viriyayudhakorn 's solution, BUT of course you need to use
cordova build ios
instead of
phonegap build ios
i think you need to use the correct config.xml
for me, it is Xcode project target folder config.xml, and not platform www folder
I have found a solution that worked for me. I was using with the Compass plugin and after adding the plugin I have noticed that the config.xml (plugin docs) says it should have
<feature name="Compass">
<param name="ios-package" value="**CDVLocation**" />
</feature>
while the ios.json in plugin has added
"config.xml": {
"/*": {
"<feature name=\"Compass\"><param name=\"ios-package\" value=\"**CDVCompass**\" /></feature>": 1,
"<feature name=\"Device\"><param name=\"ios-package\" value=\"CDVDevice\" /></feature>": 1
}
One of then refers to CDVCompass while the other CDVLocation ... changing the xml to CDVCompass did the trick and now the app is working.
I am so tired of removing and re-adding platforms for plugin issues! It seems like it is still a problem even now (2014/10) where if you add plugins to an app after adding platforms the plugin sometime does not get propagated down to the corresponding platform folders/etc. Note this seems to mainly affect iOS - not Android.
I think my solution is just an updated method of doing same thing bjunix posted earlier - but in XCode 6 to fix this sort of thing without removing/re-adding my platform I:
Expand my App/Plugins folder in the left project navigator panel
Click on each plugin file in the list that is currently in red text (one at time)
Jump to the right side (Utilities) panel and click the folder icon in the Identity and Type section to re-link it to the actual file (see screenshot below).
After doing the above my project finally builds.
When this happens, it seems the xcode npm package responsible for making changes to the pbxproj file sometimes leaves references to plugin files that have been removed. I have not tracked down under what exact circumstances this occurs, but it appears to happen from frequent plugin remove/add operations (to update a plugin for example).
I suspect that when a plugin is removed and the xcode npm package fails at its job, it is only able to remove the plugin file references from the PBXBuildFile section but no other sections, leaving the pbxproj in a broken state.
When the xcode npm package attempts to add the plugin file references again, it first checks if the references are already in pbxproj. It looks in the PBXFileReference section, and since it finds references to the plugin in there, aborts further processing, getting us nowhere.
My solution, albeit a hack when it comes down to it, is to force the xcode npm package to check the PBXBuildFile section instead. That section will be missing the references and in turn the plugin will be re-installed correctly.
Change pbxFileReferenceSection to pbxBuildFileSection on this line: https://github.com/alunny/node-xcode/blob/master/lib/pbxProject.js#L620
Re-install your plugins, and you should be good to go.
I my case After install Paypal Plugin I am facing issue.
I resolved its by add "PayPalMobileCordovaPlugin.m" in the Compile Source.
So you just need to add .m file in Compile source add it works for me.
Check Screenshot.
Hope its work for you
This can also happen if you have a plugin that is referenced but not installed. If you have tried the above solutions and can't find the referenced plugin's .m file it might be that the plugin isn't really installed.
I would check your plugins directory to be sure that there are files in it. If not, reinstall the plugin. I ran into this when I had a typo in the git repo when restoring plugins from the config.xml.
I resolved this issue by changing the "plugin" entry to a "feature" entry in the config.xml. (using PhoneGap 3.1/iOS). This is what the fix looked like:
<feature name="DGGeofencing">
<param name="ios-package" value="DGGeofencing"/>
</feature>
I solved this issue with complete reinstall of Node.js and Phonegap through the CLI Tool
Related
I'm trying to run an iOS Cordova app using the StatusBar plugin (version 2.3.0).
My problem is that the plugin will be loaded randomly and also works just randomly.
Sometimes I get this error on Xcode:
[CDVTimer][statusbar] 5.837023ms
ERROR: Plugin 'StatusBar' not found, or is not a CDVPlugin. Check your plugin mapping in config.xml.
[CDVCommandQueue executePending] [Line 142] FAILED pluginJSON = ["StatusBar1191468497","StatusBar","_ready",[]]
and sometimes it's just working fine.
My config.xml:
<plugin name="cordova-plugin-statusbar" spec="2.3.0" />
<feature name="StatusBar">
<param name="ios-package" value="CDVStatusBar" />
<param name="onload" value="true" />
<param name="ios-package" onload="true" value="CDVStatusBar" />
</feature>
<preference name="StatusBarOverlaysWebView" value="false" />
<preference name="StatusBarBackgroundColor" value="#445E75" />
<preference name="StatusBarStyle" value="lightcontent" />
I also tried removing the platform and adding it again, removing the ios.json... I always get the same result.
The solution was to call the JavaScript methods of StatusBar.
document.addEventListener("deviceready", function(){
StatusBar.overlaysWebView(false);
Statusbar.backgroundColorByHexString("#445E75");
Statusbar.styleLightContent();
}, false);
My app shows a white screen on the device but it correctly runs in the browser and emulator. I have tried a lot of solutions, but none have worked for me. I also use the ionic run ios -l -c command to see errors on the console log but it didn't show any errors.
Does anyone have any suggestions on how I could debug this issue?
IOS is deprecated the UIWebview in the latest version of the IOS.
Install the WKWebview plugin in ionic project using the following commnad
cordova-plugin-ionic-webview
Remove ios platform from ionic project using below command
ionic cordova platform rm ios
Open config.xml file of the ionic project and place the below line of code inside ios platform ( )
After steap you config.xml file code look like
<platform name="ios">
<preference name="WKWebViewOnly" value="true" />
<feature name="CDVWKWebViewEngine">
<param name="ios-package" value="CDVWKWebViewEngine" />
</feature>
Add Readd ios platform
ionic cordova platform add ios
I also faced same issue:
but you can replace your html page contents by <ion-content> with <ion-scroll>.. and also set overflow-scroll="false"
Another thing is check in your config.xml file that all this values are set
<preference name="SplashScreenDelay" value="2000"/>
<preference name="FadeSplashScreenDuration" value="2000"/>
<preference name="SplashScreen" value="screen"/>
<preference name="ShowSplashScreenSpinner" value="false"/>
<preference name="AutoHideSplashScreen" value="false" />
and also change in app.js file by adding this line
$ionicConfigProvider.views.swipeBackEnabled(false);
I faced a similar issue recently. Can you try performing a clean installation after deleting node_modules, platforms and plugins directories.
If it didn't work update your app.component.ts like this.
import { SplashScreen } from '#ionic-native/splash-screen';
export class MyApp {
...
constructor(... public splashScreen: SplashScreen, ...) {
this.initializeApp();
}
initializeApp() {
this.platform.ready().then(() => {
...
setTimeout(() => {
this.splashScreen.hide();
}, 2000);
...
});
}
In your config.xml set this perference.
<preference name="AutoHideSplashScreen" value="false" />
<preference name="SplashShowOnlyFirstTime" value="false" />
<preference name="ShowSplashScreen" value="false" />
<preference name="SplashScreenDelay" value="3000" />
<preference name="ShowSplashScreenSpinner" value="false" />
<preference name="FadeSplashScreen" value="false" />
I'm building an iOS app and recently upgraded cordova-ios to 4.1.0 and started using: cordova-plugin-wkwebview-engine.
The problem is that now I get the error message Cross origin requests are only supported for HTTP while trying to load dependencies, so the app won't start.
It's trying to load systemjs dependencies over file://, but I included in my config.js.
I have no clue how to fix this. Does anyone have experience with this bevaviour?
cordova version: 6.1,0
cordova ios version: 4.1.0
related config.xml bit:
<access origin="*" />
<feature name="CDVWKWebViewEngine">
<param name="ios-package" value="CDVWKWebViewEngine" />
</feature>
<preference name="CordovaWebViewEngine" value="CDVWKWebViewEngine" />
Install this one plugin (cordova-ios 6+)
cordova plugin add https://github.com/globules-io/cordova-plugin-ios-xhr
then set
<preference name="AllowUntrustedCerts" value="true" />
<preference name="InterceptRemoteRequests" value="all" />
<preference name="allowFileAccessFromFileURLs" value="true" />
<preference name="allowUniversalAccessFromFileURLs" value="true" />
Install the following plugins:
cordova plugin add cordova-plugin-wkwebview-engine
cordova plugin add cordova-plugin-wkwebview-file-xhr
cordova plugin add https://github.com/TheMattRay/cordova-plugin-wkwebviewxhrfix
Add to config.xml:
<platform name="ios">
...
<preference name="WKWebViewOnly" value="true"/>
...
</platform>
For Cordova iOS 6+ just need to install the following plugin.
cordova plugin add https://github.com/AraHovakimyan/cordova-plugin-wkwebviewxhrfix
This plugin does not depend on any other additional plugins and does not require additional permissions.
I had the same issue with my cordova project (actually Ionic v1) and I fix it with the following command:
cordova plugin add https://github.com/apache/cordova-plugins.git#wkwebview-engine-localhost
This will install a webserver that runs locally and the error should be gone after that. After you run that command, just run:
cordova prepare ios
or remove all plugins and reinstall:
rm -rf plugins/
cordova platform add ios
Make sure you have this in your config.xml:
<access origin="*" />
<feature name="CDVWKWebViewEngine">
<param name="ios-package" value="CDVWKWebViewEngine" />
</feature>
<preference name="CordovaWebViewEngine" value="CDVWKWebViewEngine" />
If you work with cordova-ios ^6.0.0. you need only to modify your config.xml file:
<platform name="ios">
...
<preference name="scheme" value="app" />
<preference name="hostname" value="localhost" />
...
</platform>
No need to install any additional plugins.
See Cordova iOS 6.0.0 Released for more info.
I had the same issue with my ionic v1 Cordova project. For me the solution was to migrate to capacitor, like this:
Start a New Ionic v1 project (% ionic start Bienchen blank --type ionic1)
Answer "yes" when the cli asked if to integrate "capacitor".
Checkout my Sources to the www-folder of the new Ionic v1 project
Build the project with capacitor (% ionic capacitor build iOS)
Keep in mind the the Cordova config.xml than is not longer used, instead configure in Xcode Project.
I have a hybrid app developed with DevExpress and PhoneGap.
I try to open a local jpeg image via
window.open('file:///var/mobile/Containers/Data/.../image.jpg', '_system');
but it does not work (anymore) on iPhone and iPad (latest iOS 9 version), failing with the error error: "This app is not allowed to query for scheme file".
(The app downloaded the image beforehand via the Phonegap method FileTransfer.download to the folder that it got via window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, ...) method.)
It works fine on Android, and it worked fine on iPhone as well a few weeks ago. I think it might be related to the PhoneGap update due to an update of DevExtreme.
Before, I used PhoneGap 3.7.0, now I use cli-5.2.0.
I already found this question (https://www.devexpress.com/Support/Center/Question/Details/Q486439), which is similar, but it's already 2 years old and does not seem to solve my questions.
Using GapDebug, I see this in the log:
<Warning>: THREAD WARNING: ['InAppBrowser'] took '38.211914' ms. Plugin should use a background thread.
<Warning>: THREAD WARNING: ['File'] took '26.509033' ms. Plugin should use a background thread.
<Warning>: -canOpenURL: failed for URL: "file:///var/mobile/Containers/Data/Application/9425CCB6-77F7-4337-B37C-7DB577C2F6B4/Documents/myDocuments/a96e7238-a502-49e6-bcd3-186937afc3cb/camera_1458208164206.jpg" - error: "This app is not allowed to query for scheme file"
It's some kind of permission problem, but what to add to the config.xml?
This is my config.xml:
<widget xmlns="http://www.w3.org/ns/widgets" xmlns:gap="http://phonegap.com/ns/1.0" id="com.devexpress.apptemplate" version="1.0" versionCode="1">
<name>ApplicationTemplate</name>
<preference name="phonegap-version" value="cli-5.2.0" />
<preference name="permissions" value="none" />
<preference name="prerendered-icon" value="true" />
<preference name="android-windowSoftInputMode" value="adjustResize" />
<preference name="SplashScreen" value="splash" />
<preference name="SplashScreenDelay" value="60000" />
<preference name="AutoHideSplashScreen" value="false" />
<preference name="DisallowOverscroll" value="true" />
<preference name="StatusBarOverlaysWebView" value="false" />
<preference name="StatusBarBackgroundColor" value="#000000" />
<preference name="KeyboardDisplayRequiresUserAction" value="false" />
<feature name="http://api.phonegap.com/1.0/network" />
<gap:plugin name="com.devexpress.plugins.devextremeaddon" version="1.0.1" />
<gap:plugin name="cordova-plugin-ios-longpress-fix" version="1.1.0" source="npm" />
<gap:plugin name="org.apache.cordova.camera" version="0.3.6" />
<gap:plugin name="org.apache.cordova.file" version="1.3.3" />
<gap:plugin name="org.apache.cordova.file-transfer" version="0.5.0" />
<gap:plugin name="org.apache.cordova.inappbrowser" version="0.6.0" />
<gap:plugin name="org.apache.cordova.media-capture" version="0.3.6" />
<gap:plugin name="org.apache.cordova.media" version="0.2.16" />
<gap:plugin name="org.apache.cordova.network-information" version="0.2.15" />
<gap:plugin name="cordova-plugin-statusbar" version="2.1.0" source="npm" onload="true" />
<gap:plugin name="org.apache.cordova.splashscreen" version="1.0.0" onload="true" />
<access origin="*" subdomains="true"/>
<gap:plugin name="cordova-plugin-whitelist" source="npm"/>
<allow-navigation href="*" />
<allow-intent href="*" />
</widget>
I even added the two lines
<allow-navigation href="*" />
<allow-intent href="*" />
according to https://github.com/apache/cordova-plugin-whitelist and it does not help.
I saw that Ionic, another hybrid framework, also mentions in their docs http://docs.ionic.io/docs/cordova-whitelist that there might be permission problems with newer Phonegap versions, such as the CLI versions, and that the above <allow-navigation href="*" /> should be used - however it does not seem to help in my case.
=== Update ===
I created two tickets on Phonegap's & Cordova's github:
https://github.com/phonegap/phonegap-app-developer/issues/413
https://issues.apache.org/jira/browse/CB-11027
=== Update 2 ===
As suggest below, I am now using https://github.com/pwlin/cordova-plugin-file-opener2 instead, which works fine.
On iOS 9 you have to config the urls you want to query (know if you can open them).
To do that you have to edit the info.plist and add the LSApplicationQueriesSchemeskey and an array of strings with the schemes you want to query
<key>LSApplicationQueriesSchemes</key>
<array>
<string>file</string>
<string>whatsapp</string>
<string>...</string>
</array>
As you are using cordova, you can do that in a few different ways.
You can open Xcode project inside platforms/ios and edit the info.plist file, but the Xcode project is removed and recreated in some cases, and your changes will be lost.
Another option is to create a simple cordova plugin that just writes on the info.plist. To do that you have to use the config-file tag on the plugin.xml
<config-file target="*-Info.plist" parent="LSApplicationQueriesSchemes">
<array>
<string>file</string>
</array>
</config-file>
http://cordova.apache.org/docs/en/latest/plugin_ref/spec.html#platform
Third option is to use a hook, a hook is a script file (node, bash) that is executed, and you can use it to write on the info.plist
http://cordova.apache.org/docs/en/latest/guide/appdev/hooks/index.html
I was facing the same problem... I started using cordova-plugin-file-opener2 (github.com/pwlin/cordova-plugin-file-opener2) to avoid the problem.
To solve the problem with white spaces I removed them from the targetPath:
targetPath = targetPath.replace(/ /g,'')
So my download/open code is like that:
$cordovaFileTransfer.download(url, targetPath, options, trustHosts)
.then(function(result) {
$cordovaFileOpener2.open(targetPath, mimeType)
})
I am using the Cordova (4.2.0) StatusBar plugin. The options I want are:
<preference name="StatusBarOverlaysWebView" value="false" />
<preference name="StatusBarStyle" value="lightcontent" />
<preference name="StatusBarBackgroundColor" value="#A7A7A7"/>
All is fine, when I directly edit the config.xml file in XCode before building (in Xcode) and running the app on a device.
My issue is that as soon as a re-run "cordova build ios", the settings in the config.xml file revert to the defaults of:
<preference name="StatusBarOverlaysWebView" value="true" />
<preference name="StatusBarStyle" value="lightcontent" />
Ok - so I know about default.xml and put my required settings in there. Trouble is now I get (unnecessary lines edited out):
<preference name="StatusBarOverlaysWebView" value="false" />
<preference name="StatusBarStyle" value="lightcontent" />
<preference name="StatusBarBackgroundColor" value="#A7A7A7" />
<feature name="StatusBar">
<param name="ios-package" value="CDVStatusBar" />
<param name="onload" value="true" />
</feature>
<preference name="StatusBarOverlaysWebView" value="true" />
Note the second "StatusBarOverlaysWebView" entry and this "StatusBarOverlaysWebView" entry overrides the first!!
So I dig deeper and find plugin.xml, which contains:
<preference name="StatusBarOverlaysWebView" value="true" />
<preference name="StatusBarStyle" value="lightcontent" />
That has got to be it, so I change that to my required defaults ... but no, I still get the second "StatusBarOverlaysWebView" and I have no idea why or where it is coming from. Can anyone help?
Thanks in advance
Nick
Try this:
Remove the iOS platform (cordova platform rm ios).
Uninstall the plugin (cordova plugin rm org.apache.cordova.statusbar).
Edit the config.xml in your root directory and add your 3 preferences there.
Reinstall the plugin (cordova plugin add org.apache.cordova.statusbar).
Edit plugin.xml and remove the 2 default preferences.
Add back the iOS platform (cordova platform add ios).
I'm betting that will fix you.