问题
This has worked just fine for a long time. As far as I can tell from the diffs I haven't changed anything... but I'm not 100% sure. All I know is that now my preference pane shows this error when I try to open it:
When I press OK, it restarts and shows the same dialog. This continues ad nauseam.
I checked the binary with file
and it confirms that it's a 64-bit executable:
is-mbp-bleggiero:MacOS bleggiero$ file My\ App\ Preferences
My App Preferences: Mach-O 64-bit bundle x86_64
This is... bittersweet. All advice I can find online says that this error means that a 32-bit preferences pane must be loaded in the 32-bit version of System Preferences, bit as far as I can tell, this is not the cause of this symptom.
I look into the Console.app and I see this right after I click the preference pane:
default 16:05:02.162340 -0400 System Preferences dlopen_preflight failed with dlopen_preflight(/Applications/My Company/My App.app/Contents/PlugIns/My App Preferences.prefPane/Contents/MacOS/My App Preferences): no suitable image found. Did find:
/Applications/My Company/My App.app/Contents/PlugIns/My App Preferences.prefPane/Contents/MacOS/My App Preferences: mach-o, but wrong architecture
/Applications/My Company/My App.app/Contents/PlugIns/My App Preferences.prefPane/Contents/MacOS/My App Preferences: mach-o, but wrong architecture for /Applications/My Company/My App.app/Contents/PlugIns/My App Preferences.prefPane
So it thinks that I'm using the wrong architecture all of a sudden...? What's going on here?
回答1:
Turns out this happened when I tried to attach an .entitlements
file to the preference pane, by setting the CODE_SIGN_ENTITLEMENTS
field in build settings to point to an entitlements file I'd made for it. After removing that build setting, it opens just like it used to. Now I want to know how to entitle a preference pane, but at least this one is answered...
回答2:
Try to clear caches with a safe boot...
Safe Mode boot deletes system caches that may help after an OS X upgrade.
Top left corner of your screen click the Apple > Shut Down.
After your Mac shuts down, wait 10 seconds, then press the power button.
Immediately after you hear the startup tone, hold down the Shift key. You should press the Shift key as soon as possible after you hear the startup tone, but not before.
Release the Shift key when you see the gray Apple logo and progress indicator.
Once you are in Safe Mode, go back to the Apple menu. From the drop down menu click: Restart
来源:https://stackoverflow.com/questions/52085440/why-does-my-preference-pane-seem-to-think-its-always-the-wrong-architecture