Project wont run on simulator in xcode 8

2019-09-06 09:34发布

问题:

After upgrading to xcode8, my project will no longer run on the simulator (runs on a device)

Error:

  /Users/johnsmith/Library/Developer/Xcode/DerivedData/JT-fnslglvifmonzwhlgrchcqujqiwt/Build/Products/Debug-iphonesimulator/
Assets.bundle: Is a directory

    Command /usr/bin/codesign failed with exit code 1

I have deleted the entire deriveddata folder and cleaned the project several times with no success. Any ideas how to fix please?

回答1:

If you are using CocoaPods (especially an older version), you'll notice that all the resource bundle targets in the pods project file don't have an info.plist. Set them all using CocoaPods generic Info.plist and it'll run. This however is not a permanent solution. It will reset on next pod install

https://forums.developer.apple.com/thread/66538

EDIT: If you don't happen to have a generic plist file in your project already create a new file Info.plist in Pods Target Support Files/Pods-<App Name>/ and paste this

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
  <key>CFBundleDevelopmentRegion</key>
  <string>en</string>
  <key>CFBundleIdentifier</key>
  <string>org.cocoapods.${PRODUCT_NAME:rfc1034identifier}</string>
  <key>CFBundleInfoDictionaryVersion</key>
  <string>6.0</string>
  <key>CFBundleName</key>
  <string>${PRODUCT_NAME}</string>
  <key>CFBundlePackageType</key>
  <string>BNDL</string>
  <key>CFBundleShortVersionString</key>
  <string>1.0.0</string>
  <key>CFBundleSignature</key>
  <string>????</string>
  <key>CFBundleVersion</key>
  <string>${CURRENT_PROJECT_VERSION}</string>
  <key>NSPrincipalClass</key>
  <string></string>
</dict>
</plist>

EDIT 2: Fixed the values above. Apple won't accept it when uploading to App Store the way it previously was. It shouldn't have CFBundleExecutable and the CFBundlePackageType should be set to BNDL



标签: ios xcode