title: Creating an iOS Simulator Build with Cordova for Facebook review
body: <p>I need to hand in a new version of our app to submit my request for new Facebook permissions.</p>
  
  <p>The problem is, that it is not possible to build the iOS simulator build like described <a href="https://developers.facebook.com/docs/ios/creating-ios-simulator-build-for-review/" rel="nofollow">here</a>. </p>
  
  <p>I attached my complete output <a href="https://gist.github.com/e3a03eb8c2de17dc774b.git" rel="nofollow">on gist</a>.</p>
  
  <p>The most important parts are these ones:</p>
  
  <pre><code>SebastiansMBP2:ios &lt;user&gt;$ xcodebuild -arch i386 -sdk iphonesimulator8.0
  Build settings from command line:
      ARCHS = i386
      SDKROOT = iphonesimulator8.0
  
  === BUILD TARGET CordovaLib OF PROJECT CordovaLib WITH THE DEFAULT CONFIGURATION (Release) ===
  
  Check dependencies
  ...
  2014-10-21 11:44:28.029 xcodebuild[67280:364513]  DeveloperPortal: Using pre-existing current store at URL (file:///Users/&lt;user&gt;/Library/Developer/Xcode/DeveloperPortal%206.0.db).
  === BUILD TARGET &lt;ProjectName&gt; OF PROJECT &lt;ProjectName&gt; WITH THE DEFAULT CONFIGURATION (Release) ===
  
  
  CompileC build/&lt;ProjectName&gt;.build/Release-iphonesimulator/&lt;ProjectName&gt;.build/Objects-normal/i386/AdjustCordova.o &lt;ProjectName&gt;/Plugins/com.adjust.sdk/AdjustCordova.m normal i386 objective-c com.apple.compilers.llvm.clang.1_0.compiler
      cd /Users/&lt;user&gt;/Development/20/&lt;ProjectName&gt;/platforms/ios
      export LANG=en_US.US-ASCII
      export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/Users/&lt;user&gt;/.rvm/gems/ruby-2.0.0-p451/bin:/Users/&lt;user&gt;/.rvm/gems/ruby-2.0.0-p451@global/bin:/Users/&lt;user&gt;/.rvm/rubies/ruby-2.0.0-p451/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/Users/&lt;user&gt;/.rvm/bin:/Users/&lt;user&gt;/.adt/tools:/Users/&lt;user&gt;/.adt/platform-tools"
      /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -x objective-c -arch i386 -fmessage-length=270 -fdiagnostics-show-note-include-stack -fmacro-backtrace-limit=0 -fcolor-diagnostics -std=c99 -fobjc-arc -Wno-trigraphs -fpascal-strings -Os -Wno-missing-field-initializers -Wno-missing-prototypes -Wno-implicit-atomic-properties -Wno-receiver-is-weak -Wno-arc-repeated-use-of-weak -Wduplicate-method-match -Wno-missing-braces -Wparentheses -Wswitch -Wunused-function -Wno-unused-label -Wno-unused-parameter -Wunused-variable -Wunused-value -Wempty-body -Wuninitialized -Wno-unknown-pragmas -Wno-shadow -Wno-four-char-constants -Wno-conversion -Wconstant-conversion -Wint-conversion -Wbool-conversion -Wenum-conversion -Wno-shorten-64-to-32 -Wpointer-sign -Wno-newline-eof -Wno-selector -Wno-strict-selector-match -Wundeclared-selector -Wno-deprecated-implementations -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator8.0.sdk -fexceptions -fasm-blocks -fstrict-aliasing -Wprotocol -Wdeprecated-declarations -g -fvisibility=hidden -Wno-sign-conversion -fobjc-abi-version=2 -fobjc-legacy-dispatch -mios-simulator-version-min=7.0 -iquote /Users/&lt;user&gt;/Development/20/&lt;ProjectName&gt;/platforms/ios/build/&lt;ProjectName&gt;.build/Release-iphonesimulator/&lt;ProjectName&gt;.build/&lt;ProjectName&gt;-generated-files.hmap -I/Users/&lt;user&gt;/Development/20/&lt;ProjectName&gt;/platforms/ios/build/&lt;ProjectName&gt;.build/Release-iphonesimulator/&lt;ProjectName&gt;.build/&lt;ProjectName&gt;-own-target-headers.hmap -I/Users/&lt;user&gt;/Development/20/&lt;ProjectName&gt;/platforms/ios/build/&lt;ProjectName&gt;.build/Release-iphonesimulator/&lt;ProjectName&gt;.build/&lt;ProjectName&gt;-all-target-headers.hmap -iquote /Users/&lt;user&gt;/Development/20/&lt;ProjectName&gt;/platforms/ios/build/&lt;ProjectName&gt;.build/Release-iphonesimulator/&lt;ProjectName&gt;.build/&lt;ProjectName&gt;-project-headers.hmap -I/Users/&lt;user&gt;/Development/20/&lt;ProjectName&gt;/platforms/ios/build/Release-iphonesimulator/include -I/Users/&lt;user&gt;/Development/20/&lt;ProjectName&gt;/platforms/ios/build/Release-iphonesimulator/usr/local/lib/include -I/Users/&lt;user&gt;/Development/20/&lt;ProjectName&gt;/platforms/ios/build/UninstalledProducts/include -I/Users/&lt;user&gt;/Development/20/&lt;ProjectName&gt;/platforms/ios/build/Release-iphonesimulator -I/Users/&lt;user&gt;/Development/20/&lt;ProjectName&gt;/platforms/ios/build/&lt;ProjectName&gt;.build/Release-iphonesimulator/&lt;ProjectName&gt;.build/DerivedSources/i386 -I/Users/&lt;user&gt;/Development/20/&lt;ProjectName&gt;/platforms/ios/build/&lt;ProjectName&gt;.build/Release-iphonesimulator/&lt;ProjectName&gt;.build/DerivedSources -F/Users/&lt;user&gt;/Development/20/&lt;ProjectName&gt;/platforms/ios/build/Release-iphonesimulator -F/Users/&lt;user&gt;/Development/20/&lt;ProjectName&gt;/platforms/ios/Safe -F/Users/&lt;user&gt;/Development/20/&lt;ProjectName&gt;/platforms/ios/&lt;ProjectName&gt;/Plugins/com.phonegap.plugins.facebookconnect -include /var/folders/pn/gg2pmp494ddc28vb35296c7r0000gn/C/com.apple.DeveloperTools/6.0-6A313/Xcode/SharedPrecompiledHeaders/&lt;ProjectName&gt;-Prefix-buzdrrssmquhyjccbctulbjeosdy/&lt;ProjectName&gt;-Prefix.pch -MMD -MT dependencies -MF /Users/&lt;user&gt;/Development/20/&lt;ProjectName&gt;/platforms/ios/build/&lt;ProjectName&gt;.build/Release-iphonesimulator/&lt;ProjectName&gt;.build/Objects-normal/i386/AdjustCordova.d --serialize-diagnostics /Users/&lt;user&gt;/Development/20/&lt;ProjectName&gt;/platforms/ios/build/&lt;ProjectName&gt;.build/Release-iphonesimulator/&lt;ProjectName&gt;.build/Objects-normal/i386/AdjustCordova.dia -c /Users/&lt;user&gt;/Development/20/&lt;ProjectName&gt;/platforms/ios/&lt;ProjectName&gt;/Plugins/com.adjust.sdk/AdjustCordova.m -o /Users/&lt;user&gt;/Development/20/&lt;ProjectName&gt;/platforms/ios/build/&lt;ProjectName&gt;.build/Release-iphonesimulator/&lt;ProjectName&gt;.build/Objects-normal/i386/AdjustCordova.o
  In file included from /Users/&lt;user&gt;/Development/20/&lt;ProjectName&gt;/platforms/ios/&lt;ProjectName&gt;/Plugins/com.adjust.sdk/AdjustCordova.m:9:
  /Users/&lt;user&gt;/Development/20/&lt;ProjectName&gt;/platforms/ios/&lt;ProjectName&gt;/Plugins/com.adjust.sdk/AdjustCordova.h:9:9: fatal error: 'Cordova/CDV.h' file not found
  #import &lt;Cordova/CDV.h&gt;
          ^
  1 error generated.
  
  ... //////////  This error happens multiple times.
  
  /Users/&lt;user&gt;/Development/20/&lt;ProjectName&gt;/platforms/ios/&lt;ProjectName&gt;/Plugins/com.aquto.cordova.AppleAdvertising/AppleAdvertising.h:2:9: fatal error: 'Cordova/CDV.h' file not found
  #import &lt;Cordova/CDV.h&gt;
          ^
  1 error generated.
  
  ** BUILD FAILED **
  
  
  The following build commands failed:
      CompileC build/&lt;ProjectName&gt;.build/Release-iphonesimulator/&lt;ProjectName&gt;.build/Objects-normal/i386/AdjustCordova.o &lt;ProjectName&gt;/Plugins/com.adjust.sdk/AdjustCordova.m normal i386 objective-c com.apple.compilers.llvm.clang.1_0.compiler
      CompileC build/&lt;ProjectName&gt;.build/Release-iphonesimulator/&lt;ProjectName&gt;.build/Objects-normal/i386/APPLocalNotification.o &lt;ProjectName&gt;/Plugins/de.appplant.cordova.plugin.local-notification/APPLocalNotification.m normal i386 objective-c com.apple.compilers.llvm.clang.1_0.compiler
      CompileC build/&lt;ProjectName&gt;.build/Release-iphonesimulator/&lt;ProjectName&gt;.build/Objects-normal/i386/CDVConnection.o &lt;ProjectName&gt;/Plugins/org.apache.cordova.network-information/CDVConnection.m normal i386 objective-c com.apple.compilers.llvm.clang.1_0.compiler
      CompileC build/&lt;ProjectName&gt;.build/Release-iphonesimulator/&lt;ProjectName&gt;.build/Objects-normal/i386/CDVAssetLibraryFilesystem.o &lt;ProjectName&gt;/Plugins/org.apache.cordova.file/CDVAssetLibraryFilesystem.m normal i386 objective-c com.apple.compilers.llvm.clang.1_0.compiler
      CompileC build/&lt;ProjectName&gt;.build/Release-iphonesimulator/&lt;ProjectName&gt;.build/Objects-normal/i386/AppDelegate.o &lt;ProjectName&gt;/Classes/AppDelegate.m normal i386 objective-c com.apple.compilers.llvm.clang.1_0.compiler
      CompileC build/&lt;ProjectName&gt;.build/Release-iphonesimulator/&lt;ProjectName&gt;.build/Objects-normal/i386/CDVLocalFilesystem.o &lt;ProjectName&gt;/Plugins/org.apache.cordova.file/CDVLocalFilesystem.m normal i386 objective-c com.apple.compilers.llvm.clang.1_0.compiler
      CompileC build/&lt;ProjectName&gt;.build/Release-iphonesimulator/&lt;ProjectName&gt;.build/Objects-normal/i386/CDVDevice.o &lt;ProjectName&gt;/Plugins/org.apache.cordova.device/CDVDevice.m normal i386 objective-c com.apple.compilers.llvm.clang.1_0.compiler
      CompileC build/&lt;ProjectName&gt;.build/Release-iphonesimulator/&lt;ProjectName&gt;.build/Objects-normal/i386/AppleAdvertising.o &lt;ProjectName&gt;/Plugins/com.aquto.cordova.AppleAdvertising/AppleAdvertising.m normal i386 objective-c com.apple.compilers.llvm.clang.1_0.compiler
  (8 failures)
  </code></pre>
  
  <p>No I run the command with the workspace set up and the scheme as well.</p>
  
  <pre><code>SebastiansMBP2:ios &lt;user&gt;$ xcodebuild -arch i386 -sdk iphonesimulator8.0 -workspace &lt;ProjectName&gt;.xcodeproj/project.xcworkspace -scheme &lt;ProjectName&gt;
  Build settings from command line:
      ARCHS = i386
      SDKROOT = iphonesimulator8.0
  
  === BUILD TARGET CordovaLib OF PROJECT CordovaLib WITH CONFIGURATION Debug ===
  
  Check dependencies
  
  2014-10-21 11:44:44.905 xcodebuild[67925:365372]  DeveloperPortal: Using pre-existing current store at URL (file:///Users/&lt;user&gt;/Library/Developer/Xcode/DeveloperPortal%206.0.db).
  === BUILD TARGET &lt;ProjectName&gt; OF PROJECT &lt;ProjectName&gt; WITH CONFIGURATION Debug ===
  
  Check dependencies
  
  ....
  
  ** BUILD SUCCEEDED **
  </code></pre>
  
  <p>Now I run the generated build on an <code>ios-sim</code>:</p>
  
  <pre><code>SebastiansMBP2:ios &lt;user&gt;$ ios-sim launch /Users/&lt;user&gt;/Development/20/&lt;ProjectName&gt;/platforms/ios/build/Release-iphonesimulator/&lt;ProjectName&gt;.app
  Session could not be started: Error Domain=LaunchServicesError Code=0 "Unable to run app in Simulator" UserInfo=0x7f8993721ad0 {Error=ExecutableTwiddleFailed, ErrorDescription=Failed to chmod file:///Users/&lt;user&gt;/Library/Developer/CoreSimulator/Devices/B745FCEF-0713-419B-B5EF-5274C912DA7E/data/Library/Caches/com.apple.containermanagerd/Temp/Bundle/Application/D615484C-04F7-496D-AB61-4A988E4357C3/&lt;ProjectName&gt;.app/&lt;ProjectName&gt; : No such file or directory, NSLocalizedFailureReason=An error was encountered while running (Domain = LaunchServicesError, Code = 0), NSUnderlyingError=0x7f8993415850 "The operation couldn’t be completed. (LaunchServicesError error 0.)", NSLocalizedDescription=Unable to run app in Simulator}
  </code></pre>
  
  <p>(username, project name and other privacy related parts have been replaced)</p>
  
  <p>Do you have any ideas how to fix this and how to build a version that can be used to upload it to Facebook?</p>
  
  <p>I'm running <code>Xcode 6</code>, updated the <code>ios-sim</code> to version <code>3.0.0</code> and updated <code>cordova-cli</code> to version <code>4.0.0</code> with the iOS platform version <code>3.6.3</code>.</p>
  
  <p>Building the application via <code>cordova build iOS</code> and via <code>Xcode</code> directly works fine!</p>
  
  <p>Thanks!</p>