org.apache.cordova.facebook.Connect plugin error - ios

I am using org.apache.cordova.facebook.Connect plug-in and I am having this error.
ERROR: Plugin 'org.apache.cordova.facebook.Connect' not found, or is not a CDVPlugin. Check your plugin mapping in config.xml.
[CDVCommandQueue executePending] [Line 158] FAILED pluginJSON = [
"org.apache.cordova.facebook.Connect165525704",
"org.apache.cordova.facebook.Connect",
"init",
[
"app id"
]
]
my cordova version is 3.5.0.
I’ve try to add appname/plugins/plugin.xml to this.
<feature name="FacebookConnectPlugin">
<param name="ios-package" value="FacebookConnectPlugin"/>
<param name="onload" value="true" />
</feature>
<gap:plugin name="com.phonegap.plugins.facebookconnect" version="0.4.0">
<param name="APP_ID" value="appid" />
<param name="APP_NAME" value="appname" />
</gap:plugin>
<plugin name="FacebookConnectPlugin" value="FacebookConnectPlugin" />
but no luck!! I’ve Change FB.login to facebookConnectPlugin.login but again no luck..
one more thing my application use contacts to send invitations, so in my ios device, settings/privacy/contacts I can see that my application, but in Facebook I can't see my application. I I’ve already gave permission like this.
<feature name="FacebookConnectPlugin">
<param name="ios-package" value="FacebookConnectPlugin" />
<param name="onload" value="true" />
</feature>
<plugin name="FacebookConnectPlugin" value="FacebookConnectPlugin" />
<access origin="https://m.facebook.com" />
<access origin="https://graph.facebook.com" />
<access origin="https://api.facebook.com" />
<access origin="https://*.fbcdn.net" />
<access origin="https://*.akamaihd.net" />
<feature name="Contacts">
<param name="ios-package" value="CDVContacts" />
</feature>
please help.!!!!

Related

Cordova StatusBar plugin fails randomly

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);

Get XMPP Chat History OpenFire

