React-native-mapbox-gl: New install 5.2.2 crash app at loading iOS

Created on 19 Sep 2017  路  19Comments  路  Source: nitaliano/react-native-mapbox-gl

Hi,

I think I had the same pb from #637 ... but with iOS.
Using the last install 5.2.2 with the @mapbox npm namespace... follow all install info.

When I try start the app with react-native run-ios, after Build succeeded, the app launch but stop instantly.
When I try start it with Xcode.. the app launch and stop instantly, but I got a :
screen shot 2017-09-19 at 11 00 25 am
from RCTCxxBridge.mm

My package.json :

{
  "name": "MyApp",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "start": "node node_modules/react-native/local-cli/cli.js start",
    "test": "jest",
    "testwatch": "jest --watch --notify",
    "testcov": "jest --coverage",
    "lint": "eslint app __tests__",
    "build_doc": "documentation build App/** -f md -o documentation.md",
    "serve_doc": "documentation serve App/**",
    "testflight": "fastlane ios beta"
  },
  "dependencies": {
    "@mapbox/react-native-mapbox-gl": "^5.2.2",
    "color": "^2.0.0",
    "raven-js": "^3.14.0",
    "react": "^16.0.0-alpha.12",
    "react-native": "^0.48.3",
    "react-native-extended-stylesheet": "^0.6.0",
    "react-native-linear-gradient": "^2.3.0",
    "react-native-router-flux": "^4.0.0-beta.21",
    "react-redux": "^5.0.3",
    "redux": "^3.6.0"
  },
  "devDependencies": {
    "babel-jest": "19.0.0",
    "babel-preset-react-native": "1.9.1",
    "documentation": "^4.0.0-beta.18",
    "eslint": "^3.18.0",
    "eslint-config-standard": "^10.0.0",
    "eslint-plugin-import": "^2.2.0",
    "eslint-plugin-jsx-a11y": "^4.0.0",
    "eslint-plugin-node": "^4.2.2",
    "eslint-plugin-promise": "^3.5.0",
    "eslint-plugin-react": "^6.10.2",
    "eslint-plugin-standard": "^2.2.0",
    "jest": "19.0.2",
    "react-native-mock": "^0.3.1",
    "react-test-renderer": "~15.4.1",
    "sinon": "^2.1.0"
  },
  "jest": {
    "preset": "react-native",
    "moduleNameMapper": {
      "^image![a-zA-Z0-9$_-]+$": "GlobalImageStub",
      "^[@./a-zA-Z0-9$_-]+\\.(png|gif)$": "RelativeImageStub"
    },
    "testRegex": "(/__tests__/.*|\\.(test|spec))\\.(ts|tsx|js)$",
    "setupFiles": [
      "./test.conf.js"
    ],
    "testPathIgnorePatterns": [
      "/.history/",
      "/node_modules/"
    ],
    "coveragePathIgnorePatterns": [
      "/node_modules/",
      "/.history/",
      "./test.conf.js"
    ]
  }
}

v5.2.1 seems to work... but when I try to reload/enable hot reload... the app crash.


will rollback to v5.2.0

Thanks for your time

Most helpful comment

I just published @mapbox/[email protected] it fixes the crash for me, let me know how it goes I'll add it to this https://github.com/mapbox/react-native-mapbox-gl/pull/635 once I get some verification that it's working.

All 19 comments

I'm getting a crash here with 5.2.2 as well, not sure if this is related or not but happens every time the app reloads and sometimes with no apparent reason:

2017-09-19 12:05:51.160 MyApp[1149:2887658] *** Assertion failure in -[RCTEventEmitter sendEventWithName:body:](), /path/to/project/MyApp/MyApp-rn/node_modules/react-native/React/Modules/RCTEventEmitter.m:42
2017-09-19 12:05:51.163 MyApp[1149:2887658] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'bridge is not set. This is probably because you've explicitly synthesized the bridge in RCTWebSocketModule, even though it's inherited from RCTEventEmitter.'
*** First throw call stack:
(
    0   CoreFoundation                      0x0000000105bc1b0b __exceptionPreprocess + 171
    1   libobjc.A.dylib                     0x0000000104be6141 objc_exception_throw + 48
    2   CoreFoundation                      0x0000000105bc5cf2 +[NSException raise:format:arguments:] + 98
    3   Foundation                          0x000000010294c69b -[NSAssertionHandler handleFailureInFunction:file:lineNumber:description:] + 165
    4   MyApp                              0x000000010031abb8 -[RCTEventEmitter sendEventWithName:body:] + 408
    5   MyApp                              0x0000000100578212 -[RCTWebSocketModule webSocket:didReceiveMessage:] + 466
    6   MyApp                              0x00000001005706b1 __33-[RCTSRWebSocket _handleMessage:]_block_invoke + 81
    7   libdispatch.dylib                   0x0000000107215585 _dispatch_call_block_and_release + 12
    8   libdispatch.dylib                   0x0000000107236792 _dispatch_client_callout + 8
    9   libdispatch.dylib                   0x000000010721e247 _dispatch_main_queue_callback_4CF + 1041
    10  CoreFoundation                      0x0000000105b86909 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 9
    11  CoreFoundation                      0x0000000105b4cae4 __CFRunLoopRun + 2164
    12  CoreFoundation                      0x0000000105b4c016 CFRunLoopRunSpecific + 406
    13  GraphicsServices                    0x000000010ae50a24 GSEventRunModal + 62
    14  UIKit                               0x0000000103230134 UIApplicationMain + 159
    15  MyApp                              0x000000010019c39f main + 111
    16  libdyld.dylib                       0x000000010727f65d start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException

I can assure that this doesn't happen on 5.2.0.

Edit: I can confirm that it is also happening on 5.2.1.

cc @nitaliano.

@lucasbento @matthieupinte is this with or without cocoapods?

@nitaliano without cocoapods ;)

