Retina "#2x" graphics incorrectly being used on standard-def display (using Snow Leopard / Xcode 4.2 ) - objective-c

I am developing a Mac app using Xcode 4.2 in OS X 10.6 Snow Leopard.
My Xcode project contains, in the same folder and at exactly-doubled dimensions:
image.png
image#2x.png
I use the Apple-recommended -[NSImage imageNamed:] method to load the correct resource depending on the user's screen type:
[NSImage imageNamed:#"image"];
However, when I run the app on my non-retina 1440x900 display, the "#2x" version of the image is displayed. I get a 100x100 image when it should be a 50x50.
The same code works fine to deliver both standard-def and retina images, depending, when I run the app in 10.7 Lion (switching between standard and HiDPI modes).
I've thus far been unable to get Snow Leopard HiDPI (720x450) mode to work. But it still should be displaying the standard-def image when I use my standard-def display.
Is there a limitation of either Snow Leopard or Xcode 4.2 that causes this to work incorrectly? If so, how do you release an app that has a Deployment Target of 10.6 but still also has retina graphics support?

It seems as if Snow Leopard or Xcode 4.2 cannot properly combine High Resulotion Artwork into a single .tiff file?
Set Combine High Resolution Artwork to NO in your Target's Build Settings.
IMPORTANT: I then additionally needed to manually delete the previously created .tiffs from my app's bundle. -[NSImage imageNamed:] prefers the single .tiff to the 2 .pngs, so it will use the .tiff file if it finds it. Make sure it doesn't.

Related

How to easily test cocoa app on different version of mac osx?

I have a macbook air 2011 version and have 10.8.x installed on it. I used xcode 4.6 to develop an app, I tested it using this machine and worked perfectly fine.
I want my app to support 10.6 (snow leopard) and 10.7 (lion) as well (I set my deployment target to 10.6 and base sdk to 10.7) , so in order to test it, I compiled my app using my macbook (again, 10.8 mountain lion) and copy the app to my other 10.6 machine (hackintosh).
Testing on 10.6 is a pain in the butt, I have learnt a few tricks tried to make the testing easier (ie. implementing redirectConsoleLogToDocumentFolder so that all NSLog will be added to the console.log), however sometimes my app will cause a segmentation fault, which can't be caught by try catch, and I really had no clue what caused the problem.
My questions are:
1. how to easily test my app (with ARC enabled) on a 10.6 machine without xcode? I have installed xcode 4.2 on snow leopard, however it doesn't support arc and couldn't compile, even I downloaded the 10.7 sdk and put it into my xcode folder.
2. are there any other tricks you can share with me, to make the testing on 10.7/10.6 easier?

How to make an app use Growl on Lion and Notification Center on Mountain Lion?

I am making an app that uses notification center on mountain lion. I included support for growl on snow leopard and lion. How do I make it so the binary will be able to run on both and not require 2 separate .app bundles.
I guess you would be building an app against the Growl framework and 10.7, and then have code to check at startup if Notification Center is available (which it will be on 10.8+) and use that instead. There is a very similar question about the process here.

Obtaining 10.6 Base SDK for Xcode 4.5.2

How can I obtain and use 10.6 as base SDK in Xcode 4.5.2?
I downloaded Xcode 4.5.2 from the Mac App Store (through a link on the Apple developer site).
Is there a way I can somehow download the 10.6 SDK separately and start using it as a base SDK?
Strangely enough, I can download the documentation for the 10.6 SDK through Xcode's Preferences window, but not the SDK itself. Any ideas?
No, you can't download the 10.6 SDK separately.
Is there a reason you can't use the 10.8 or 10.7 SDK?
Keep in mind that just because you build against the 10.8 SDK, that doesn't mean you can't also have that built application work on 10.8, 10.7 and 10.6. (This is often a cause of confusion among new developers). You control backwards-compatibility through the Deployment Target setting like shown in the image below.
By default, the deployment target is generally set to the same version of OS X as the SDK is, but changing it to 10.6, for example, should allow it to run on a machine with OS X 10.6. (Of course, you should really test to make sure that's the case).
Download xcode with MacOSX10.6.sdk. Now copy MacOSX10.6.sdk inside /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs
Its also working fine with Xcode 5.0.

Debugging an app outside XCode on different version of OSX (view exceptions, logs, ...)

I'am developing on Lion 10.7 an XCode 4.2 beta.
I need to test my app on Snow Leopard and catch crashes, NSLog etc, without XCode.
In Snow Leopard the 10.7 SDK is missing, and I can't compile and use the embedded debugging suite of XCode.
What should I do?
From what I understand, I think you need to download the Xcode 4.2 beta for both Lion and Snow Leopard. These are two different versions. Get them from the Mac App Store or Apple's Developer website.
Just Discovered that Console will trace all my app NSLog / crashes.

Can iMac use CLLocationManager?

Or is it just for IPhone?
By extension, can IPhone simulator use CLLocationManager
Since Mac OS X Snow Leopard, an iMac (or any other Mac) has the CoreLocation framework, including CLLocationManager.
The iPhone simulator uses directly CoreLocation on the Mac since the iOS 4 SDK if I'm correct (before that using CoreLocation on the simulator would always point to the Apple headquarters).
You can use Core Location on the desktop - but without a GPS it estimates your position using the wifi networks around you. It's surprisingly accurate (in London, at least).
I think this was how the original, pre GPS, iPhones used to estimate your current location.