iOS Simulator Crash on Xcode 10 - ios

Today, I've updated my iMac to macOS Mojave from macOS High Sierra. Since then I'm not able to open simulator. Every time I tried to open the simulator that crashes immediately. Whenever I tried to run the simulator via Xcode then Xcode shows this error
Timed out waiting for the simulator application for iphonesimulator to become ready
Also, I tried to open the simulator directly and it's crash immediately. Here the gif (gif is a little bit slow) -
System CPU & Memory Status -
Here some solution that I've tried but no luck -
Clear iPhone Simulator Cache
xcrun simctl erase all
Clear DerivedData
~/Library/Developer/Xcode/DerivedData/
Clear iOS DeviceSupport
~/Library/Developer/Xcode/iOS DeviceSupport/
Delete Xcode Preferences
defaults delete com.apple.dt.Xcode
Restart Xcode & System
Update 1
macOS Logs -
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Device iPhone XS (978302BA-5255-44CB-A77C-188071B99A7C, iOS 12.0, Booted) is available but has no defaultDisplay'
*** First throw call stack:
(
0 CoreFoundation 0x00007fff33a9543d __exceptionPreprocess + 256
1 libobjc.A.dylib 0x00007fff5f9a6720 objc_exception_throw + 48
2 CoreFoundation 0x00007fff33ab008e +[NSException raise:format:arguments:] + 98
3 Foundation 0x00007fff35e4c55d -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 194
4 Simulator 0x000000010e7510da Simulator + 106714
5 libdispatch.dylib 0x00007fff60a24d4f _dispatch_call_block_and_release + 12
6 libdispatch.dylib 0x00007fff60a25dcb _dispatch_client_callout + 8
7 libdispatch.dylib 0x00007fff60a2c120 _dispatch_lane_serial_drain + <…>
)

This command should fix your issue (close sim before and open after):
sudo killall -10 com.apple.CoreSimulator.CoreSimulatorService
After this, restart Xcode and if simulator not available then we need to add them manually from Windows > Device and Simulators

This resolved my issue
Force quit simulator by:- option + command + esc choose simulator and quit.
Quit Xcode and restart then it worked!

Related

Flutter: unable to install "Runner" error when trying to install flutter app to real iOS device