Confirm this issue for 5.2.1 and 5.2.2.

Error stack from Crashlytics - hope this helps:

Fatal Exception: NSRangeException
0  CoreFoundation                 0x1868f6fe0 __exceptionPreprocess
1  libobjc.A.dylib                0x185358538 objc_exception_throw
2  CoreFoundation                 0x1868f6f28 -[NSException initWithCoder:]
3  Foundation                     0x187316030 -[NSObject(NSKeyValueObserverRegistration) _removeObserver:forProperty:]
4  Foundation                     0x187315b1c -[NSObject(NSKeyValueObserverRegistration) removeObserver:forKeyPath:]
5  MY_APP                        0x10011f3b0 -[RCTMapboxGLManager dealloc] (RCTMapboxGLManager.m:165)
6  libobjc.A.dylib                0x185376134 (anonymous namespace)::AutoreleasePoolPage::pop(void*)
7  CoreFoundation                 0x1867d2b28 _CFAutoreleasePoolPop
8  Foundation                     0x1873eb5c0 __NSThreadPerformPerform
9  CoreFoundation                 0x1868a542c __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__
10 CoreFoundation                 0x1868a4d9c __CFRunLoopDoSources0
11 CoreFoundation                 0x1868a29a8 __CFRunLoopRun
12 CoreFoundation                 0x1867d2da4 CFRunLoopRunSpecific
13 MY_APP                        0x100135fe8 +[RCTCxxBridge runRunLoop] (RCTCxxBridge.mm:219)
14 Foundation                     0x1873eb318 __NSThread__start__
15 libsystem_pthread.dylib        0x1859b968c _pthread_body
16 libsystem_pthread.dylib        0x1859b959c _pthread_body
17 libsystem_pthread.dylib        0x1859b6cb4 thread_start

@keenubee yes very helpful I'll check it out

I have installed the 5.2.2 version on RN 0.47.1 with new instructions on iOS and I can compile and start the app. But when I press Cmd + R to reload the app it crashes

Here is the stack:

2017-09-21 14:24:56.558 myApp[15834:238990] *** Assertion failure in -[RCTEventEmitter sendEventWithName:body:](), /Users/myName/projects/myAppApp/node_modules/react-native/React/Modules/RCTEventEmitter.m:42
2017-09-21 14:24:56.560 myApp[15834:238990] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'bridge is not set. This is probably because you've explicitly synthesized the bridge in RCTWebSocketModule, even though it's inherited from RCTEventEmitter.'
*** First throw call stack:
(
    0   CoreFoundation                      0x000000010b025b0b __exceptionPreprocess + 171
    1   libobjc.A.dylib                     0x0000000109edb141 objc_exception_throw + 48
    2   CoreFoundation                      0x000000010b029cf2 +[NSException raise:format:arguments:] + 98
    3   Foundation                          0x0000000109aaa69b -[NSAssertionHandler handleFailureInFunction:file:lineNumber:description:] + 165
    4   myApp                               0x0000000108d37c18 -[RCTEventEmitter sendEventWithName:body:] + 408
    5   myApp                               0x0000000108f6bbd2 -[RCTWebSocketModule webSocket:didReceiveMessage:] + 466
    6   myApp                               0x0000000108f64071 __33-[RCTSRWebSocket _handleMessage:]_block_invoke + 81
    7   libdispatch.dylib                   0x000000010f0334a6 _dispatch_call_block_and_release + 12
    8   libdispatch.dylib                   0x000000010f05c05c _dispatch_client_callout + 8
    9   libdispatch.dylib                   0x000000010f03d40b _dispatch_main_queue_callback_4CF + 411
    10  CoreFoundation                      0x000000010afea909 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 9
    11  CoreFoundation                      0x000000010afb0ae4 __CFRunLoopRun + 2164
    12  CoreFoundation                      0x000000010afb0016 CFRunLoopRunSpecific + 406
    13  GraphicsServices                    0x0000000112c90a24 GSEventRunModal + 62
    14  UIKit                               0x000000010d58b134 UIApplicationMain + 159
    15  myApp                               0x0000000108c2a40f main + 111
    16  libdyld.dylib                       0x000000010f0a865d start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException

I'm able to reproduce the app crashing when I reload. I'm not able to reproduce the app crashing on startup, it could be a configuration issue due to the namespace changes check https://github.com/mapbox/react-native-mapbox-gl/issues/634#issuecomment-330305488.

What's happening on the reload is the offline storage is trying to remove an observer before it was ever set causing a crash. I'll be making a PR with a fix for this today publish an alpha version and see if it fixes the issues for everyone.

I just published @mapbox/[email protected] it fixes the crash for me, let me know how it goes I'll add it to this https://github.com/mapbox/react-native-mapbox-gl/pull/635 once I get some verification that it's working.

@nitaliano I just installed successfully version 5.2.3-alpha1 and now when I reload JS it does not crash! Thanks man :)

