title: Xcode6 Creating Fat Static Library iOS Universal Framework
body: <p>Since the upgrade to Xcode and iOS8, I've been having trouble building a fat static library.  There are some pretty good instructions <a href="https://github.com/kstenerud/iOS-Universal-Framework#mk-8-is-now-out-of-beta" rel="noreferrer"><strong>here</strong></a> and <a href="http://spin.atomicobject.com/2011/12/13/building-a-universal-framework-for-ios/" rel="noreferrer"><strong>here</strong></a> but I think parts of the first instructions and all of the second instructions are dated.  The first instructions say to use <strong>Static iOS Framework</strong> and the second instructions say to use <strong>Cocoa Touch Static Library</strong>.  Prior to Xcode6, I would use the <strong>Static iOS Framework</strong> but now that they have renamed it to <strong>Cocoa Touch Framework</strong> I'm not sure.</p>
  
  <p>So, for starters, which should I use to create a <strong>fat static library</strong>?  Is it <strong>Cocoa Touch Framework</strong>?  Or <strong>Cocoa Touch Static Library</strong>?</p>
  
  <p><img src="https://i.stack.imgur.com/XSe6F.png" alt="Cocoa Touch Framework"></p>
  
  <p><img src="https://i.stack.imgur.com/dtpiw.png" alt="Cocoa Touch Static Library"></p>
  
  <p>Then I create a new Aggregate Target:</p>
  
  <p><img src="https://i.stack.imgur.com/3yWnG.png" alt="Aggregate Target"></p>
  
  <p>Then I create a Run Script:</p>
  
  <hr>
  
  <p><img src="https://i.stack.imgur.com/e0BXJ.png" alt="Run Script"></p>
  
  <hr>
  
  <p>Here is the Run Script I am using (in its entirety):</p>
  
  <pre><code># This script is based on Jacob Van Order's answer on apple dev forums 
  
  https://devforums.apple.com/message/971277
  # See also http://spin.atomicobject.com/2011/12/13/building-a-universal-framework-for-ios/ for the start
  
  
  # To get this to work with a Xcode 6 Cocoa Touch Framework, create Framework
  # Then create a new Aggregate Target. Throw this script into a Build Script Phrase on the Aggregate
  
  
  ######################
  # Options
  ######################
  
  REVEAL_ARCHIVE_IN_FINDER=true
  
  FRAMEWORK_NAME="${PROJECT_NAME}"
  
  SIMULATOR_LIBRARY_PATH="${BUILD_DIR}/${CONFIGURATION}-iphonesimulator/${FRAMEWORK_NAME}.framework"
  
  DEVICE_LIBRARY_PATH="${BUILD_DIR}/${CONFIGURATION}-iphoneos/${FRAMEWORK_NAME}.framework"
  
  UNIVERSAL_LIBRARY_DIR="${BUILD_DIR}/${CONFIGURATION}-iphoneuniversal"
  
  FRAMEWORK="${UNIVERSAL_LIBRARY_DIR}/${FRAMEWORK_NAME}.framework"
  
  
  ######################
  # Build Frameworks
  ######################
  
  xcodebuild -project ${PROJECT_NAME}.xcodeproj -sdk iphonesimulator -target ${PROJECT_NAME} -configuration ${CONFIGURATION} clean build CONFIGURATION_BUILD_DIR=${BUILD_DIR}/${CONFIGURATION}-iphonesimulator | echo
  
  xcodebuild -project ${PROJECT_NAME}.xcodeproj -sdk iphoneos -target ${PROJECT_NAME} -configuration ${CONFIGURATION} clean build CONFIGURATION_BUILD_DIR=${BUILD_DIR}/${CONFIGURATION}-iphoneos | echo
  
  #xcodebuild -target ${PROJECT_NAME} ONLY_ACTIVE_ARCH=NO -configuration ${CONFIGURATION} -sdk iphoneos  BUILD_DIR="${BUILD_DIR}" BUILD_ROOT="${BUILD_ROOT}" | echo
  
  #xcodebuild -target ${PROJECT_NAME} ONLY_ACTIVE_ARCH=NO -configuration ${CONFIGURATION} -sdk iphonesimulator  BUILD_DIR="${BUILD_DIR}" BUILD_ROOT="${BUILD_ROOT}" | echo
  
  
  ######################
  # Create directory for universal
  ######################
  
  rm -rf "${UNIVERSAL_LIBRARY_DIR}"
  
  mkdir "${UNIVERSAL_LIBRARY_DIR}"
  
  mkdir "${FRAMEWORK}"
  
  
  ######################
  # Copy files Framework
  ######################
  
  cp -r "${DEVICE_LIBRARY_PATH}/." "${FRAMEWORK}"
  
  
  ######################
  # Make fat universal binary
  ######################
  
  lipo "${SIMULATOR_LIBRARY_PATH}/${FRAMEWORK_NAME}" "${DEVICE_LIBRARY_PATH}/${FRAMEWORK_NAME}" -create -output "${FRAMEWORK}/${FRAMEWORK_NAME}" | echo
  
  
  ######################
  # On Release, copy the result to desktop folder
  ######################
  
  if [ "${CONFIGURATION}" == "Release" ]; then
  mkdir "${HOME}/Desktop/${FRAMEWORK_NAME}-${CONFIGURATION}-iphoneuniversal/"
  cp -r "${FRAMEWORK}" "${HOME}/Desktop/${FRAMEWORK_NAME}-${CONFIGURATION}-iphoneuniversal/"
  fi
  
  
  ######################
  # If needed, open the Framework folder
  ######################
  
  if [ ${REVEAL_ARCHIVE_IN_FINDER} = true ]; then
  if [ "${CONFIGURATION}" == "Release" ]; then
  open "${HOME}/Desktop/${FRAMEWORK_NAME}-${CONFIGURATION}-iphoneuniversal/"
  else
  open "${UNIVERSAL_LIBRARY_DIR}/"
  fi
  fi
  </code></pre>
  
  <p>But when I try to Build I receive this message:</p>
  
  <pre><code>fatal error: lipo: can't open input file: /Users/pdl/Library/Developer/Xcode/DerivedData/innerIDMobileLicense-blnxjfvoxnqfelftmzojgdwhvazk/Build/Products/Debug-iphonesimulator/innerIDMobileLicense.framework/innerIDMobileLicense (No such file or directory)
  </code></pre>
  
  <p>That's correct, the file isn't there!  Notice in the first image below, there is a Unix Executable File <strong>IdAirOpenCv</strong>.  Then look at the second image and notice that <strong>IdAirOpenCv</strong> isn't there.</p>
  
  <p>This is what I am used to seeing prior to upgrading:</p>
  
  <p><img src="https://i.stack.imgur.com/Dm02g.png" alt="Old folder structure"></p>
  
  <p>This is what I have now:</p>
  
  <p><img src="https://i.stack.imgur.com/FlBBb.png" alt="New folder structure"></p>
  
  <p>According to the script, the Unix Executable File <strong>innerIDMobileLicense</strong> should be located inside all three of the framework folders at the same level as the Headers and Modules folders.</p>
  
  <p>Does anybody have a clue what I am doing wrong?</p>