Flutter iOS UrlLauncher EXC_BAD_ACCESS - Stack Overflow

admin2025-04-30  1

Can some one point me on a direction on how to fix this issue?

I'm trying to use Flutter with UrlLauncher to launch an URL and on start up I get the following error.

Exception Type:  EXC_BAD_ACCESS (SIGSEGV)
Exception Subtype: KERN_INVALID_ADDRESS at 0x0000000000000000
Exception Codes: 0x0000000000000001, 0x0000000000000000
VM Region Info: 0 is not in any region.  Bytes before following region: 4373725184
      REGION TYPE                    START - END         [ VSIZE] PRT/MAX SHRMOD  REGION DETAIL
      UNUSED SPACE AT START
--->  
      __TEXT                      104b1c000-104b20000    [   16K] r-x/r-x SM=COW  /Users/USER/Library/Developer/CoreSimulator/Devices/648E4A66-F360-49DA-AD6F-3AC0C3115E9F/data/Containers/Bundle/Application/6B6C2FD1-6A42-4289-8762-44CB26EEFA52/Runner.app/Runner
Termination Reason: SIGNAL 11 Segmentation fault: 11
Terminating Process: exc handler [7323]

Triggered by Thread:  0

Thread 0 Crashed::  Dispatch queue: com.apple.main-thread
0   libswiftCore.dylib                     0x194b2f078 swift_getObjectType + 36
1   url_launcher_ios                       0x104d2c088 static URLLauncherPlugin.register(with:) + 96 (URLLauncherPlugin.swift:12)
2   url_launcher_ios                       0x104d2c200 @objc static URLLauncherPlugin.register(with:) + 56
3   Runner.debug.dylib                     0x104cc3a10 +[GeneratedPluginRegistrant registerWithRegistry:] + 112 (GeneratedPluginRegistrant.m:18)
4   Runner.debug.dylib                     0x104cc3a90 AppDelegate.application(_:didFinishLaunchingWithOptions:) + 96 (AppDelegate.swift:10)
5   Runner.debug.dylib                     0x104cc3d80 @objc AppDelegate.application(_:didFinishLaunchingWithOptions:) + 196
6   UIKitCore                              0x185ad4c2c -[UIApplication _handleDelegateCallbacksWithOptions:isSuspended:restoreState:] + 312
7   UIKitCore                              0x185ad6124 -[UIApplication _callInitializationDelegatesWithActions:forCanvas:payload:fromOriginatingProcess:] + 2936
8   UIKitCore                              0x185adb2a4 -[UIApplication _runWithMainScene:transitionContext:completion:] + 976
9   UIKitCore                              0x1850ebb0c -[_UISceneLifecycleMultiplexer completeApplicationLaunchWithFBSScene:transitionContext:] + 104
Flutter 3.24.5     Dart 3.5.4.    DevTools 2.37.3  pod version: 1.16.2.  url_launcher: ^6.3.1
Hardware Model:      MacBookPro18,3
Version:             1.0 (1)
Code Type:           ARM-64 (Native)
Role:                Foreground
Parent Process:      launchd_sim [2911]
Coalition:           com.apple.CoreSimulator.SimDevice.648E4A66-F360-49DA-AD6F-3AC0C3115E9F [1841]
Responsible Process: SimulatorTrampoline [2261]

OS Version:          macOS 15.1.1 (24B91)

Can some one point me on a direction on how to fix this issue?

I'm trying to use Flutter with UrlLauncher to launch an URL and on start up I get the following error.

Exception Type:  EXC_BAD_ACCESS (SIGSEGV)
Exception Subtype: KERN_INVALID_ADDRESS at 0x0000000000000000
Exception Codes: 0x0000000000000001, 0x0000000000000000
VM Region Info: 0 is not in any region.  Bytes before following region: 4373725184
      REGION TYPE                    START - END         [ VSIZE] PRT/MAX SHRMOD  REGION DETAIL
      UNUSED SPACE AT START
