Archive

Archive for the ‘iPhone’ Category

Making NSAssert work

July 12th, 2011 No comments

Hi,

NSAssert is handy but it has been annoying me recently as the execution of the debugger doesn’t stop when an assert is hit. Instead we get a message output to the console and the execution is stopped in the update loop at a later point. When something hits an assertion I want the program execution to stop immediately. For some reason beyond me this is disabled in XCode by default. To enable it go to Run->Stop on Objective-C Exceptions

There you go, your exceptions will now work.

Categories: iPad, iPhone, iTouch, Objective C Tags:

HOWTO: Record a movie from the iPhone Simulator

June 6th, 2011 No comments

This is easy, only a few little steps.

1. First install SIMBL, use the pkg install and choose All Users install.

2. Download the iPhone Simulator Capture

3. Open up the iPhone Simulator and click on the iOS Simulator menu option and select About iOS Simulator. Note down the version number in brackets after the main version, it is 235 for me.

4. Open up the iPhone Simulator Capture.xcodeproj, navigate to Info.plist in the project view and update MaxBundleVersion to be the iOS Simulation version noted above.

5. Select Release and Build. You may see a post-build error, this is as the build process attempts to copy the output to two locations, the user SIMBL directory and the all-users SIMBL direction, only one is likely to exist from your install. The plugin should be copied to the SIMBL plugins directory*

6. Restart the Simulator and you’ll now see a Record menu option! It should be all fairly simple, one thing is that after you record a move you need to manually choose the Save Movie option afterwards, it does not save it to the HD as you go!

Easy!

* You can verify the build completed correctly by going to ~Library/Application Support/SIMBL/Plugins and you’ll see the file “iPhone Simulator Capture.bundle” if the install succeeded. If it isn’t there then check the user directory ~Users/MYUSERNAME/Library/Application Support/SIMBL/Plugins directory. If it is in neither then you may need to copy the bundle manually, check the iPhone Simulator Capture build/Release directory.

Categories: iPhone, iTouch, Mac Tags:

Hundreds of errors including: Expected declaration specifiers or ‘…’ before ‘CFXMLTreeRef’

January 5th, 2011 1 comment

Hi,

I upgraded recently to XCode 4.2 and on building the release version of my app was getting 96 odd errors. All of these orginate from Foundation.h with a callstack like below

/Users/parrotbait/Documents/Dropbox/
/myApp/myApp_Prefix.pch

/Developer/SDKs/MacOSX10.6.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:81:0 In file included from /Developer/SDKs/MacOSX10.6.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h

/Developer/SDKs/MacOSX10.6.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSURLError.h:17:0 In file included from /Developer/SDKs/MacOSX10.6.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSURLError.h

/Developer/SDKs/MacOSX10.6.sdk/System/Library/Frameworks/CoreServices.framework/Headers/CoreServices.h:29:0 In file included from /Developer/SDKs/MacOSX10.6.sdk/System/Library/Frameworks/CoreServices.framework/Headers/CoreServices.h

/Developer/SDKs/MacOSX10.6.sdk/System/Library/Frameworks/CoreServices.framework/Frameworks/OSServices.framework/Headers/OSServices.h:54:0 In file included from /Developer/SDKs/MacOSX10.6.sdk/System/Library/Frameworks/CoreServices.framework/Frameworks/OSServices.framework/Headers/OSServices.h

/Developer/SDKs/MacOSX10.6.sdk/System/Library/Frameworks/CoreServices.framework/Frameworks/OSServices.framework/Headers/WSMethodInvocation.h:773:0 Expected declaration specifiers or '...' before 'CFXMLTreeRef' in /Developer/SDKs/MacOSX10.6.sdk/System/Library/Frameworks/CoreServices.framework/Frameworks/OSServices.framework/Headers/WSMethodInvocation.h

Why were the OSX frameworks being used? As they were being used for an iOs build there was all sorts of problems. So I began to hunt down the origin of the call to the OSX headers.
After checking my project settings everything looked fine and I couldn’t see what the problem was. However after opening the transcript of the build I saw that on compiling the precompiled headers I was the errors were occuring. There was a compiler flag ‘-F’ for framework that indicates what paths to search for frameworks:

-F/Developer/SDKs/MacOSX10.6.sdk/System/Library/Frameworks

Right clicking on my Target and searching for Framework in the build section, I found that I had somehow (although I don’t remember doing this and am not convinced I really did) had an entry for ‘Framework Search Paths’

"$(DEVELOPER_DIR)/SDKs/MacOSX10.6.sdk/System/Library/Frameworks"

Removing this got rid of my 100s of build errors.

Categories: iPhone, iTouch, Objective C Tags:

Clear iPhone simulator cache (out-dated files being loaded)

March 15th, 2010 No comments

Quick post that might help someone.

I had an XML file that I had changed in Dashcode and for some reason the older XML content was being read into my app. I ‘re-touched’ it in XCode and even though the right XML showed up within the project the wrong XML was being loaded up in the simulator.

A little perplexed by this I checked what file was being loaded by stepping through code and saw that the XML was being loaded up from a path that looked something like “/Users//Library/Application Support/iPhone Simulator/User/Applications/xxx”. This location obviously contained the old version of the XML file and not the new one I had in XCode. To solve this problem I cleaned the project and performed a full re-build and low-and-behold the correct XML was loaded. I suspect cleaning the project deletes the app and all associated data from the simulator cache.

Categories: iPhone, Objective C Tags: