eddieowens / react-native-boundary

Native implementation of geofencing/region monitoring
Apache License 2.0
121 stars 72 forks source link

crash when event fire on iOS #36

Closed songoten28 closed 5 years ago

songoten28 commented 5 years ago
  Binaries:
    Node: 11.13.0 - /usr/local/bin/node
    Yarn: 1.12.3 - /usr/local/bin/yarn
    npm: 6.7.0 - /usr/local/bin/npm
    Watchman: 4.9.0 - /usr/local/bin/watchman
  SDKs:
    iOS SDK:
      Platforms: iOS 12.2, macOS 10.14, tvOS 12.2, watchOS 5.2
    Android SDK:
      API Levels: 26, 28, 29
      Build Tools: 27.0.3, 28.0.2, 28.0.3, 29.0.0
      System Images: android-26 | Intel x86 Atom, android-26 | Intel x86 Atom_64, android-28 | Intel x86 Atom, android-28 | Intel x86 Atom_64, android-28 | Google APIs Intel x86 Atom, android-29 | Intel x86 Atom, android-29 | Intel x86 Atom_64
      Android NDK: 20.0.5594570
  IDEs:
    Android Studio: 3.4 AI-183.6156.11.34.5522156
    Xcode: 10.2.1/10E1001 - /usr/bin/xcodebuild
  npmPackages:
    react: ^16.8.6 => 16.8.6 
    react-native: ^0.60.0-rc.2 => 0.60.0-rc.2

When Im enter region or exit region the xCode throw this error

