可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
Failed to load OMO warning (potential crash):
Project with xcode 9 following warning is observed in the console during debug/release builds (iOS 11 GM/beta & iOS 10):
CoreData: annotation: Failed to load optimized model at path "/Users/xyz.abc/Library/Developer/CoreSimulator/Devices/A-GUID/data/Containers/Bundle/Application/B-GUID/app-name.app/Frameworks/framework-name/mystorename.momd/mystorename 6.omo"
Any custom framework (e.g. GoogleMaps, etc) that uses CD also results in this warning and potential crashes.
Update: Using Xcode Version 9.1 beta (9B46) doesn't result in this warning.
Note:
- Also noticed this with modal used in app and other framework. For app, clean build results in this error. Path shown in warning points to model used with app and not a framework.
- Compilation with previous Xcode do work fine and no warning is noticed.
Tried following:
- complete clean build
- ensured omo exists in datamodel v6, ManagedObjectModel & PersistentStoreCoordinator are non-nil. All functionality works as expected.
- add newer version of datamodel v7, ensured omo v7 exists -- clean builds & device deployment
- added schema again
Please add suggestions. What are the potential implications of this warning?
Related:
- https://openradar.appspot.com/33212613
- https://openradar.appspot.com/33573724
- https://openradar.appspot.com/33773917
- https://issuetracker.google.com/issues/35827124
- https://issuetracker.google.com/issues/35827113
Similar issues with old Xcode 6/iOS 9 and Xcode 7/iOS 9
- Core Data - Failed to load optimized model at path
- CoreData: Failed to load optimized model at path
- Google Maps SDK for iOS Runtime warning - Core Date Failed to Load Optimised Path
回答1:
The only way now to handle it (ios 11 = crash, not only warning) is to downgrade your sdk!!
Within your Podfile modify the following lines:
pod 'GoogleMaps', '2.2' pod 'GooglePlaces', '2.2'
After doing so, run pod update
so the library will get updated.
any version above it will crash.
回答2:
Upgrading Xcode to Version 9.1 beta (9B46) doesn't output this warning in the console. Tried following to reproduce console message:
- Clean pods entirely, and rebuilt project.
- Complete Xcode clean including derived data, simulator cleanup.
- Device deployment, no crash observed.
回答3:
The GoogleMaps 2.5.0 is out which is supposed to solve the issue.
Here is the issue tracker: Crashes on iOS 11
just update your Podfile
pod 'GoogleMaps' pod 'GooglePlaces'
And pod update
I was getting these warnings on a simulator, after reverting my 'GoogleMaps' pod to 2.2 the API didn't show the map anymore. I updated to 2.5 which just got releases, the map works now but I still get these logs.
Also try a clean build! My app suddenly started crashing whenever I was opening a controller with GoogleMaps imported in it and everything was absolutely fine so I spent hours and finally just did a clean build and the issue was resolved!
command + shift + B