I am trying to implement a chat application using XMPPFramework in iOS, using OpenFire server. My chat is working fine, I am trying to retrieve chat history from server. Ofcourse I have enabled Message Archiving on Server. This is the Request I am sending
<iq type="get">
<retrieve xmlns="urn:xmpp:archive" with="dev_user80#mydomain">
<set xmlns="http://jabber.org/protocol/rsm">
<max>100</max>
</set>
</retrieve>
</iq>
This is the response I am getting.
<iq xmlns="jabber:client" type="error" to="dev_user103#mydomain/6i0qoo9tek">
<retrieve xmlns="urn:xmpp:archive" with="dev_user80#mydomain">
<set xmlns="http://jabber.org/protocol/rsm">
<max>100</max>
</set>
</retrieve>
<error code="503" type="cancel">
<service-unavailable xmlns="urn:ietf:params:xml:ns:xmpp-stanzas">
</service-unavailable>
</error>
</iq>
I have gone through all the solutions I could find on the internet but could not find a satisfying solution
change urn:xmpp:archive to urn:xmpp:archive:auto
I had the same issue and determined this by running a discovery request: http://xmpp.org/extensions/xep-0136.html#disco
I sent this IQ:
<iq from='user#mydomain.com'
id='disco1'
to='mydomain.com'
type='get'>
<query xmlns='http://jabber.org/protocol/disco#info'/>
</iq>
My Openfire server with the Monitoring plugin enabled returned this result:
<iq xmlns="jabber:client" type="result" id="disco1" from="mydomain.com" to="user#mydomain.com/resource">
<query xmlns="http://jabber.org/protocol/disco#info">
<identity category="server" name="Openfire Server" type="im" />
<identity category="pubsub" type="pep" />
<feature var="http://jabber.org/protocol/pubsub#retrieve-default" />
<feature var="http://jabber.org/protocol/pubsub#purge-nodes" />
<feature var="vcard-temp" />
<feature var="http://jabber.org/protocol/pubsub#subscribe" />
<feature var="http://jabber.org/protocol/pubsub#subscription-options" />
<feature var="http://jabber.org/protocol/pubsub#create-nodes" />
<feature var="http://jabber.org/protocol/pubsub#outcast-affiliation" />
<feature var="msgoffline" />
<feature var="http://jabber.org/protocol/pubsub#get-pending" />
<feature var="http://jabber.org/protocol/pubsub#multi-subscribe" />
<feature var="http://jabber.org/protocol/pubsub#presence-notifications" />
<feature var="urn:xmpp:ping" />
<feature var="jabber:iq:register" />
<feature var="http://jabber.org/protocol/pubsub#delete-nodes" />
<feature var="http://jabber.org/protocol/pubsub#config-node" />
<feature var="urn:xmpp:archive:manage" />
<feature var="http://jabber.org/protocol/pubsub#retrieve-items" />
<feature var="http://jabber.org/protocol/pubsub#auto-create" />
<feature var="http://jabber.org/protocol/disco#items" />
<feature var="http://jabber.org/protocol/pubsub#item-ids" />
<feature var="http://jabber.org/protocol/pubsub#meta-data" />
<feature var="urn:xmpp:mam:0" />
<feature var="jabber:iq:roster" />
<feature var="http://jabber.org/protocol/pubsub#instant-nodes" />
<feature var="http://jabber.org/protocol/pubsub#modify-affiliations" />
<feature var="http://jabber.org/protocol/pubsub#persistent-items" />
<feature var="http://jabber.org/protocol/pubsub#create-and-configure" />
<feature var="http://jabber.org/protocol/pubsub" />
<feature var="http://jabber.org/protocol/pubsub#publisher-affiliation" />
<feature var="http://jabber.org/protocol/pubsub#access-open" />
<feature var="http://jabber.org/protocol/pubsub#retrieve-affiliations" />
<feature var="jabber:iq:version" />
<feature var="http://jabber.org/protocol/pubsub#retract-items" />
<feature var="urn:xmpp:time" />
<feature var="http://jabber.org/protocol/pubsub#manage-subscriptions" />
<feature var="jabber:iq:privacy" />
<feature var="jabber:iq:last" />
<feature var="http://jabber.org/protocol/commands" />
<feature var="http://jabber.org/protocol/offline" />
<feature var="urn:xmpp:carbons:2" />
<feature var="http://jabber.org/protocol/address" />
<feature var="http://jabber.org/protocol/pubsub#publish" />
<feature var="http://jabber.org/protocol/pubsub#collections" />
<feature var="http://jabber.org/protocol/pubsub#retrieve-subscriptions" />
<feature var="urn:xmpp:archive:auto" />
<feature var="http://jabber.org/protocol/disco#info" />
<feature var="jabber:iq:private" />
<feature var="http://jabber.org/protocol/rsm" />
</query>
</iq>
You can see that Automatic Archiving (urn:xmpp:archive:auto) and Archive Management (urn:xmpp:archive:manage) are supported, but Manual Archiving (urn:xmpp:archive:manual) and Archiving Preferences (urn:xmpp:archive:pref) are not.
XEP-0313 is also supported (listed as urn:xmpp:mam:0) and can retrieve archived messages: http://xmpp.org/extensions/xep-0313.html

Cordova Geolocation API not working IOS 8

