flutter_contacts icon indicating copy to clipboard operation
flutter_contacts copied to clipboard

Not able to run the app in iOS

Open SuryaSharpsell opened this issue 2 years ago • 2 comments

Fatal error: Unexpectedly found nil while unwrapping an Optional value: file /Users/limi/Downloads/flutter/.pub-cache/hosted/pub.flutter-io.cn/contacts_service-0.4.6/ios/Classes/SwiftContactsServicePlugin.swift, line 16 2020-07-24 14:32:45.861449+0800 iosaar[13535:8826645] Fatal error: Unexpectedly found nil while unwrapping an Optional value: file /Users/limi/Downloads/flutter/.pub-cache/hosted/pub.flutter-io.cn/contacts_service-0.4.6/ios/Classes/SwiftContactsServicePlugin.swift, line 16

This issues is happening if the iOS project is created using new Xcode 13 and above. Basically it is trying to access the window from app delegate but that is not available because new version Xcode uses scene delegate.

Please update the code to support scene delegate

SuryaSharpsell avatar Jun 24 '22 09:06 SuryaSharpsell

@SuryaSharpsell Did you find a workaround ?

jeremy-carbonne avatar Jul 28 '22 12:07 jeremy-carbonne

@jeremy-carbonne - Yes. You need to delete the scene delegate and use the app delegate.

FYI - If you are adding this framework as SDK then this is not a long term fix.

SuryaSharpsell avatar Jul 28 '22 12:07 SuryaSharpsell

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Sep 28 '22 03:09 stale[bot]

If you're encountering the "Fatal error: Unexpectedly found nil while unwrapping an Optional value" error in your iOS project created with Xcode 13 or above, it's likely due to accessing the window from the app delegate, which is no longer available in newer Xcode versions that use the scene delegate. To resolve the issue, you'll need to Download your code to support the scene delegate instead. This adjustment should address the problem and allow your app to function correctly.

tyerllwendland512 avatar Jun 28 '23 20:06 tyerllwendland512

If you're encountering the "Fatal error: Unexpectedly found nil while unwrapping an Optional value" error in your iOS project created with Xcode 13 or above, it's likely due to accessing the window from the app delegate, which is no longer available in newer Xcode versions that use the scene delegate. To resolve the issue, you'll need to Download your code to support the scene delegate instead. This adjustment should address the problem and allow your app to function correctly.

Coukd u explain more?

NANAIPRM avatar Jan 09 '24 10:01 NANAIPRM