--->  
      __TEXT                      104b1c000-104b20000    [   16K] r-x/r-x SM=COW  /Users/USER/Library/Developer/CoreSimulator/Devices/648E4A66-F360-49DA-AD6F-3AC0C3115E9F/data/Containers/Bundle/Application/6B6C2FD1-6A42-4289-8762-44CB26EEFA52/Runner.app/Runner
Termination Reason: SIGNAL 11 Segmentation fault: 11
Terminating Process: exc handler [7323]

Triggered by Thread:  0

Thread 0 Crashed::  Dispatch queue: com.apple.main-thread
0   libswiftCore.dylib                     0x194b2f078 swift_getObjectType + 36
1   url_launcher_ios                       0x104d2c088 static URLLauncherPlugin.register(with:) + 96 (URLLauncherPlugin.swift:12)
2   url_launcher_ios                       0x104d2c200 @objc static URLLauncherPlugin.register(with:) + 56
3   Runner.debug.dylib                     0x104cc3a10 +[GeneratedPluginRegistrant registerWithRegistry:] + 112 (GeneratedPluginRegistrant.m:18)
4   Runner.debug.dylib                     0x104cc3a90 AppDelegate.application(_:didFinishLaunchingWithOptions:) + 96 (AppDelegate.swift:10)
5   Runner.debug.dylib                     0x104cc3d80 @objc AppDelegate.application(_:didFinishLaunchingWithOptions:) + 196
6   UIKitCore                              0x185ad4c2c -[UIApplication _handleDelegateCallbacksWithOptions:isSuspended:restoreState:] + 312
7   UIKitCore                              0x185ad6124 -[UIApplication _callInitializationDelegatesWithActions:forCanvas:payload:fromOriginatingProcess:] + 2936
8   UIKitCore                              0x185adb2a4 -[UIApplication _runWithMainScene:transitionContext:completion:] + 976
9   UIKitCore                              0x1850ebb0c -[_UISceneLifecycleMultiplexer completeApplicationLaunchWithFBSScene:transitionContext:] + 104
Flutter 3.24.5     Dart 3.5.4.    DevTools 2.37.3  pod version: 1.16.2.  url_launcher: ^6.3.1
Hardware Model:      MacBookPro18,3
Version:             1.0 (1)
Code Type:           ARM-64 (Native)
Role:                Foreground
Parent Process:      launchd_sim [2911]
Coalition:           com.apple.CoreSimulator.SimDevice.648E4A66-F360-49DA-AD6F-3AC0C3115E9F [1841]
Responsible Process: SimulatorTrampoline [2261]

OS Version:          macOS 15.1.1 (24B91)
Share Improve this question asked Jan 5 at 1:01 vpovpo 1
Add a comment  | 

1 Answer 1

Reset to default 0

This looks like an issue with the native iOS side of the project, not the dart side. Try the following and let me know how it goes. From the root of your Flutter project:

  • Clean the Flutter workspace

    flutter clean

  • Clean the Flutter dependency cache. Reinstalling the dependencies later with flutter pub get might take a while but this will make sure none of your plugins have been corrupted.

    flutter pub cache clean

  • Delete Xcode derived data:

    rm -rf ~/Library/Developer/Xcode/DerivedData

  • Delete the iOS directory:

    rm -rf ios

  • Recreate the iOS directory:

    flutter create .

Navigate to the iOS directory with cd ios. From the iOS directory:

  • Ensure your CocoaPods is up-to-date:

    sudo gem install cocoapods

  • Update the CocoaPods repository:

    pod repo update

  • Install iOS dependencies:

    pod install

  • Get Flutter dependencies:

    flutter pub get

If you're still running into this problem after these steps, there's probably an issue with your iOS simulator. With your iOS simulator running, reset the simulator with Device > Erase All Content and Settings from the simulator menu.

Leave a comment if this doesn't resolve your issue.

转载请注明原文地址:http://anycun.com/QandA/1746021476a91457.html