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 imagepicker is closed and upload process is supposed to start #51

Closed
felixkrautschuk opened this issue Feb 7, 2017 · 5 comments
Labels

Comments

@felixkrautschuk
Copy link

felixkrautschuk commented Feb 7, 2017

Hello,

I am trying to upload an image within a NativeScript app using

  • NativeScript 2.5.0
  • nativescript-imagepicker 2.4.0 (not able to build for iOS with 2.4.1)
  • nativescript-background-http 2.4.2 and also tried 2.5.1
  • Telerik AppBuilder 3.6.7
  • iPhone 4S with iOS 8.4.1

Everything seems to work fine on Android, but I have some trouble on iOS.
When I select an image from the picker and I press the 'done' Button, the image is supposed to be uploaded, but the app freezes and I only get the following log output in the Telerik AppBuilder CLI:

<Warning>: Logging crash types: 47
: assertion failed: 12H321: libxpc.dylib + 51867 [3C761F5E-F2FD-315B-895A-4054CAE2232E]: 0x7d
: CONSOLE LOG file:///app/tns_modules/tns-core-modules/globals/globals.js:119:20: Border is deprecated
: +[TNSRuntime _getCurrentStack]: unrecognized selector sent to class 0xce9670

I created a sample app, that you can access here:
https://github.com/felix-idf/ImageUploadIssue

I hope it helps you to reproduce my problems, as I am not able to give you more log infos.
In this sample app, I just use a dummy URL for the image upload, because you would need to get VPN access to run our real app.
The crash on iOS already happens when the actual upload process is supposed to begin. So when I uncomment the line ...
task = session.uploadFile(fileUri, request);
... the iOS app does not crash. In this case, the image picker is getting closed and the app just navigates to the initial page. So there seems to be no problem with the image-picker plugin.

Maybe it is just my fault all the time, but the whole image upload process seems to work fine for me on Android.

A am grateful for any advice.

Best regards,
Felix

@felixkrautschuk felixkrautschuk changed the title iOS app crashes when iOS app crashes when imagepicker is closed and upload process is supposed to start Feb 7, 2017
@tsonevn
Copy link
Contributor

tsonevn commented Feb 9, 2017

Hi @felix-idf ,
thank you for your sample project.

I tested the project on my side, however, I was unable to reproduce this behavior. I also noticed that you are using old versions of nativescript-background-http and nativescript-imagepicker.
Could you update nativescript-background-http to 2.5.1 and nativescript-imagepicker to 2.4.1.
Before rebuilding your app, you should also delete node_modules, platforms, hooks folder. Then run tns run ios.

Let me know, whether the given suggestion helps.

@felixkrautschuk
Copy link
Author

felixkrautschuk commented Feb 9, 2017

Hi @tsonevn ,
thank you for your response.

I added the latest background-http 2.5.1.
I tried to upgrade the imagepicker-plugin to 2.4.1, but the build fails for iOS. I created a seperate issue here:
https://github.com/NativeScript/nativescript-imagepicker/issues/69

I added the following points that describe my testing environment and maybe they are important and helpful:

  • Telerik AppBuilder 3.6.7
  • iPhone 4S with iOS 8.4.1

I recorded the whole procedure from opening the imagepicker to start the upload process by selecting one image (which makes the app freezing).
giphy

When I select an image and press 'Done', the app freezes and I get the log output, that I mentioned in my first post here.

+[TNSRuntime _getCurrentStack]: unrecognized selector sent to class 0xce9670

I really don't understand why this seems to work for you with my provided sample code. I also tried previous versions of the background-http plugin and also with previous NativeScript versions and the imagepicker plugin.. It never worked on iOS for me.

@tsonevn
Copy link
Contributor

tsonevn commented Feb 13, 2017

Hi @felix-idf ,

This problem seems to be related only to nativescritp-imagepicker plugin. I will close this issue and will provide more info about your problem on the other one, which has been logged in nativescritp-imagepicker repo.

Regards,
@tsonevn

@tsonevn tsonevn closed this as completed Feb 13, 2017
@felixkrautschuk
Copy link
Author

Hi @tsonevn ,

you have already closed this issue, but nonetheless I want to say that I can agree.
The problem was just caused by the way I am getting the image from the picker.
Probably, my code was based on an older sample code of the image-picker and background-http plugin.
The upload works fine now for Android and iOS using imagepicker 2.4.0 and the latest background-http plugin (2.5.1). I Still have some trouble building the app with the latest imagepicker plugin, but that seems to be related to the AppBuilder, so it is another topic.

Thanks again.

@tsonevn
Copy link
Contributor

tsonevn commented Feb 27, 2017

Hi @felix-idf,
In my further research, I found that this behavior could be related due to a problem with installation one of the plugin's dependencies.
nativescript-imagepicker plugin uses nativescirpt-telerik-ui and its RadListView component to display the images from the gallery.

While adding nativescript-imagepicker version 2.5.1, nativescirpt-telerik-ui has not been installed properly, which could cause this issue.

To fix this, you could add nativescript-imagepicker manually with appbuilder plugin add nativescript-telerik-ui to add again the latest available version of nativescript-imagepicker version 2.5.1. then try to rebuild the app.

package.json

{
  "dependencies": {
    "nativescript-imagepicker": "2.5.1",
    "nativescript-telerik-ui": "1.6.1",
    "tns-core-modules": "2.5.0"
  },
  "devDependencies": {}
}

Hope this helps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants