I have a phonegap application that crashes on iPhone6 with iOS 8 (It works fine on iPhone6+) when calling phonegaps contacts.find method. This only happens with the 'photos' filter. When it gets to this part of the code, the app immediately crashes. I remove the photos filter, and everything works fine.
Here is the code that I am using:
navigator.contacts.find(['name', 'phoneNumbers', 'photos'], function (contacts){ }, function (error) { }, options);
I am using the latest version of phonegap.
Any help would be greatly appreciated.
Related
I'm creating Ionic Angular app and I have some functionality which should allow user to take picture. Android app works completely fine but iOS crashes while taking picture. So to add photo you have to click button in app, then if it is first time you will se permissions modal to accept camera permissions and then prompt is shown with 2 options: take photo or from gallery. I choose to take photo so I'm taking it but after clicking camera button to take photo it just crashes and kills my app.
I have all needed permissions in Info.plists: NSCameraUsageDescription, NSPhotoLibraryUsageDescription, NSPhotoLibraryAddUsageDescription
This is how code looks like:
handleAddPhoto = async () => {
if (this.canAddPhoto()) {
const image = await Camera.getPhoto({
quality: 30,
allowEditing: false,
saveToGallery: false,
resultType: CameraResultType.Base64,
source: CameraSource.Prompt,
presentationStyle: 'popover',
});
this.addedImages.find(el => el.src === null).src = this.sanitizeSrc(image.base64String);
this.handleSavePhoto(['data:image/jpeg;base64,' + image.base64String]);
}
};
Capacitor doctor:
Latest Dependencies:
#capacitor/cli: 4.6.1
#capacitor/core: 4.6.1
#capacitor/android: 4.6.1
#capacitor/ios: 4.6.1
Installed Dependencies:
#capacitor/cli: 4.6.1
#capacitor/core: 4.6.1
#capacitor/ios: 4.6.1
#capacitor/android: 4.6.1
[success] iOS looking great! 👌
Capacitor camera version:
"#capacitor/camera": "^4.1.4"
When I have app opened on my phone with Xcode then after taking picture my Xcode shows me this:
I was looking everywhere to find any help with my problem but none of found solutions works for me.
So after some debugging in native code I found it. We use UXCam in our app and it was making mess with camera. As I found some logs it looks like UXCam wanted to record screen during returning from camera view to app view and it was making mess. I didn't find option to repair it because we don't need UXCam that much, so disabling UXCam fixed all issues.
here in this code none of the state inside if condition is working on ios but its working on android phones. I am using expo go app for working ios/android.
ProfileService.getDashboardInfo(res,0).then(res=>{
if(res?.success){
setloading(false)
setdashboardInfo(res?.data)
setCount(res?.data?.pendingJobs)
}
})
any kind of suggestions will be appreciated.
I am using two plugins (cordova-plugin-auth-dialog & cordova-inappbrowser) to realize the login process for my cordova ios app.
The login itself is working really fine on the iPhone, but on the iPad it is causing a long UI freeze (CPU usage at 99% for about 1minute). It must be caused by the login, since the app is working whenever you are logged in.
In Xcode I can see also the famous
THREAD WARNING: ['InAppBrowser'] took '52.126953' ms. Plugin should use a background thread.
warning. Is this really significant ?
I am using the latest version of cordova and the version 4.1.0 of the ios platform.
Do you guys have any tips for me ? I also would really like to have some approaches to debug the issue with some external tools (Safari Debugger, does not really have any useful information for me there).
Thanks in advance !
EDIT : Added Code
authDialog.authenticate(URL_TO_LOGIN, function () {
console.log("success");
var inAppBrowserRef = cordova.InAppBrowser.open(URL_TO_LOGIN, '_blank', 'location=yes,hidden=yes');
inAppBrowserRef.addEventListener('loadstart', loadStartCallBack);
inAppBrowserRef.addEventListener('loadstop', loadStopCallBack);
inAppBrowserRef.addEventListener('loaderror', loadErrorCallBack);
defer.resolve();
}, function (error) {
console.log("error xxx:", error);
defer.resolve();
}, username, password);
The following snippet might help you.
setTimeout(function(){
_self.openUrl(url) },300);
we have migrated a worklight 6.1 application t IBM mobilefirst 7.0 platform and all the functionalities working as expected on the android environment, but in ios we are facing an issue: there is a function called "quick receipt". on click on a button the device camera opens and a photo is taken. The problem is that the photo is not displaying - it returns complete blank page this issue on ios device only but not on Android device.
Camera.DestinationType.FILE_URI is not working on IOS.
for security reason we wont share the code. here is similar prototype code.
html
<div><img alt="QuickReceipts" src="resources/img/camera.png" onclick="imgCapture();"</div>
JavaScript
imgCapture: function (){
navigator.camera.getPicture(this.onSuccess, this.onFail,{quality:80,destinationType:Camera.DestinationType.FILE_URI, targetWidth:600,targetHeight:1050}
},
onSuccess:function(imgData)
{
// applying the css and displaying the img
$("#imgReceipt").attr("src","data:image/jpeg;base64," +imgData);
$("#imgReceipt").css("display", "block");
}
onFail:function(imgData){
// failure msg
}
One suggestion is to attempt to code change as mentioned by Nazmul: http://www.telerik.com/forums/ios-cordova-3-5-0-camera-getpicture-targetwidth-issue.
Another suggestion is to upgrade to the latest 7.1 iFix from IBM Fix Central which contains several Cordova corrections and may address your issue.
If your issue is not resolved still, I suggest to open an IBM PMR (support ticket).
Using phonegap 3.1.0, Xcode 5.1.0, and iPad 2 with iOS 7.0.1
I am writing a app for iPad and Im having some issues that seems very inconsistent in illogical.
The app works fine in the simulator
The app does not work on the device
The app starts working on the device once I remove the line localStorage: new Backbone.LocalStorage 'foo'
This is the example Collection
class Channel extends Backbone.Model
idAttribute: "ChannelID"
class Channels extends Backbone.Collection
idAttribute:"ChannelID"
initialize: =>
#model = Channel
localStorage: new Backbone.LocalStorage 'fc.channels'
As soon as I remove the localStorage line, it works. this happens only on the device, it works as exspected in the simulator, its as if the device is slow or something and does not load everything, allthough the deviceready is triggered
console.log Backbone.LocalStorage does not return anything
UPDATE:
I found that backbone.localStorage-min.js is not loaded on the device! WHY!!! At least now I know why its not working, but why the file is not loaded who knows!
UPDATE 2:
I got it working by changing the name of the backbone.localStorage-min.js to something else like backbonelocalstorage.js
This is the most ridicules thing I have ever come across!