• 2015-01-06

    Build universal iOS static library in xcode for simulator and real device

    Views: 11888 | No Comments

    The default static library target in Xcode does not support iPhone simulator and real iPhone device at once. You have to build your static library for others to use on simulator, and build another for real device.

    With an Aggregate target, you can mix the two library together in one .a file. Here’s the run script for the Aggregate target:

    # define output folder environment variable
    UNIVERSAL_OUTPUTFOLDER=${BUILD_DIR}/${CONFIGURATION}-universal
    
    # Step 1. Build Device and Simulator versions
    xcodebuild -target Target -configuration ${CONFIGURATION} -sdk iphoneos  BUILD_DIR="${BUILD_DIR}" BUILD_ROOT="${BUILD_ROOT}"
    xcodebuild -target Target -configuration ${CONFIGURATION} -sdk iphonesimulator -arch x86_64 -arch i386 BUILD_DIR="${BUILD_DIR}" BUILD_ROOT="${BUILD_ROOT}"
    
    # make sure the output directory exists
    mkdir -p "${UNIVERSAL_OUTPUTFOLDER}"
    
    # Step 2. Create universal binary file using lipo
    lipo -create -output "${UNIVERSAL_OUTPUTFOLDER}/lib${PROJECT_NAME}.a" "${BUILD_DIR}/${CONFIGURATION}-iphoneos/lib${PROJECT_NAME}.a" "${BUILD_DIR}/${CONFIGURATION}-iphonesimulator/lib${PROJECT_NAME}.a"
    
    # Last touch. copy the header files. Just for convenience
    cp -R "${BUILD_DIR}/${CONFIGURATION}-iphoneos/include" "${UNIVERSAL_OUTPUTFOLDER}/"
    
    Posted by ideawu at 2015-01-06 15:58:48 Tags: ,
  • 2013-04-07

    How to deal with Xcode “Code Sign error”

    Views: 10795 | No Comments

    I happend to run into the situation that my project cannot compile and run, after I checked the “Entitlements” option. The error message is:

    "Check dependencies
    Code Sign error: The identity 'Mac Developer' doesn't match any valid, non-expired certificate/private key pair in the default keychain"
    

    I just to go to the old way to test my App, so I seek for the solution. Here is how I get rid of this error:

    1. Click on you project name from “Project Navigator”
    2. Select item under “Targets” that lies beside “Project Navigator”
    3. Then click on the “Build Settings” tab
    4. Set the option “Code Signing Identity” to “Don’t Code Sign”
    Posted by ideawu at 2013-04-07 22:42:20 Tags:
|<<<1>>>| 1/1 Pages, 2 Results.