I am using iPhone 8 (Version 13.3.1), and a MacBook air (Version 10.14.6). I have set 'team' to personal team in Xcode > general. Then I click the button on the top left corner to run it.
I received error like this even I have deleted the apps that I have installed before on the same phone with the sample apple id:
Details
Unable to install "Runner"
Domain: com.apple.dtdevicekit
Code: -402620383
--
App installation failed
Domain: com.apple.dtdevicekit
Code: -402620383
Failure Reason: The maximum number of apps for free development profiles has been reached.
User Info: {
DVTRadarComponentKey = 487927;
"com.apple.dtdevicekit.stacktrace" = (
0 DTDeviceKitBase 0x00000001263006e7 DTDKCreateNSError + 109
1 DTDeviceKitBase 0x0000000126300de9 DTDK_AMDErrorToNSError + 792
2 DTDeviceKitBase 0x000000012634056a __90-[DTDKMobileDeviceToken installApplicationBundleAtPath:withOptions:andError:withCallback:]_block_invoke + 164
3 DVTFoundation 0x000000010ba8dc12 DVTInvokeWithStrongOwnership + 73
4 DTDeviceKitBase 0x0000000126340301 -[DTDKMobileDeviceToken installApplicationBundleAtPath:withOptions:andError:withCallback:] + 1589
5 IDEiOSSupportCore 0x00000001261c8a25 __118-[DVTiOSDevice(DVTiPhoneApplicationInstallation) processAppInstallSet:appUninstallSet:installOptions:completionBlock:]_block_invoke.352 + 4523
6 DVTFoundation 0x000000010bbbee7a __DVT_CALLING_CLIENT_BLOCK__ + 7
7 DVTFoundation 0x000000010bbc0552 __DVTDispatchAsync_block_invoke + 809
8 libdispatch.dylib 0x00007fff6734f5f8 _dispatch_call_block_and_release + 12
9 libdispatch.dylib 0x00007fff6735063d _dispatch_client_callout + 8
10 libdispatch.dylib 0x00007fff673568e0 _dispatch_lane_serial_drain + 602
11 libdispatch.dylib 0x00007fff67357396 _dispatch_lane_invoke + 385
12 libdispatch.dylib 0x00007fff6735f6ed _dispatch_workloop_worker_thread + 598
13 libsystem_pthread.dylib 0x00007fff67590611 _pthread_wqthread + 421
14 libsystem_pthread.dylib 0x00007fff675903fd start_wqthread + 13
);
}
--
In Xcode go to Window → Devices under Installed Apps delete some apps, and afterwords you could run your app
Removing the app from the device worked for me.
I fixed it by renaming the bundle ID
The bundle ID it was complaining about had been used in the past on my phone, with a different app, coming from a different TestFlight account and build.
Unable to Install Runner
It's because of the debug App Quantity in your real device. Max 3 apps are able to run from Xcode to your real device for real debugging for further more just uninstall the app. Try to uninstall some of your test app then try to install the new debug app from xcode .Now it will work. Thanks.
Goto Xcode
Runner > General,
Under Identity, Change "Bundle Identifier",
Run app to the real device,
If you want, change the "Bundle Identifier" back to the original one.
I did all 5 steps , and worked perfectly , thanks to Rens.
I simply changed the build number, it worked just fine.
possible ways: (maybe one of them works)
change the build number.
change the team.
delete the app from the phone or from installed apps in window ->
Devices
unplug the usb cable.
change the bundle identifier.
https://stackoverflow.com/a/73597887/13059465
Try changing the lightning cable for another, use a certificate for more security, that's what I did and it worked
I too faced this issue. Removing the app from Window > Devices and Simulators didn't do it for me. What worked was renaming the bundle id. This allowed me to run it again, but I was also able to then rename it back to the original and get it to run.
Deleting the app from the device and removing any uncommitted git changes to the ios files worked for me.

Flutter app for iOS crash on startup with Firebase

