Facebook Twitter Github Freelancer
    Suppress All Warning Xcode File

    Under project Targets > Build Phases > Compile Sources add the -w Compiler Flags to the file(s) you want to stop showing you warnings.

    Super Breakpoints

    Under Breakpoint Navigator add (+ button bottom left) an Exception Breakpoint. I use the following:

    Exception: All

    Break: On Throw

    Action: Sound - Sosumi

    Action: Debugger Command - po $eax

    You can also do the following 

    • po [$eax class]
    • po [$eax name]

    NOTE: $eax only works on the simulator. For a device you need to use $ro.

    -encodeObject:forKey: only defined for abstract class

    Use NSKeyedArchiver not NSArchiver

    Company name Xcode 4.x

    Just create a project and it will be remembered.

    Hide deprecated warnings in Xcode

    #pragma GCC diagnostic ignored “-Wdeprecated-declarations”

    The executable was signed with invalid entitlements

    Steps to success:

    1. Make sure you have enabled iCloud in the app id
    2. Make sure you have deleted and re-created the development and distribution profiles (NOTE: make sure the development one is done in particular as this is most likely the one used while your testing)
    3. Ensure the following keys are present in your [target].entitlements file (customise the com.mycompany… as needed)
    • $(TeamIdentifierPrefix)com.mycompany.myapplication
    • $(AppIdentifierPrefix)com.mycompany.myapplication 
    “Unknown class <MyClass> in Interface Builder file” error at runtime

    Make sure the following is set

    Other Link Flags > -ObjC -all_load

    Xcode Workspace Archive Project With Static Library

    Check in the derived data folder for a folder (do a search in Finder) for InstallationBuildProductsLocation. This is where your static library project should be outputting it’s header files based on it’s ‘Packaging > Private / Public Headers Folder Path’.  If you can see your .h files, great, this post can help you. Otherwise you have an issue I haven’t run into yet.

    If you are trying to archive a project in a workspace setup, read the command that is run in the log navigator (command+7) for the ‘Precompile {project}/{project}-Prefix.pch file.

    Generally you will find you are missing a .h file originating in the .pch file.

    Read the command for this, it will begin with ‘ProcessPCH’. Around the end of the command you will find that there are a whole lot of ‘-iquote’ parameters. This is where the headers search path should be for you static library.

    Go back to you project build settings and add to the header search paths for Release mode for every folder in there (for some reason the recursion doesn’t work).

    A general folder structure might be

    InstallationBuildProductsLocation/headers/public
    InstallationBuildProductsLocation/headers/private

    I would add the Release 

    $(TARGET_BUILD_DIR)/../headers/public
    $(TARGET_BUILD_DIR)/../headers/private

    Archive now, watch it work and feel free to thank me.

    Save View to Camera Roll

    To save a UIView to camera roll, use the following code:

    Update plist value

    e.g. To update the “Bundle versions string, short” (CFBundleShortVersionString) for an Xcode project:

    /usr/libexec/PlistBuddy -c “Set :CFBundleShortVersionString 1.0.0” YourProject-Info.plist

    Xcode Intellisense / Code Completion Not Working on Return

    If you go to hit return on a suggestion e.g. “- (vo”, it suggests ‘void’ and hitting enter causes you to go to a new line. Make sure you haven’t done what I did by ‘somehow’ having a customised shortcut under Key Binding -> Insert Newline (Insertions and Indentations). 

    This is for Xcode 4.3.2

    Include Resources in Xcode Project for Static Library

    This resource is good, just remember to look at step 10 as it shows you you need to reference the bundle the resource is in.

    http://iphone.galloway.me.uk/iphone-sdktutorials/ios-library-with-resources/

    Xcode Project Documentation

    Use appledoc, it’s quick and easy and looks nice

    Jenkins Missing Keychain

    If you try and use Jenkins to code sign your app you may get the following errror:


    [workspace] $ /usr/bin/security list-keychains -s ${HOME}/Library/Keychains/login.keychain

    [workspace] $ /usr/bin/security default-keychain -d user -s ${HOME}/Library/Keychains/login.keychain

    Will not set default: file /private/var/jenkins/Library/Keychains/login.keychain does not exist

    security: SecKeychainSetDomainDefault user: Could not write to the file. It may have been opened with insufficient access privileges.

    [workspace] $ /usr/bin/security unlock-keychain -p ******** ${HOME}/Library/Keychains/login.keychain

    security: SecKeychainUnlock /var/jenkins/Library/Keychains/login.keychain: The specified keychain could not be found.

    FATAL: Unable to unlock the keychain.

    Build step ‘XCode’ marked build as failure

    Finished: FAILURE


    Go to: Keychain > Keychain First aid (from the menu)

    1. username = jenkins

    2. password = (whatever your password is)

    3. Repair

    That should have fixed up your missing keychain for jenkins

    Jenkins Xcode License Agreement Issue

    If you receive this error:

    You have not agreed to the Xcode license agreements, please run xcodebuild standalone from within a Terminal window to review and agree to the Xcode license agreements.

    Build step ‘XCode’ marked build as failure

    Finished: FAILURE

    and you’ve tried to use the command given, try this command:

    sudo xcodebuild -license

    Thanks to this blog