Search code examples
system-preferencesnspreferencepane

Why does my Preference Pane seem to think it's always the wrong architecture?


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:

A modal sheet dialog saying "To use the 'My App Preferences' preferences pane, System Preferences must quit and reopen." with "Cancel" and "OK" options.

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?


Solution

  • 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...