Am developing a Jquery mobile application using cordova geolocation api.
Cordova : 3.6.3,
geolocation : cordova plugin add org.apache.cordova.geolocation (latest version),
jQuery Mobile : 1.4.4
Am getting exact current position using following code
navigator.geolocation.getCurrentPosition(drawMap,handleError, {
enableHighAccuracy: true,
maximumAge : 0,
timeout : 60000
});
Problem with watch position, its always trigger Unknown Error. The same code working fine in IOS-6
watchProcess = navigator.geolocation.watchPosition(handleSuccess,
handleError, {
enableHighAccuracy: true,
maximumAge : 0,
timeout : 60000
});
switch(error.code)
{
case error.PERMISSION_DENIED:
alert("User did not share geolocation data");
$(".ajax-loader").hide();
break;
case error.POSITION_UNAVAILABLE:
alert("Could not detect current position");
$(".ajax-loader").hide();
break;
case error.TIMEOUT:
alert("Retrieving position timed out, could not detect your location");
$(".ajax-loader").hide();
break;
default:
alert("Unknown Error"); // Always getting Unknown Error
$(".ajax-loader").hide();
break;
}
Tried adding following code in my platforms/ios/NavSustain/config.xml file but no luck
<gap:config-file platform="ios" parent="NSLocationAlwaysUsageDescription" overwrite="false"> <array> <string>Allow GPS</string> </array> </gap:config-file>
My config.xml file is
<?xml version='1.0' encoding='utf-8'?>
<widget id="com.navsustain.navsustain" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<preference name="AllowInlineMediaPlayback" value="false" />
<preference name="AutoHideSplashScreen" value="true" />
<preference name="BackupWebStorage" value="cloud" />
<preference name="DisallowOverscroll" value="false" />
<preference name="EnableViewportScale" value="false" />
<preference name="FadeSplashScreen" value="true" />
<preference name="FadeSplashScreenDuration" value=".25" />
<preference name="KeyboardDisplayRequiresUserAction" value="true" />
<preference name="MediaPlaybackRequiresUserAction" value="false" />
<preference name="ShowSplashScreenSpinner" value="true" />
<preference name="SuppressesIncrementalRendering" value="false" />
<preference name="TopActivityIndicator" value="gray" />
<preference name="GapBetweenPages" value="0" />
<preference name="PageLength" value="0" />
<preference name="PaginationBreakingMode" value="page" />
<preference name="PaginationMode" value="unpaginated" />
<feature name="LocalStorage">
<param name="ios-package" value="CDVLocalStorage" />
</feature>
<feature name="Geolocation">
<param name="ios-package" value="CDVLocation" />
</feature>
<name>NavSustain</name>
<description>
A sample Apache Cordova application that responds to the deviceready event.
</description>
<gap:config-file platform="ios" parent="NSLocationAlwaysUsageDescription" overwrite="false"> <array> <string>Allow GPS</string> </array> </gap:config-file>
<author email="dev#cordova.apache.org" href="http://cordova.io">
Apache Cordova Team
</author>
<content src="index.html" />
<access origin="*" />
<feature name="NetworkStatus">
<param name="ios-package" value="CDVConnection" />
</feature>
<feature name="Notification">
<param name="ios-package" value="CDVNotification" />
</feature>
<feature name="SplashScreen">
<param name="ios-package" value="CDVSplashScreen" />
<param name="onload" value="true" />
</feature>
</widget>
Your help is much appreciated. Thank you
Finally found the issue. I have update Xcode to latest version Xcode 6. Now its working fine.

navigator is not working inphonegap

Hello guys I got an issue with navigator in my previous app it was working but now it is not working i tried in many way but couldn't figure out the issue.
phonegap -v is 3.3.0-0.19.6
cordova -v is 3.3.1-0.4.2
for installing plugins i tried below types
cordova plugin add org.apache.cordova.camera
cordova plugin add org.apache.cordova.dialogs
Below is my config.xml file
<?xml version='1.0' encoding='utf-8'?>
<widget id="com.company.multipleScreen" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<name>Hello Cordova</name>
<preference name="AllowInlineMediaPlayback" value="false" />
<preference name="BackupWebStorage" value="cloud" />
<preference name="DisallowOverscroll" value="false" />
<preference name="EnableViewportScale" value="false" />
<preference name="KeyboardDisplayRequiresUserAction" value="true" />
<preference name="MediaPlaybackRequiresUserAction" value="false" />
<preference name="SuppressesIncrementalRendering" value="false" />
<preference name="TopActivityIndicator" value="gray" />
<preference name="GapBetweenPages" value="0" />
<preference name="PageLength" value="0" />
<preference name="PaginationBreakingMode" value="page" />
<preference name="PaginationMode" value="unpaginated" />
<feature name="LocalStorage">
<param name="ios-package" value="CDVLocalStorage" />
</feature>
<name>testing</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" />
<access origin="*" />
<feature name="Camera">
<param name="ios-package" value="CDVCamera" />
</feature>
<feature name="Media">
<param name="ios-package" value="CDVSound" />
</feature>
<feature name="File">
<param name="ios-package" value="CDVFile" />
<param name="onload" value="true" />
</feature>
<feature name="Capture">
<param name="ios-package" value="CDVCapture" />
</feature>
<feature name="Globalization">
<param name="ios-package" value="CDVGlobalization" />
</feature>
<feature name="Notification">
<param name="ios-package" value="CDVNotification" />
</feature>
The code i tried to implement for showing alert is
navigator.notification.alert("Unable to connect to server !");
and my other requirement is camera it is also not working
navigator.camera.getPicture(onSuccess, onFail, { quality: 50,
destinationType: Camera.DestinationType.FILE_URI });
function onSuccess(imageURI) {
var image = document.getElementById('myImage');
image.src = imageURI;
}
function onFail(message) {
alert('Failed because: ' + message);
}
In the current Cordova version 3.4.0 you have to manually install all plugins via cordova plugin add
So in your case, referring to https://github.com/apache/cordova-plugin-dialogs/blob/dev/doc/index.md, you need to do:
cordova plugin add org.apache.cordova.dialogs
I would recommend reading the documentation about plugins:
http://docs.phonegap.com/en/3.4.0/cordova_plugins_pluginapis.md.html#Plugin%20APIs
Issue is fixed by adding
cordova plugin add org.apache.cordova.device
cordova plugin add org.apache.cordova.console