@nitaliano Just FYI, we were using [email protected] like #637, and recently we too were experiencing crashes on Android nearly every time the map was loaded. I updated the dependency to @mapbox/[email protected] and now it seems to be stable.

@matthieupinte Can you close this if it works for you too? :)

@nitaliano: just tested 5.2.3-alpha1, it is crashing a lot here.

Sometimes it crashes a few seconds after I call any offline function, other times without doing anything and definitely crashes when I open a screen with a <MapView />.

This is the only thing that shows up on my debug:

2017-10-01 10:35:22.350 MyApp[60568:4704536] [INFO] {DefaultFileSource}[Database]: cannot open file at line 38280 of [0e5ffd9123] (Code 14)
2017-10-01 10:35:22.351 MyApp[60568:4704536] [INFO] {DefaultFileSource}[Database]: [0e5ffd9123]:38280: (3) open(/Users/user/Library/Developer/CoreSimulator/Devices/0CD9040D-A6B4-48A6-A646-5ABD8EFA4818/data/Containers/Data/Application/1D95FF0A-6779-45D9-8687-11D85C11B43C/Library/Application Support/com.MyApp/.mapbox/cache.db) -  (Code 14)
2017-10-01 10:35:22.364 [info][tid:com.facebook.react.JavaScript] Running application "MyApp" with appParams: {"rootTag":1,"initialProps":{"iOSDevice":"x86_64"}}. __DEV__ === true, development-level warning are ON, performance optimizations are OFF
MyApp(60568,0x70000a27c000) malloc: *** error for object 0x10fae9a78: pointer being freed was not allocated
*** set a breakpoint in malloc_error_break to debug

@alixaxel When you upgraded to @mapbox/[email protected], how did you include the Mapbox.framework file? From what I can tell, it is not included in this version of the package.

File should be located here: node_modules/@mapbox/react-native-mapbox-gl/ios/Mapbox.framework

https://www.jsdelivr.com/package/npm/@mapbox/react-native-mapbox-gl?version=5.2.3-alpha1&path=ios

Hi,
There is no more 5.2.3-alpha version, so try again the 5.2.2 by upgrading my current (5.2.0) version... but continue to got

ld: framework not found Mapbox
clang: error: linker command failed with exit code 1 (use -v to see invocation)

I follow the instructions, but maybe forgot some lines on my Xcode project to remove...
If someone experiencing the same issue, or can tell me how to properly removed mannually linked librairies ^^,

@matthieupinte check this please - https://www.npmjs.com/package/@mapbox/react-native-mapbox-gl

Thx @keenubee but :

This is currently considered an alpha do not use in production...

for v6...
In fact the only reason why I want to upgrade from 5.2.0 to 5.2.2 (or more) is to got z-index support on my annotations... (or order in render)

Can't use an v6-alpha, but find a solution to my z-index pb by using Custom view Annotation... all annotations are rendered as an immutable array, just one selected rendered as a custom one. Like that it's always rendered a top level.

If you want to close this issue, you can, I will stay on 5.2.0 until 6 is released ;)

Was this ever merged into 5.2.2? As that still crashes for me but 5.2.3-alpha1 works, but that doesn't have the fix for zoom levels on Android. I don't have the time to upgrade to 6 yet!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

max-prokopenko picture max-prokopenko  路  4Comments

igor9silva picture igor9silva  路  3Comments

vyankat70war picture vyankat70war  路  3Comments

EwanValentine picture EwanValentine  路  3Comments

lucasbento picture lucasbento  路  3Comments