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

Crashes on iOS 14.4 when selecting 'Cancel' or 'Done' #83

Open
enich-dev opened this issue Apr 15, 2021 · 10 comments · May be fixed by #85
Open

Crashes on iOS 14.4 when selecting 'Cancel' or 'Done' #83

enich-dev opened this issue Apr 15, 2021 · 10 comments · May be fixed by #85

Comments

@enich-dev
Copy link

enich-dev commented Apr 15, 2021

Make sure to check the demo app(s) for sample usage


Issue occurs on the sample app and my app.


Make sure to check the existing issues in this repository


Checked.


If the demo apps cannot help and there is no issue for your problem, tell us about it

Please, ensure your title is less than 63 characters long and starts with a capital
letter.

This occurred after upgrading from NS6 to NS7. Crash occurring on iOS intermittently (about 50% of the time) after selecting either 'Cancel' or 'Done' on the datepicker, regardless of PickerOptions or the date selected. If the crash does not occur then it will not occur until the app is closed, reopened, and you try again.


Which platform(s) does your issue occur on?

  • iOS/Android/Both
  • iOS/Android versions
  • emulator or device. What type of device?

Real device and emulator - iOS 14.4.


Please, provide the following version numbers that your issue occurs with:

  • CLI: (run tns --version to fetch it)
  • Cross-platform modules: (check the 'version' attribute in the
    node_modules/@nativescript/core/package.json file in your project)
  • Runtime(s): (look for the "tns-android" and "tns-ios" properties in the package.json file of your project)
  • Plugin(s): (look for the version numbers in the package.json file of your
    project and paste your dependencies and devDependencies here)

dependencies:
"@nativescript/appversion": "2.0.0",
"@nativescript/core": "7.3.0",
"@nativescript/webpack": "4.1.0",
"moment": "2.29.1",
"moment-timezone": "0.5.33",
"nativescript-modal-datetimepicker": "2.1.5", <-- (I tried lower versions as well, like 2.0.1)
devDependencies:
"@nativescript/android": "7.0.1",
"@nativescript/ios": "7.2.0",

CLI: 7.2.1

Please, tell us how to recreate the issue in as much detail as possible.

Describe the steps to reproduce it.

  1. Open the sample app
  2. Tap 'Pick a Date'
  3. Tap 'Cancel' or 'Done'
  4. If the issue does not occur, close the app completely and go to step 1

Is there any code involved?

  • provide a code example to recreate the problem
  • (EVEN BETTER) provide a .zip with application or refer to a repository with application where the problem is reproducible.
@enich-dev
Copy link
Author

@davecoffin Any help would be appreciated as this will heavily impact our app. Thank you.

@pandabuilt
Copy link

pandabuilt commented Apr 21, 2021

Do you have a catch block in your code? like .catch( after .then? I removed it and no longer having the crashing error.

@pandabuilt
Copy link

@enich-dev did this work for you?

@justintoth
Copy link

justintoth commented Apr 24, 2021

I tried @pandabuilt's suggestion and it didn't work, the app still crashes when tapping the Done button on the date picker modal even when the catch block is removed. Here is the code:

export function showDatePicker(title: string, value: Date): Promise<Date> {
    const picker = new ModalDatetimepicker();
    return picker
        .pickDate({
            title: title,
            theme: 'light',
            startingDate: value
        })
        .then(result => {
            console.log('in then, result: ', result);
            return result ?
                new Date(result.year, result.month - 1, result.day) : null;
        });
}

Interestingly, it doesn't make it into the then or catch functions when it crashes, nor does it show any errors in the logs. It simply quits the app. Then if I reopen the app, the date picker works fine. Forcing a rebuild of my app causes it to error again when I tap the Done button in the date picker modal.

Some observations that I had that contradict others' experiences in this ticket:

  1. I can observe this error only when tapping the Done button. Tapping the Cancel button works fine for me every time.
  2. I can reproduce this error not just on iOS 14.4 but also iOS 13.2, so it doesn't seem to be specific to 14.4.
  3. It works fine on Android, no crashes.

Was anyone able to get past this error?

@pandabuilt
Copy link

Nevermind, I stand corrected. It's reopening the app that works not my removal of the catch block.

@AquilesOliveiraDev
Copy link

i have the same error...

@enich-dev
Copy link
Author

Hey all, unfortunately my team and I did not have time to dig into this further and we decided to use NativeScript's own datetimepicker that can be found here. In doing so, we are no longer seeing crashes. I hope this will help others as well. Thanks.

@Archez Archez linked a pull request Apr 29, 2021 that will close this issue
@cristiandaulisio
Copy link

i have the same problem.

@justintoth
Copy link

@Atomico001 As @enich-dev suggested, switch to NativeScript's datetimepicker. It works much better.

@cristiandaulisio
Copy link

@Atomico001 As @enich-dev suggested, switch to NativeScript's datetimepicker. It works much better.

Thanks you, i have a problem... other plugin ask me the "context", i tried application context but doesn't work.. any idea?

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

Successfully merging a pull request may close this issue.

5 participants