Phonegap 3.0 Build inAppBrowser listeners not working

I hope someone can help me figure this out. This is my first Phonegap app, so this could be a fairly elementary mistake on my part. I'm specifically trying to get this to work on iOS. Android will wait until another day.
I'm trying to load a page from an external site (which I do control) using the inAppBrowser. After the user leaves the initial page, it should close and return them to the app. The page opens successfully, but I've tried everything I can think of to get it to close and return to the app, but to no avail.
The function using inAppBrowser looks like this:
function open_page() {
var ref = window.open('http://www.mydomain.com/page1.html', '_blank', 'location=yes,enableViewportScale=no');
ref.addEventListener('loadstop', function(event) { if(event.url != "http://www.mydomain.com/page1.html") ref.close(); });
ref.addEventListener('exit', function(event) { alert(event.type); });
}
I am using the cloud-based Phonegap Build, and my config.xml file looks like this:
<?xml version="1.0" encoding="UTF-8" ?>
<widget
...
<access origin="*" />
<preference name="phonegap-version" value="3.0.0" />
<preference name="orientation" value="portrait" />
<preference name="fullscreen" value="true" />
<preference name="stay-in-webview" value="true" />
<feature name="http://api.phonegap.com/1.0/battery"/>
<feature name="http://api.phonegap.com/1.0/camera"/>
<feature name="http://api.phonegap.com/1.0/contacts"/>
<feature name="http://api.phonegap.com/1.0/file"/>
<feature name="http://api.phonegap.com/1.0/geolocation"/>
<feature name="http://api.phonegap.com/1.0/media"/>
<feature name="http://api.phonegap.com/1.0/network"/>
<feature name="http://api.phonegap.com/1.0/notification"/>
<feature name="InAppBrowser">
<param name="ios-package" value="CDVInAppBrowser" />
</feature>
<gap:plugin name="org.apache.cordova.device" />
<gap:plugin name="org.apache.cordova.camera" />
<gap:plugin name="org.apache.cordova.device-orientation" />
<gap:plugin name="org.apache.cordova.file" />
<gap:plugin name="org.apache.cordova.globalization" />
<gap:plugin name="org.apache.cordova.inappbrowser" />
<gap:plugin name="org.apache.cordova.network-information" />
<gap:plugin name="org.apache.cordova.dialogs" />
<gap:plugin name="org.apache.cordova.splashscreen" />
<gap:plugin name="org.apache.cordova.core.geolocation" />
</widget>
Thanks in advance for all help!
Add this to your config file-
<access origin="*" browserOnly="true"/>
For open link in APP browser use following line, which open link in app browser.
And return back to your application when you closed it.
window.open('http://www.' + email, '_blank', 'location=yes');

Resources