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.
Related
I'm using Expo's iOS simulator with my React Native app. Before, it would live update / "fast refresh" when code changes were made, but it's no longer doing that. So this is not about using the Expo Go app on my phone, but rather the Simulator on my Macbook.
I've checked the shake (ctrl + cmd + Z) menu, and Fast Refresh is still enabled. Running npx expo run:ios does correctly reflect the latest code, but that takes a while to run.
Any help to debug this?
A few days ago the same thing happened to me and it depended on how I exported the main component to App.tsx.
This one doesn't work properly:
export default () => {
return <View/>
}
This one works:
const App = () => {
return <View/>
}
export default App
Let me know if this helps
I use Telerik-AppleWatch plugin for cordova.
i followed the instructions and i copied the simplified example from the project.
when i run the project the Built successfully but on the iwatch i see just the name of the app and blank screen.
I didn't receive error on the console.
i use xcode. target is- 8.2
There is not much information on the internet about it
function initAppleWatch() {
applewatch.init(function () {
alert("init");
onAppRequestsUpdate();
onGlanceRequestsUpdate();
});
applewatch.callback.onLoadAppMainRequest = onAppRequestsUpdate;
applewatch.callback.onLoadGlanceRequest = onGlanceRequestsUpdate;
}
can anybody know what can i do?
I work on it all week without success
thanks!:)
Our Ionic 2 mobile app was rejected by apple because of the following reason:
We noticed that the user is taken to Safari to sign in or register for an account, which provides a poor user experience.
Please revise your app to enable users to sign in or register for an account in the app.
The Auth0 Lock provides the user with a sign up button that we configured through the signUpLink option of the Lock. This button opens a registration page in the system browser (Safari) outside of the application, which apparently isn't acceptable for Apple.
Before we upgraded to the latest version of Ionic 2 (Ionic 2 beta 11), the lock would open the link in the InAppBrowser, which is acceptable for Apple. Because of the difference in Ionic 2 version, I imagine this could be an Ionic issue.
I made sure I had the Cordova InAppBrowser plugin installed. It's present in my config.xml as <plugin name="cordova-plugin-inappbrowser" spec="~1.6.1" /> and when I open the .xcproject file in XCode, the plugin is present in the Plugins folder. I have also tested using the InAppBrowser manually using open('https://www.google.com/, '_blank'); which opened the InAppBrowser as it should.
Neither the code regarding the Auth0 Lock, nor the URL to the registration page changed.
Auth0 Lock version: 10.6 (have also tried on 10.11, didn't solve the issue)
Ionic version: 2.1.0
OS: iOS
What could've changed since the Ionic 2 beta 11 that would affect opening the link in the InAppBrowser?
I have come up with a dirty temporary workaround by adding an onclick attribute to the button that opens the link in the window.open function:
this.lock.on('show', () => {
let parent: Element = undefined;
let intervalIndex = 0;
let interval = setInterval(() => {
parent = document.getElementsByClassName('auth0-lock-tabs')[0];
if (parent) {
let item = parent.children.item(1).children.item(0);
item.setAttribute('onclick', `window.open('${AppSettings.registrationUrl}', '_blank'); return false;`);
item.removeAttribute('href');
clearInterval(interval);
}
if (intervalIndex == 20)
clearInterval(interval);
intervalIndex++;
}, 500);
});
With this modification, the sign up link opens in the InAppBrowser and therefore doesn't violate Apple's terms anymore.
Note: this is not a good answer to this problem and is not a guaranteed fix as there is a delay on configuring this onclick attribute on the button.
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).
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.