I have done research for for so long and have not yet found a solution for my issue. I am building an app for iOS using flutter and I moved the app from my windows machine to a virtual macOS. Now when I try to rum the app on the Iphone simulator (Iphone 11 pro Max), the app crashes on startup with this error:
Launching lib/main.dart on iPhone 11 Pro Max in debug mode...
Running Xcode build...
Xcode build done. 190,5s
path: satisfied (Path is satisfied), interface: en0
Configuring the default Firebase app...
path: satisfied (Path is satisfied), interface: en0
Configured the default Firebase app __FIRAPP_DEFAULT.
path: satisfied (Path is satisfied), interface: en0
"currentDataServiceDescriptorChanged:",
"carrierBundleChange:",
"cellChanged:cell:",
"connectionStateChanged:connection:dataConnectionStatusInfo:",
"signalStrengthChanged:info:"
)
"currentDataServiceDescriptorChanged:",
"carrierBundleChange:",
"cellChanged:cell:",
"connectionStateChanged:connection:dataConnectionStatusInfo:",
"signalStrengthChanged:info:"
)
"currentDataServiceDescriptorChanged:",
"carrierBundleChange:",
"cellChanged:cell:",
"connectionStateChanged:connection:dataConnectionStatusInfo:",
"signalStrengthChanged:info:"
)
"currentDataServiceDescriptorChanged:",
"carrierBundleChange:",
"cellChanged:cell:",
"connectionStateChanged:connection:dataConnectionStatusInfo:",
"signalStrengthChanged:info:"
)
*** First throw call stack:
(
0 CoreFoundation 0x00007fff23c7127e __exceptionPreprocess + 350
1 libobjc.A.dylib 0x00007fff513fbb20 objc_exception_throw + 48
2 CoreFoundation 0x00007fff23c70e49 -[NSException raise] + 9
3 Runner 0x000000010c8aadc6 GADApplicationVerifyPublisherInitializedAnalyticsCorrectly + 409
4 Runner 0x000000010c85dbc0 GADEnvironmentIsSupported + 4134
5 libdispatch.dylib 0x00007fff5223e848 _<…>
Does anyone know what might be causing this error? I have added the GoogleService-Info.plist ursinne the add file in Xcode so now I don't know what's wrong. I hope anyone can help me and ill be so grateful!
I created a new project and now it works.

Error After Adding Firebase for iOS on Flutter App

I added the Firebase files to my app but it crashes right after it opens because in the first screen I call FirebaseAuth.getCurrentUser().
I tried this solution and added the file through Xcode but the app still crashing.
Solution: flutter ios app crashes after firebase setup
This is, how my ìnfo.plist`looks like.
This is my plist file provided by Google;
The error I'm getting;
Error in text:
Launching lib/main.dart on iPhone 11 Pro Max in debug mode...
Running Xcode build...
Xcode build done. 20.1s
path: satisfied (Path is satisfied), interface: en1
Configuring the default Firebase app...
*** First throw call stack:
(
0 CoreFoundation 0x00007fff23c7127e __exceptionPreprocess + 350
1 libobjc.A.dylib 0x00007fff513fbb20 objc_exception_throw + 48
2 CoreFoundation 0x00007fff23c710bc +[NSException raise:format:] + 188
3 Runner 0x0000000102ea421a +[FIRApp configure] + 138
4 Runner 0x000000010349aa96 -[FLTCloudFirestorePlugin init] + 214
5 Runner 0x000000010349a894 +[FLTCloudFirestorePlugin registerWithRegistrar:] + 292
6 Runner 0x0000000102e4ada0 +[GeneratedPluginRegistrant registerWithRegistry:] + 112
7 Runner <…>

(Simulator iPhone 4s is not available.) during validation

I try to update my pod to Xcode 8 and Swift 3 syntax, I did run the following command of my project:
pod spec lint BSTableViewReorder.podspec
and it produces an error:
-> BSTableViewReorder (1.3)
- ERROR | [iOS] unknown: Encountered an unknown error (/Applications/Xcode.app/Contents/Developer/usr/bin/xcrun simctl list devices
2016-08-25 11:58:10.561 simctl[34169:531955] CoreSimulator is attempting to unload a stale CoreSimulatorService job. Detected Xcode.app relocation or CoreSimulatorService version change. Framework path (/Applications/Xcode.app/Contents/Developer/Library/PrivateFrameworks/CoreSimulator.framework) and version (209.19) does not match existing job path (/Users/kuna/Downloads/Xcode-beta.app/Contents/Developer/Library/PrivateFrameworks/CoreSimulator.framework/Versions/A/XPCServices/com.apple.CoreSimulator.CoreSimulatorService.xpc/Contents/MacOS/com.apple.CoreSimulator.CoreSimulatorService) and version (303.7).
2016-08-25 11:58:10.819 simctl[34169:531955] Failed to locate a valid instance of CoreSimulatorService in the bootstrap. Adding it now.
2016-08-25 11:58:10.839 simctl[34169:531955] *** Assertion failure in -[SimServiceContext reloadServiceIfMovedOrAbortIfWeAreInvalid], /BuildRoot/Library/Caches/com.apple.xbs/Sources/CoreSimulator/CoreSimulator-209.19/CoreSimulator/SimServiceContext.m:536
2016-08-25 11:58:10.857 simctl[34169:531955] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'The loaded com.apple.CoreSimulator.CoreSimulatorService job does not match our expectations: pathOfLoadedJob: /Users/kuna/Downloads/Xcode-beta.app/Contents/Developer/Library/PrivateFrameworks/CoreSimulator.framework/Versions/A/XPCServices/com.apple.CoreSimulator.CoreSimulatorService.xpc/Contents/MacOS/com.apple.CoreSimulator.CoreSimulatorService, our frameworkPath: /Applications/Xcode.app/Contents/Developer/Library/PrivateFrameworks/CoreSimulator.framework'
*** First throw call stack:
(
0 CoreFoundation 0x00007fff87a934f2 __exceptionPreprocess + 178
1 libobjc.A.dylib 0x00007fff93c8973c objc_exception_throw + 48
2 CoreFoundation 0x00007fff87a981ca +[NSException raise:format:arguments:] + 106
3 Foundation 0x00007fff8aaa8856 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 198
4 CoreSimulator 0x00000001099953e9 -[SimServiceContext reloadServiceIfMovedOrAbortIfWeAreInvalid] + 1313
5 CoreSimulator 0x0000000109995d01 -[SimServiceContext connect] + 41
6 CoreSimulator 0x00000001099947a6 -[SimServiceContext initWithDeveloperDir:connectionType:] + 1108
7 CoreSimulator 0x0000000109994071 __63+[SimServiceContext sharedServiceContextForDeveloperDir:error:]_block_invoke_2 + 127
8 libdispatch.dylib 0x00007fff923fb40b _dispatch_client_callout + 8
9 libdispatch.dylib 0x00007fff923fc9f2 _dispatch_barrier_sync_f_invoke + 74
10 CoreSimulator 0x0000000109993ea6 +[SimServiceContext sharedServiceContextForDeveloperDir:error:] + 226
11 CoreSimulator 0x00000001099941ee +[SimServiceContext sharedServiceContext] + 51
12 simctl 0x0000000109982a71 simctl + 31345
13 libdyld.dylib 0x00007fff95ba65ad start + 1
14 ??? 0x0000000000000003 0x0 + 3
)
libc++abi.dylib: terminating with uncaught exception of type NSException
) during validation.
UPDATE:
After I chnaged the name of my Xcode from Xcode beta to Xcode, the following error arise:
Encountered an unknown error (Simulator iPhone 4s is not available.) during validation.
How to fix this?
Simply install iOS 9.3 Simulator:
update cocoapods to 1.1.0.beata.2 can fix it.
sudo gem install cocoapods --pre
hope can help you

Xcode crashes on launch

I am developing an Application for iOS and I changed nothing in the Application. But at a restart of my Mac, Xcode crashes every time.
Don't know if this is important, but my spotlight can't find any applications and also when I open the finder and using the shortcut cmd + shift + H I see a white window.
Xcode isn't starting anymore and throws this error:
Process: Xcode [1346]
Path: /Applications/Xcode.app/Contents/MacOS/Xcode
Identifier: com.apple.dt.Xcode
Version: 7.2 (9548)
Build Info: IDEFrameworks-9548000000000000~7
App Item ID: 497799835
App External ID: 814662604
Code Type: X86-64 (Native)
Parent Process: ??? [1]
Responsible: Xcode [1346]
Date/Time: 2015-12-24 11:01:44.753 +0100
OS Version: Mac OS X 10.11.2 (15C50)
Report Version: 11
Time Awake Since Boot: 4000 seconds
System Integrity Protection: enabled
Crashed Thread: 4 Dispatch queue: DVTFilePathEventWatcher - event queue
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0x0000000000000000
Exception Note: EXC_CORPSE_NOTIFY
VM Regions Near 0:
-->
__TEXT 0000000108a5a000-0000000108a5e000 [ 16K] r-x/rwx SM=COW /Applications/Xcode.app/Contents/MacOS/Xcode
Application Specific Information:
ProductBuildVersion: 7C68
Thread 0:: Dispatch queue: DVTFilePath cache derivation lock for key DVTFilePathKey_SortedDirectoryContents
0 libobjc.A.dylib 0x00007fff8df27aa0 search_method_list(method_list_t const*, objc_selector*) + 2
1 libobjc.A.dylib 0x00007fff8df28d76 lookUpImpOrForward + 413
2 libobjc.A.dylib 0x00007fff8df22591 objc_msgSend + 209
3 com.apple.dt.DVTFoundation 0x0000000108a741f8 -[DVTFileSystemVNode addCachedEntriesFromDictionary:] + 215
4 com.apple.dt.DVTFoundation 0x0000000108bd2e2d __33-[DVTFilePath cachedValueForKey:]_block_invoke549 + 245
5 libdispatch.dylib 0x00007fff9fcbd33f _dispatch_client_callout + 8
6 libdispatch.dylib 0x00007fff9fcbe926 _dispatch_barrier_sync_f_invoke + 74
7 com.apple.dt.DVTFoundation 0x0000000108cd1005 DVTDispatchBarrierSync + 62
8 com.apple.dt.DVTFoundation 0x0000000108a69627 -[DVTDispatchLock performLockedBlock:] + 116
9 com.apple.dt.DVTFoundation 0x0000000108a715b0 -[DVTFilePath cachedValueForKey:] + 1802
10 com.apple.dt.DVTFoundation 0x0000000108a70afc -[DVTToolchainRegistry scanSearchPathAndRegisterToolchains:] + 563
11 com.apple.dt.IDEFoundation 0x00000001097d1a66 IDEInitialize + 655
12 com.apple.dt.IDEKit 0x0000000109ecdf7c -[IDEApplicationController applicationWillFinishLaunching:] + 708
13 com.apple.CoreFoundation 0x00007fffa18fa70c __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ + 12
14 com.apple.CoreFoundation 0x00007fffa18fa67f ___CFXRegistrationPost_block_invoke + 63
15 com.apple.CoreFoundation 0x00007fffa18f9d47 _CFXRegistrationPost + 407
16 com.apple.CoreFoundation 0x00007fffa18f9ab2 ___CFXNotificationPost_block_invoke + 50
17 com.apple.CoreFoundation 0x00007fffa18f3d42 -[_CFXNotificationRegistrar find:object:observer:enumerator:] + 1922
18 com.apple.CoreFoundation 0x00007fffa17e2145 _CFXNotificationPost + 693
19 com.apple.Foundation 0x00007fff9ef36921 -[NSNotificationCenter postNotificationName:object:userInfo:] + 66
20 com.apple.dt.DVTFoundation 0x0000000108c6cf55 -[NSNotificationCenter(DVTNSNotificationCenterAdditions) _dvt_postNotificationName:object:userInfo:] + 698
21 com.apple.AppKit 0x00007fff9db412c2 -[NSApplication finishLaunching] + 354
22 com.apple.dt.DVTKit 0x0000000109275f62 -[DVTApplication finishLaunching] + 149
23 com.apple.AppKit 0x00007fff9db40e05 -[NSApplication run] + 231
24 com.apple.AppKit 0x00007fff9dac3520 NSApplicationMain + 1176
25 libdyld.dylib 0x00007fff9a8605ad start + 1
Could this be an issue due to Permissions conflicts?
ANSWER:
After I changed the rights from my OSX-Drive to everyone can write&read. Everything worked. But I knew that this is a temporary solution, so I decided to reinstall my MAC and everything was fine.
Delete ~/Library/Developer/Xcode/DerivedData by running this command in terminal:
rm -r ~/Library/Developer/XCode/DerivedData
If that doesnt work, At this point and with given info, all I could recommend to delete and reinstall Xcode.
If the delete of ~/Library/Developer/Xcode/DerivedData is not working for you, try this steps to remove xcuserdata:
open a Finder window and navigate to your project
right-click on the .xcodeproj OR .xcworkspace file
select Show Package Contents
a new window appears
delete a folder called xcuserdata
I had one where i selected a file that was quite large which crashed xcode when it tried to parse it. Then when i restarted it somehow it got set to load that file on start. Only way i saw was to temporarily rename the file that it was trying to load at start so it would load empty.
I'll recommend deleting xcuserdata: folder from both of your .xcodeproj & .xcworkspace file (open with Show Package Contents) and try again.
I hope this will work.
Ensure there are no issues with your SPM packages/dependencies.
This is simply another suggestion. I just spent some time debugging this on a fairly popular open source project.
My Xcode first crashed when I updated a SPM package, so I was fairly certain it was an issue with one of the future commits in that package or a SPM bug. I subscribe to Occam's Razor, so I started going through the changes in the commits.
After some time, I found a duplicate Swift Playground page delcaration in contents.xcplayground. I removed that single line, pushed the PR, and everything worked fine after that.
To be able to reopen the project:
Open project.pbxproj in your code editor of choice (e.g. vi, nano, emacs, atom, code).
Remove the offending package or packages from the /* Begin XCRemoteSwiftPackageReference section */ and /* Begin XCSwiftPackageProductDependency section */ sections.
Save the file and Xcode should now open.
Again, if your Xcode is immediately crashing when opening a project (and you last updated/auto-updated a SPM package) go through your packages.

Resources