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

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?

Related

Mac App Sandboxing with Snow Leopard

I can't find any information on how to enable App Sandboxing with XCode on Snow Leopard? It seems like it's not possible but maybe one of you experts can confirm this or is there any workaround possible? Any hint will be valuable.
Thanks!
If you're going to develop a Sandboxed app, you really should be developing on at least 10.7.5 (preferably 10.9.1 at this point), since 10.7 was the first version of OS X to support sandboxing. Even if you could manage to build a sandboxing-enabled app on 10.6.8, you won't be able to properly test it.

iPhone 5.1 App using OpenCV crashes due to "nonatomic" not found

I'm developing an iOS App which targets iOS 5.1+. I'm using XCode 4.5 on Mac OS X 10.8 and I do own an iPhone 4 with iOS 5.1.1. The app needs OpenCV, which I have successfully built from sources according to a tutorial in the OpenCV-Documentation.
Here is what happens:
When I start up the application I get an exception:
dyld: Symbol not found: _objc_setProperty_nonatomic
The error does not occur with iOS 6, but with iOS 5.1 in both the simulator and on a real device.
What is that? Is it related to OpenCV? Does it have to do something with incompatibilities between iOS / the iPhone / XCode??
EDIT: My development target is set to 5.1. The Base SDK is 6.0. I copied an SDK für 4.3 (which is the lowest version that XCode 4.5 will support) from another Mac and set development target as well as the base SDK to 4.3. Did not work either (it did not even build then).
I did not an update, the project has been started from scratch using XCode 4.5 initially.
Meanwhile I also found a tip to use gnulibc++ instead of libc++, but that also resulted in that the project did not build at all.
I built a test project and found the same issue. OpenCV is being built with a deployment target of ios6, this is a known issue, and a fix is pending review, see https://github.com/Itseez/opencv/pull/70

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 I build for 4.x simulator but run in 3.x simulator?

Ok, there have been some questions alluding to this before, and I've even read some second-hand reports of people successfully doing this, but so far I haven't found a concrete answer.
Basically, I want to build an application for simulator using iOS 4.x, and then run it on a 3.x simulator.
I have both SDKs installed, so all I need is the last mile of getting the app to show up in the 3.x simulator.
I tried just copying the app across from Library/Application Support/iPhone Simulator/4.2/Applications to Library/Application Support/iPhone Simulator/3.0/Applications but it doesn't show up when I load the 3.x simulator. There's a binary plist called applicationstate.plist, which I'm guessing keeps track of what apps are installed on the simulator, but I don't know what the binary format is so I'm kind of stuck at this point.
Has anyone managed to load a 4.x app onto a 3.x simulator? And if so, how did you do it?
Why are you even trying to do this? What are you trying to achieve? If what you really just want to do is ensure the app works on iOS 3.x then simply state that in xcode and don't worry about the actual simulator. The simulator could be running iOS 5.0 for all you should care as long as you have set 'iOS Deployment Target' to '3.0' in xcode's project settings. That will ensure the application is compatible with iOS 3.x and above. Obviously you then still need to ensure you're not calling methods from SDK 4.x when it will run on an iOS 3.x device. If that is what you're trying to test then what you're doing won't actually work. You should (as Apple advises) always grab hold of a real device running the target firmware version and test it on that. Grab an old iPod for example with iOS 3.x and try testing your app on that to ensure you haven't called iOS 4.x methods when running under an older firmware.
The answer is: No, you cannot build for 4.x simulator and run on a 3.1.x simulator or earlier due to fundamental changes in the way the simulator works.
The only way to test 3.x support is to either run it on a 3.x device (after setting min deployment target), or build on an older xcode that supports 3.x simulator (which isn't feasible if you use Xcode 4, except for iPad 3.2).
Note: Setting the deployment target does not test compatibility with older operating systems. It's the operating system that it actually RUNS on that matters (such as "iPhone 4.3 Simulator", "iPhone 4.0 Simulator", "iPad 3.2 Simulator", or an actual device).
Of course, now that 3.x users make up less than 10% of the total population, it's not really worth the trouble to support it anymore.