question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[iOS] Crash: NSRegularExpression(NSMatching) firstMatchInString:options:range:

See original GitHub issue

Environment

OS: macOS High Sierra 10.13.4 Node: 6.11.3 Yarn: 1.3.2 npm: 3.10.10 Watchman: 4.9.0 Xcode: Xcode 9.0 Build version 9A235 Android Studio: 3.0 AI-171.4443003

Packages: (wanted => installed) react: ^16.3.0-alpha.1 => 16.4.1 react-native: 0.54.4 => 0.54.4

Description

Our project has much crash and the crash log has same information as follows:

Crash reason: EXC_BAD_ACCESS / KERN_INVALID_ADDRESS Crash Thread: 17

0 libicucore.A.dylib!icu::RegexMatcher::find(UErrorCode&) + 0x56c Found by: given as instruction pointer in context 1 libicucore.A.dylib!icu::RegexMatcher::find(UErrorCode&) + 0x5ac Found by: previous frame’s frame pointer 2 Foundation!-[NSRegularExpression(NSMatching) enumerateMatchesInString:options:range:usingBlock:] + 0x2c4 Found by: previous frame’s frame pointer 3 Foundation!-[NSRegularExpression(NSMatching) firstMatchInString:options:range:] + 0x7c Found by: previous frame’s frame pointer 4 React + 0x7351c Found by: previous frame’s frame pointer 5 React + 0x95414 Found by: previous frame’s frame pointer 6 React + 0x99048 Found by: previous frame’s frame pointer 7 React + 0x97bfc Found by: previous frame’s frame pointer 8 React + 0x99370 Found by: previous frame’s frame pointer 9 libdispatch.dylib!_dispatch_call_block_and_release + 0x14 Found by: previous frame’s frame pointer 10 libdispatch.dylib!_dispatch_client_callout + 0xc Found by: previous frame’s frame pointer 11 libdispatch.dylib!_dispatch_queue_serial_drain$VARIANT$armv81 + 0x234 Found by: previous frame’s frame pointer 12 libdispatch.dylib!_dispatch_queue_invoke$VARIANT$armv81 + 0x144 Found by: previous frame’s frame pointer 13 libdispatch.dylib!_dispatch_root_queue_drain_deferred_wlh$VARIANT$armv81 + 0x148 Found by: previous frame’s frame pointer 14 libdispatch.dylib!_dispatch_workloop_worker_thread$VARIANT$armv81 + 0x260 Found by: previous frame’s frame pointer 15 libsystem_pthread.dylib!_pthread_wqthread + 0x358 Found by: previous frame’s frame pointer 16 libsystem_pthread.dylib!start_wqthread + 0x0 Found by: previous frame’s frame pointer

I guess this crash will occur when react calls the native method such as NativeModules.RNLogger.*

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
bird-xiongcommented, Sep 10, 2018

Image fetch maybe has multi-thread problem,you should change to this

static dispatch_once_t onceToken; dispatch_once(&onceToken, ^{ if (!videoRegex) { NSError *error = nil; videoRegex = [NSRegularExpression regularExpressionWithPattern:@“(?:&|^)ext=MOV(?:&|$)” options:NSRegularExpressionCaseInsensitive error:&error]; if (error) { RCTLogError(@“%@”, error); } } });

0reactions
monzy613commented, Nov 27, 2018

@guoyabiniOS have you fixed this problem by using the code above?

Read more comments on GitHub >

github_iconTop Results From Across the Web

NSRegularExpression Crash - Stack Overflow
There is a problem: matchesInString:source returns an array of NSTextCheckingResults . Example, error checking must be added:
Read more >
NSRegularExpression | Apple Developer Documentation
This snippet creates a regular expression to match two-letter words, in which the first letter is “a” or “b” and the second letter...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found