Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ios:App crashes when opening a file #242

Closed
wenjianli92 opened this issue Dec 21, 2018 · 10 comments
Closed

ios:App crashes when opening a file #242

wenjianli92 opened this issue Dec 21, 2018 · 10 comments

Comments

@wenjianli92
Copy link

I am using the latest 2.1.2 version
I use ionic, ionic info:

App crashes when opening a file using the open method, at iphone 6 plus and ipad
ios:12.1

Uploading image.png…

@wenjianli92
Copy link
Author

image

@wenjianli92
Copy link
Author

image
Display the above error in xcode

@shnist
Copy link
Collaborator

shnist commented Dec 21, 2018

hi @wenjianli92, thanks for raising this issue. There was some worked that was merged in recently that seems to be causing a lot of problems now. I forgot it was there when I published the patched version. I'm going to remove it from the master branch for now and release a new patch version today.

@shnist
Copy link
Collaborator

shnist commented Dec 21, 2018

patch 2.1.4 has been released which fixes this crash. 2.1.2 has been deprecated. Can you try updating to the latest to check the issue has been fixed for you?

@wenjianli92
Copy link
Author

Thank you for your efforts, now I am going to update to 2.1.4 to try

@wenjianli92
Copy link
Author

@shnist Still can't, reported the following error
image

@shnist
Copy link
Collaborator

shnist commented Dec 21, 2018

hi @wenjianli92, interesting. I could reproduce the crash in 2.0.12, but it was fixed for me in 2.0.14. Can you show me the output of cordova info and a code snippet from your application if able?

@wenjianli92
Copy link
Author

hi @shnist, Sorry, I stopped this job for some reason ,I use ionic ,Ionic information is as follows:
image

I am using a third-party plugin to do the function of sending and receiving files in a chat session, and using one of its APIs to perform the download. After the download is successful, it will return a path(“this.fileurl” in the code below).

console.log(this.fileurl,mymimetype,'=====================fileurl,mymimetype,63');
await this.fileOpener.open(this.fileurl,mymimetype);

The xcode output is as follows:

image

The file path starts with '/var/mobile'. Is this wrong? Then how can I get the correct file path?

@wenjianli92
Copy link
Author

This problem is caused by the wrong path:

let localentry: Entry = await this.file.resolveLocalFilesystemUrl('file://'+this.fileurl);
let fileEntry = localentry as FileEntry;
fileEntry.file((myfile)=>{
if(this.nativeService.isIos()){
this.fileOpener.open(localentry.nativeURL,myfile.type);
}
},(err)=>{
console.error(err);
});

@shnist
Copy link
Collaborator

shnist commented Dec 31, 2018

hi @wenjianli92, glad to hear you were able to resolve your issue.

@shnist shnist closed this as completed Dec 31, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants