transistorsoft / react-native-background-geolocation

Sophisticated, battery-conscious background-geolocation with motion-detection
http://shop.transistorsoft.com/pages/react-native-background-geolocation
MIT License
2.63k stars 426 forks source link

The iOS app keep crashing after integrate which follow the docs while android is working fine. #1696

Closed socheatleang closed 1 year ago

socheatleang commented 1 year ago

Your Environment


## Expected Behavior
Should run the iOS app successfully

## Actual Behavior
The app keep crashing when open with log below

Error: Problems validating fields in app.json. Learn more: https://docs.expo.dev/workflow/configuration/ • Field: ios - should NOT have additional property 'UIBackgroundModes'. • Field: ios - should NOT have additional property 'BGTaskSchedulerPermittedIdentifiers'. Error: Problems validating fields in app.json. Learn more: https://docs.expo.dev/workflow/configuration/ • Field: ios - should NOT have additional property 'UIBackgroundModes'. • Field: ios - should NOT have additional property 'BGTaskSchedulerPermittedIdentifiers'.


## Steps to Reproduce
<!--- reproduce this issue; include code to reproduce, if relevant -->
expo start --dev-client

## Context
<!--- What were you trying to do? -->
I have tried to do the eas build with cache clean. I still got the same issue
## Debug logs
<!-- include iOS / Android logs
- ios XCode logs,
- use #getLog #emailLog methods (@see docs)
- Android: $ adb logcat -s TSLocationManager
-->
<details><summary>Logs</summary>

``` <!-- Syntax highlighting:  DO NOT REMOVE -->
PASTE_YOUR_LOGS_HERE

christocracy commented 1 year ago

Isn’t the infoPlist key supposed to be contained within the ios: {…} object?

socheatleang commented 1 year ago

Nope. InfoPlist suppose to be inside iOS object.

christocracy commented 1 year ago

Nope. InfoPlist suppose to be inside iOS object.

that's exactly what I said.

Have you googled this error? It seems common.

socheatleang commented 1 year ago

Nope. InfoPlist suppose to be inside iOS object.

that's exactly what I said.

Have you googled this error? It seems common.

Yeah, I have tried. But it seems like there is no best solution for it.

christocracy commented 1 year ago

Dude...you didn't put UIBackgroundModes and BGTaskSchedulerPermittedIdentifiers in infoPlist section!

You did this:

infoPlist: {
  .
  .
  .
},
entitlements: {
  'com.apple.developer.healthkit': true,
  'com.apple.developer.healthkit.background-delivery': true,
},
UIBackgroundModes: ['location', 'fetch', 'processing', 'audio'],
BGTaskSchedulerPermittedIdentifiers: [
  'com.transistorsoft.fetch',
  'com.transistorsoft.customtask',
],

The Setup Instructions instruct you place them in the infoPlist section:

Screenshot 2023-06-04 at 10 18 20 PM
christocracy commented 1 year ago

These are Info.plist keys, that are ultimately poked into the iOS Info.plist file, so of course they must exist within the infoPlist section of your app.json.

Screenshot 2023-06-04 at 10 22 30 PM
socheatleang commented 1 year ago

Thanks @christocracy

socheatleang commented 1 year ago

@christocracy .

I have no luck to make it work by following ur suggestion.

I still meet the same issue.

And it won't display this any more:

Error: Problems validating fields in app.json. Learn more: https://docs.expo.dev/workflow/configuration/
 • Field: ios - should NOT have additional property 'UIBackgroundModes'.
 • Field: ios - should NOT have additional property 'BGTaskSchedulerPermittedIdentifiers'.
Error: Problems validating fields in app.json. Learn more: https://docs.expo.dev/workflow/configuration/
 • Field: ios - should NOT have additional property 'UIBackgroundModes'.
 • Field: ios - should NOT have additional property 'BGTaskSchedulerPermittedIdentifiers'.
christocracy commented 1 year ago

I still meet the same issue.

And it won't display this any more:

If “it” doesn’t display “this” anymore, then you don’t have the “same issue”.

I suggest you first practice and learn to use the plug-in within a simple “hello world” app before trying to integrate into your app.