Ionic app crashes in iPhone 5 but not on the emulator - ios

I'm testing my app with iPhone5 and suddenly with my new build , facebook login stopped working. (I'm using $cordovaOauth.facebook). It works in the iOS emulator by connecting to the same public web API.
My question is, how do you normally check the error logs when it crashes on the actual phone?
I'm using ubertesters to create my .ipa file. They have an SDK as well, but I couldn't get it running in my Ionic app. it gives the following error
Uncaught ReferenceError: cordova is not defined
I have setup the script as they say in the article.
<script src="js/ng-cordova.min.js"></script>
<script src="cordova.js"></script>
<script src="js/app.js"></script>
<script src="js/ubertesters.js"></script>
I would appreciate if someone can tell me how to debug a situation like this (it works in the iOS emulator).

Please try to add type="text/javascript" to each line of your script. See the example below:
<script type="text/javascript" src="js/ubertesters.js"></script>
This should solve the issue with Ubertesters SDK integration.

Related

Error while running code in iOS, Getting Ionic HTTP Failure in Response

I developed my application in ionic 3 and my back-end is PHP PDO , my app is working perfectly in Android and all the web services are getting called perfectly.
I have imported my code in Mac Book and generated in Xcode. when I run that code in simulator API are not getting called and shows error as HTTP failure Response from unknown URL 0 Unknown Error.
I have already added white list Plugin in iOS
I have already added CSP in my index.html file
API are getting called in Safari Browser perfectly but not in simulator and real device.
Any help is appreciated.
I have Degraded ionic web view for ios and that worked for me.

Ionic/Cordova plugins doesn't work iOS

I'm developing a mobile app both for iOS and Android, I didn't have any issues on android. But in iOS I encountered a problem when using plugins. Plugins I used were cordova-file-transfer and social sharing by EddyVerbruggen. Both plugins worked perfectly when I created my android app, but both got an issue when I did it in iOS. Both plugin only works after I restart the app. Why is that? I tried surrounding the code with $ionicPlatform.ready and device.ready but didn't help. What am I missing?
Here's a sample sequence code:
$scope.myButton = function(){
//I also tried surrounding this with
//document.addEventListener("deviceready", myfunction, false)
$ionicPlatform.ready(function(){
//mycode here that uses the plugin ex. ($cordovaFileTransfer.download)
});
}

Integrating Ruby on Rails 4 app with Phonegap to build a native iOS app

I have created a ruby on rails responsive web application, I wanted to try and use this code to develop a native iOS app and possibly an android app using Phonegap. I followed this tutorial https://www.youtube.com/watch?v=LjIKElAP6_A in an attempt to use my app on my iPhone. When I follow the tutorial and run the app on my iPhone I just get a blank screen.
I used the following commands to set up my phone gap app:
phonegap create myappios com.testrails.myappios Myiosapp
phonegap platform add ios
cordova plugin add org.apache.cordova.console
cordova plugin add cordova-plugin-device
I then used the following code in my index.html file within the phone gap app:
<html>
<head>
<script src="http://code.jquery.com/jquery-1.6.4.min.js"></script>
<script type="text/javascript">
function onBodyLoad()
{
document.addEventListener("deviceready", onDeviceReady, false);
window.location.href = " http://localhost:3000/"
}
function onDeviceReady
{
//do your thing
}
</script>
<script type="text/javascript" charset="utf-8" src="phonegap-1.3.0.js"></script>
</head>
<body onload="onBodyLoad()">
</body>
</html>
Followed by the command: phonegap build iOS.
I just get a blank screen when the app is opened on my phone. I think the tutorial I followed is outdated, or maybe I have done something wrong. Can anybody see any blatant errors above?
I have also looked into using Sencha and appcelerator but I'm not really sure what my best option here is.
I watched the video as well. I believe you need to execute phonegap build ios (all lowercase ios) and then your build will render content, vs a blank screen.

Ionic unable to load App ID or API Key

I have an existing app that I am trying to add push notifications to. After following through Ionic's own tutorials on adding it, I'm stuck with the app reporting:
CORE: Unable to load app ID or API key, falling back to $ionicApp.getApp()...
I've been Googling around trying to find an answer with no luck. In the main app.js I have added ionic.service.core, ngCordova, and ionic.service.push, as well as the config code block with the ids filled in:
.config(['$ionicAppProvider', function($ionicAppProvider) {
$ionicAppProvider.identify({
app_id: 'APP_ID',
api_key: 'API_KEY'
});
}])
In index.html I have added all the needed resources, particularly:
<script src="lib/ionic-service-core/ionic-core.js"></script>
<script src="lib/ionic-service-push/ionic-push.js"></script>
<script src="lib/ngCordova/dist/ng-cordova.js"></script>
I have run ionic config build, ionic prepare ios, ionic build ios, ionic config set dev_push true repeatedly with no luck.
What am I missing?

iOS notification.alert() not working using Phonegap 2.3.0

I have a strange issue when attempting to use navigator.notification.alert() in Xcode 4.6 using Phonegap 2.3.0.
I have two files, index.html and other.html. Clicking 'Test the alert' from index.html triggers the alert as expected, however after dismissing the alert and then navigating to other.html, clicking 'Test the other alert' does not trigger the alert.
However, if you click 'Test the alert' two or more times on index.html before moving to the other.html, the alert will continue to function as expected. It's only after triggering the alert ONCE and changing pages that the alerts stop functioning all together.
index.html
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="cordova-2.3.0.js"></script>
<script type="text/javascript" charset="utf-8">
function alertTest() {
navigator.notification.alert('Testing', null, 'Alert Test', 'OK');
}
</script>
</head>
<body>
<a href='other.html'>Move to other page</a>
Test the alert
</body>
</html>
other.html
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="cordova-2.3.0.js"></script>
<script type="text/javascript" charset="utf-8">
function alertTest() {
navigator.notification.alert('Testing', null, 'Alert Test', 'OK');
}
</script>
</head>
<body>
Go back
Test the alert
</body>
</html>
I am at a complete loss as to why this happens, as in my app I need to be able to trigger alerts on button presses on different pages, which is seemingly hit-and-miss in this example.
Any help or nudge in the right direction is greatly appreciated!!
UPDATE:
This seems to only happen with iOS 6 and 6.1 simulators. When alerts don't pop up, pressing the home key and then opening the app again makes the missing alerts appear all at once.
This example also has the same behaviour: http://docs.phonegap.com/en/2.3.0/cordova_notification_notification.md.html#Notification
Can anyone confirm if this is just a simulator bug in the latest Xcode?
This problem exists since Phonegap 2.2 also see:
Notification in PhoneGap for iOS
Same problem on WindowsMobile on Phonegap 2.3.
I didn't update from 2.1 ... seems to be the last version where it worked properly.
Don't forget to add document.addEventlistener("deviceready", onDeviceReady, true); above.
Update to latest version of phonegap (2.4.0). Seems to resolve the problem. At least for me everything works normally now.

Resources