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

Often the app would show "App restart required..." error and would quit after user hits "OK" #9

Open
vitalii-tym opened this issue Apr 15, 2020 · 3 comments

Comments

@vitalii-tym
Copy link

vitalii-tym commented Apr 15, 2020

CBCEntralManager initially starts with state uknown and then changes to poweredOn in a moment. But the app happens to check the manager's state and shows an alert just before the state changes. This results in user getting this false error message (and sometimes two of them):

Screen Shot 2020-04-15 at 23 36 58

Since the error has exit(0) command under the OK button, the app would be halted instantly. So that user has no chance to get the app up and running.

Also the exit(0) command mentioned above is forbidden is having it in the app would result app being rejected by Apple.

Notes: the above behavior is for "release" configuration, in "debug" configuration the error message is a little different and there is no exit(0) command. But the false error still appears.

Expected: since there are already some UI elements inside the app indicating about bluetooth problems (if any) the error can be completely removed.

@gibtang
Copy link

gibtang commented Apr 16, 2020

Switching off Bluetooth triggers this error message too and then tapping the button in the modal will close the app. App HIG seems to discourage this type of behaviour. https://gamedev.stackexchange.com/questions/17709/can-an-ios-application-have-an-explicit-quit-button

The better option is to have a button that opens the Settings > Bluetooth screen. I can submit a PR for this if you are ok with merging my PR

@hongshaoyang
Copy link

hongshaoyang commented May 9, 2020

The alert shown in the screenshot above is from this:

#if RELEASE
let alert = UIAlertController(title: "App restart required for Bluetooth to restart!", message: "Press Ok to exit the app!", preferredStyle: .alert)
alert.addAction(UIAlertAction(title: "Ok", style: .default, handler: { (_) in
exit(0)
}))

@gibtang
Copy link

gibtang commented May 9, 2020

Yup, users should not be allowed to kill any app using programmatic means as mentioned by Apple. Better way is to switch to the BT settings to let use enable BT. And if BT is still not enabled, then popup alert nagging user to switch it on

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

3 participants