I'm trying to build a preference pane as a part of learning OS X development. After downloading Apple's preference pane example code and trying to build the project I get the following error:
clang: error: cannot specify both '-fobjc-arc' and '-fobjc-gc'
Turning off garbage collection in Build Settings allows the project to build properly, but once the preference pane example is installed on the local machine it won't start saying,
"You can’t open PrefsPane preferences because it doesn’t work on an Intel-based Mac."
I've tried every combination of architecture (10.6, 10.7) and Objective-C Automatic Reference Counting (Yes, No) and Objective-C Garbage Collection (Supported (-fobjc-gc), Unsupported, Required (-fobjc-gc only) available. While some combinations do allow the project to build, I can't get the preference pane to load.
What are the proper architecture, ARC, and GC settings necessary to build and deploy a preference pane for OS X 10.7 using Xcode 4.3.2?
PrefsPane built with garbage collection turned off and ARC enabled in build setting works on Mac OS X 10.8.2. "System Preferences.app" just shows a message:
To use this preferences pane, System Preferences must quit and reopen.
It's because System Preferences is started with garbage collection enabled by default and if it tries to open a preferences pane without GC it should be restarted without GC too. So ARC can be used on 10.8 to develop preferences panes.
I just stumbled upon this myself. So turns out (accoridng to Apple dev docs):
All 64-bit preference panes are expected to use garbage collection. Using garbage collection will, in most cases, simplify your code and reduce the likelihood of memory leaks.
In Snow Leopard, the System Preferences application will run 64-bit preference panes with garbage collection enabled, and 32-bit panes with garbage collection disabled.
For more info go to Updating Preference Panes for Snow Leopard and Beyond.
So you can't use ARC. Only GC.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With