019-07-02 17:23:20.740138+0700 NAEM[28860:404870] [Client] Sending selectors failed with: Error Domain=NSCocoaErrorDomain Code=4099 "The connection to service named com.apple.commcenter.coretelephony.xpc was invalidated." UserInfo={NSDebugDescription=The connection to service named com.apple.commcenter.coretelephony.xpc was invalidated.}
2019-07-02 17:23:20.761 [warn][tid:main][RCTEventEmitter.m:53] Sending `authorizationStatusDidChange` with no listeners registered.
2019-07-02 17:23:20.760786+0700 NAEM[28860:404628] Sending `authorizationStatusDidChange` with no listeners registered.
Resetting player.
2019-07-02 17:23:20.783250+0700 NAEM[28860:404757] [Client] Failure to deallocate CLLocationManager on the same runloop as its creation may result in a crash
2019-07-02 17:23:20.785925+0700 NAEM[28860:404757] [Client] Failure to deallocate CLLocationManager on the same runloop as its creation may result in a crash
2019-07-02 17:23:23.466 [info][tid:main][RCTRootView.m:293] Running application NAEM ({
    initialProps =     {
    };
    rootTag = 11;
})
2019-07-02 17:23:23.466300+0700 NAEM[28860:404628] Running application NAEM ({
    initialProps =     {
    };
    rootTag = 11;
})
2019-07-02 17:23:24.423 [info][tid:com.apple.root.default-qos][RCTImageLoader.m:746] [PERF ASSETS] Loading image at size {1624, 2436}, which is larger than the screen size {1125, 2436}
2019-07-02 17:23:24.422951+0700 NAEM[28860:404841] [PERF ASSETS] Loading image at size {1624, 2436}, which is larger than the screen size {1125, 2436}
2019-07-02 17:23:29.681622+0700 NAEM[28860:404628] didEnter : CLCircularRegion (identifier:'Chipotle', center:<+16.06929900,+108.23338600>, radius:1000.00m)
2019-07-02 17:23:29.684771+0700 NAEM[28860:404628] -[CLCircularRegion minor]: unrecognized selector sent to instance 0x6000027314c0
2019-07-02 17:23:29.712897+0700 NAEM[28860:404628] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[CLCircularRegion minor]: unrecognized selector sent to instance 0x6000027314c0'
*** First throw call stack:
(
    0   CoreFoundation                      0x000000010a1c06fb __exceptionPreprocess + 331
    1   libobjc.A.dylib                     0x0000000108419ac5 objc_exception_throw + 48
    2   CoreFoundation                      0x000000010a1deab4 -[NSObject(NSObject) doesNotRecognizeSelector:] + 132
    3   CoreFoundation                      0x000000010a1c5443 ___forwarding___ + 1443
    4   CoreFoundation                      0x000000010a1c7238 _CF_forwarding_prep_0 + 120
    5   NAEM                               0x0000000105b4855b -[RNiBeacon convertBeaconRegionToDict:] + 91
    6   NAEM                               0x0000000105b4a86e -[RNiBeacon locationManager:didEnterRegion:] + 94
    7   CoreLocation                        0x000000010b23fd5e CLClientStopVehicleHeadingUpdates + 71503
    8   CoreLocation                        0x000000010b23e92a CLClientStopVehicleHeadingUpdates + 66331
    9   CoreLocation                        0x000000010b22a330 CLClientInvalidate + 1297
    10  CoreFoundation                      0x000000010a127aec __CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK__ + 12
    11  CoreFoundation                      0x000000010a1272b0 __CFRunLoopDoBlocks + 336
    12  CoreFoundation                      0x000000010a12210b __CFRunLoopRun + 2747
    13  CoreFoundation                      0x000000010a121302 CFRunLoopRunSpecific + 626
    14  GraphicsServices                    0x00000001109512fe GSEventRunModal + 65
    15  UIKitCore                           0x0000000114dfaba2 UIApplicationMain + 140
    16  NAEM                               0x00000001056e1130 main + 112
    17  libdyld.dylib                       0x000000010e085541 start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException

Im using these dependencies

"dependencies": {
    "@mapbox/react-native-mapbox-gl": "^6.1.3",
    **_"@mauron85/react-native-background-geolocation": "^0.5.3",_**
    "@monterosa/react-native-parallax-scroll": "^1.8.0",
    "@react-native-community/netinfo": "^3.2.1",
    "@react-native-mapbox-gl/maps": "^7.0.0-rc3",
    "@turf/boolean-contains": "^6.0.1",
    "@turf/center": "^6.0.1",
    "@turf/centroid": "^6.0.2",
    "@turf/circle": "^6.0.1",
    "@turf/helpers": "^6.1.4",
    "@turf/meta": "^6.0.2",
    "@turf/point-on-feature": "^5.1.5",
    "@turf/transform-translate": "^5.1.5",
    "accept-language-parser": "^1.5.0",
    "apollo-boost": "^0.1.28",
    "apollo-cache-inmemory": "^1.6.2",
    "apollo-cache-persist": "^0.1.1",
    "apollo-client": "^2.6.3",
    "apollo-link": "^1.2.12",
    "apollo-link-context": "^1.0.18",
    "apollo-link-http": "^1.5.15",
    "autoresponsive-react-native": "^1.0.9",
    "axios": "^0.18.1",
    "core-js": "^3.1.4",
    "country-flags": "0.0.2",
    "geolib": "^2.0.24",
    "get-youtube-id": "^1.0.1",
    "graphql": "^0.13.2",
    "graphql-tag": "^2.10.1",
    "i18next": "^11.10.2",
    "install": "^0.12.2",
    "jwt-decode": "^2.2.0",
    "lodash": "^4.17.11",
    "lottie-react-native": "^2.6.1",
    "moment": "^2.24.0",
    "native-base": "^2.12.1",
    "npm": "^6.9.0",
    "querystring": "^0.2.0",
    "react": "^16.8.6",
    "react-apollo": "^2.5.6",
    "react-flags-svg": "^1.0.0",
    "react-i18next": "^7.13.0",
    "react-instantsearch-native": "^5.7.0",
    "react-native": "^0.60.0-rc.2",
    "react-native-animatable": "1.3.0",
    "react-native-app-intro-slider": "^1.0.1",
    "react-native-app-settings": "^2.0.1",
    "react-native-autolink": "^1.8.1",
    "react-native-background-timer": "^2.1.1",
    **_"react-native-beacons-manager": "github:nuonic/react-native-beacons-manager#master",_**
    "react-native-bluetooth-status": "^1.3.0",
    "react-native-boundary": "^1.1.1",
    "react-native-camera": "git+https://git@github.com/react-native-community/react-native-camera.git",
    "react-native-circular-progress": "^1.1.0",
    "react-native-config": "^0.11.7",
    "react-native-countdown-component": "^1.8.3",
    "react-native-device-info": "^2.1.2",
    "react-native-fetch-blob": "^0.10.8",
    "react-native-iap": "^3.2.3",
    "react-native-image-cache-hoc": "^1.5.1",
    "react-native-image-header-scroll-view": "^0.8.2",
    "react-native-image-slider": "^2.0.3",
    "react-native-image-zoom-viewer": "^2.2.26",
    "react-native-jwt-io": "^1.0.3",
    "react-native-languages": "^2.0.1",
    "react-native-linear-gradient": "^2.5.4",
    "react-native-loading-spinner-overlay": "^1.0.1",
    "react-native-material-ripple": "^0.8.0",
    "react-native-mime-types": "^2.2.1",
    "react-native-navigation-bar-color": "0.0.9",
    "react-native-open-maps": "^0.3.3",
    "react-native-orientation-locker": "^1.1.6",
    "react-native-permissions": "^1.1.1",
    "react-native-pose": "^0.3.0",
    "react-native-push-notification": "3.1.1",
    "react-native-qrcode-scanner": "github:moaazsidat/react-native-qrcode-scanner#04b83fcd",
    "react-native-scalable-image": "^0.4.0",
    "react-native-shimmer-placeholder": "^1.0.35",
    "react-native-slider": "github:jeanregisser/react-native-slider#951d00fc",
    "react-native-snap-carousel": "3.7.4",
    "react-native-splash-screen": "^3.2.0",
    "react-native-statusbar-alert": "^0.4.0",
    "react-native-svg": "^6.5.3",
    "react-native-svg-uri": "^1.2.3",
    "react-native-swift": "^1.2.2",
    "react-native-track-player": "^1.2.0",
    "react-native-vector-icons": "^5.0.0",
    "react-native-view-overflow": "0.0.3",
    "react-navigation": "^2.18.3",
    "react-navigation-backhandler": "^1.3.2",
    "react-navigation-is-focused-hoc": "^1.1.1",
    "react-redux": "^5.1.1",
    "react-timer-mixin": "^0.13.4",
    "recompose": "^0.30.0",
    "redux": "^4.0.1",
    "redux-devtools-extension": "^2.13.8",
    "redux-persist": "^5.10.0",
    "redux-reset": "^0.3.0",
    "styled-components": "^3.4.10",
    "url": "^0.11.0"
  },
**_"@mauron85/react-native-background-geolocation": "^0.5.3",_**
**_"react-native-beacons-manager": "github:nuonic/react-native-beacons-manager#master",_**

I think it conflict with highlight dependencies I marked. Please help me fix this error

songoten28 commented 5 years ago

This issue come from RNiBeacon. Not relative to your lib. Thanks for helpful lib

nbastoWM commented 4 years ago

Hi, I'm facing this issue too and I also have the beacons-manager package. How did you manage to overcome this error?

songoten28 commented 4 years ago

Hi, I'm facing this issue too and I also have the beacons-manager package. How did you manage to overcome this error?

This issue come from native you must edit some file

Edit become

- (void)locationManager:(CLLocationManager *)manager didEnterRegion:(CLRegion *)region
{
  if ([region isKindOfClass:[CLCircularRegion class]]) {
// Geofence
NSLog(@"didEnter : %@", region);
[self sendEventWithName:@"onEnter" body:region.identifier];
}
}

- (void)locationManager:(CLLocationManager *)manager didExitRegion:(CLRegion *)region
{
  if ([region isKindOfClass:[CLCircularRegion class]]) {
// Geofence
NSLog(@"didExit : %@", region);
[self sendEventWithName:@"onExit" body:region.identifier];
}
}

and another file https://github.com/MacKentoch/react-native-beacons-manager/blob/53c1bda81f032e775f29327a7bab28a14528cf39/ios/RNiBeacon/RNiBeacon/RNiBeacon.m#L344-L366

-(void)locationManager:(CLLocationManager *)manager
didEnterRegion:(CLBeaconRegion *)region {

  if ([region isKindOfClass:[CLBeaconRegion class]]) {
// Beacon
NSDictionary *event = [self convertBeaconRegionToDict: region];

[self sendEventWithName:@"regionDidEnter" body:event];
}
}

-(void)locationManager:(CLLocationManager *)manager
didExitRegion:(CLBeaconRegion *)region {
  if ([region isKindOfClass:[CLBeaconRegion class]]) {
// Beacon
NSDictionary *event = [self convertBeaconRegionToDict: region];

[self sendEventWithName:@"regionDidExit" body:event];
}
}