-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
fix(ios): return proper mimeType on M1 x86_64 simulators #5853
Conversation
have you tried turning off |
@jcesarmobile I did that for the blank Ionic project and it did work. The simulator loaded the app and it did not get stuck on the white screen. However when I ran the project, in which I initially had this bug on, it still showed the white screen. When I looked at the project build settings, I noticed that it was forcing architecture So it seems this fix is still valid for projects:
I'll update the PR description as well to reflect these findings. Thanks @jcesarmobile |
You mean the project you shared or a different project? where is that setting for using x86_64 on simulators? |
The project I originally encountered the bug on is a different project not the one I shared. I updated the PR description that points to two sample projects which both force arch |
Accommodating the big MIME list
In one of the projects I'm working on we are having an issue of app getting stuck on white screen in iOS simulators 14.0+ that run on M1 machines.
After much trial and error we found out that in the
ios/Capacitor/Capacitor/WebViewAssetHandler.swift
file, the methodmimeTypeForExtension
was returning defaultapplication/octet-stream
value for many path extensions. In real devices or simulators with lower iOS versions, it was returning correct value.The issue was with the object
UTTypeCreatePreferredIdentifierForTag
. This object was returningnil
value and as a result the method was defaulting to the valueapplication/octet-stream
.This happens for projects:
Open using Rosetta
option for XcodeOpen using Rosetta
option for Xcodex86_64
for simulator buildsUTTypeCreatePreferredIdentifierForTag
is marked as deprecated and Xcode suggested usingUTType
instead. I did that but with same result as before.I ended up providing a dictionary of path extensions and mime types. I added the dictionary as a fallback in case
UTTypeCreatePreferredIdentifierForTag
returnsnil
.Issue environment:
Sample projects:
4.0.1
of@capacitor/ios
that shows blank screen: https://github.com/arnold-plakolli/BlankScreenIssueDemo@capacitor/ios
that works: https://github.com/arnold-plakolli/BlankScreenFixedIssueDemocloses #5793