我刚刚将 Xcode 升级到 4.5 版,但现在尝试在我的 iPhone 上运行它时出现此错误:
target specifies product type 'com.apple.product-type.application', but there's no such product type for the 'iphoneos' platform
它在模拟器上运行良好,并且曾经在 4.4 版中运行。
我刚刚将 Xcode 升级到 4.5 版,但现在尝试在我的 iPhone 上运行它时出现此错误:
target specifies product type 'com.apple.product-type.application', but there's no such product type for the 'iphoneos' platform
它在模拟器上运行良好,并且曾经在 4.4 版中运行。
编辑:也可能是该项目希望您安装http://www.iosopendev.com/。
我的错误是“目标指定产品类型‘com.apple.product-type.library.dynamic’,但‘iphoneos’平台没有这样的产品类型”
在适当的目录中,根据 TwiterZX 的评论,运行以下命令:
sudo plutil -convert json iPhoneOSProductTypes.xcspec
sudo plutil -convert json iPhoneOSPackageTypes.xcspec
如果您首先在文件内容上使用 json pretty 服务,那么编辑这些文件会容易得多。
在 iPhoneOSProductTypes.xcspec 的第一个 [ 之后,粘贴:
{ "Type": "ProductType",
"Identifier": "com.apple.product-type.library.dynamic",
"Class": "PBXDynamicLibraryProductType",
"Name": "Dynamic Library",
"Description": "Dynamic library",
"IconNamePrefix": "TargetPlugin",
"DefaultTargetName": "Dynamic Library",
"DefaultBuildProperties": {
"FULL_PRODUCT_NAME": "$(EXECUTABLE_NAME)",
"MACH_O_TYPE": "mh_dylib",
"REZ_EXECUTABLE": "YES",
"EXECUTABLE_SUFFIX": ".$(EXECUTABLE_EXTENSION)",
"EXECUTABLE_EXTENSION": "dylib",
"PUBLIC_HEADERS_FOLDER_PATH": "/usr/local/include",
"PRIVATE_HEADERS_FOLDER_PATH": "/usr/local/include",
"INSTALL_PATH": "/usr/local/lib",
"DYLIB_INSTALL_NAME_BASE": "$(INSTALL_PATH)",
"LD_DYLIB_INSTALL_NAME": "$(DYLIB_INSTALL_NAME_BASE:standardizepath)/$(EXECUTABLE_PATH)",
"DYLIB_COMPATIBILITY_VERSION": "1",
"DYLIB_CURRENT_VERSION": "1",
"FRAMEWORK_FLAG_PREFIX": "-framework",
"LIBRARY_FLAG_PREFIX": "-l",
"LIBRARY_FLAG_NOSPACE": "YES",
"STRIP_STYLE": "debugging",
"GCC_INLINES_ARE_PRIVATE_EXTERN": "YES",
"CODE_SIGNING_ALLOWED": "YES"
},
"PackageTypes": [
"com.apple.package-type.mach-o-dylib"
]
},
在 iPhoneOSPackageTypes.xcspec 的第一个 [ 之后,粘贴:
{ "Type": "PackageType",
"Identifier": "com.apple.package-type.mach-o-dylib",
"Name": "Mach-O Dynamic Library",
"Description": "Mach-O dynamic library",
"DefaultBuildSettings": {
"EXECUTABLE_PREFIX": "",
"EXECUTABLE_SUFFIX": "",
"EXECUTABLE_NAME": "$(EXECUTABLE_PREFIX)$(PRODUCT_NAME)$(EXECUTABLE_VARIANT_SUFFIX)$(EXECUTABLE_SUFFIX)",
"EXECUTABLE_PATH": "$(EXECUTABLE_NAME)"
},
"ProductReference": {
"FileType": "compiled.mach-o.dylib",
"Name": "$(EXECUTABLE_NAME)",
"IsLaunchable": "NO"
}
},
现在您需要将这些文件转换回二进制文件:
sudo plutil -convert binary1 iPhoneOSProductTypes.xcspec
sudo plutil -convert binary1 iPhoneOSPackageTypes.xcspec
应该这样做!
您可能丢失了 XCode 规范中的应用程序部分
退出XCode并转到(对于来自 MacAppStore 的 Xcode):
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/Xcode/Specifications/
编辑前备份这两个文件: iPhoneOSPackageTypes.xcspec
iPhoneOSProductTypes.xcspec
将此内容覆盖为iPhoneOSPackageTypes.xcspec
<?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">
<array>
<dict>
<key>DefaultBuildSettings</key>
<dict>
<key>CONTENTS_FOLDER_PATH</key>
<string>$(WRAPPER_NAME)</string>
<key>DOCUMENTATION_FOLDER_PATH</key>
<string>$(LOCALIZED_RESOURCES_FOLDER_PATH)/Documentation</string>
<key>EXECUTABLES_FOLDER_PATH</key>
<string>$(CONTENTS_FOLDER_PATH)/Executables</string>
<key>EXECUTABLE_FOLDER_PATH</key>
<string>$(CONTENTS_FOLDER_PATH)</string>
<key>EXECUTABLE_NAME</key>
<string>$(EXECUTABLE_PREFIX)$(PRODUCT_NAME)$(EXECUTABLE_VARIANT_SUFFIX)$(EXECUTABLE_SUFFIX)</string>
<key>EXECUTABLE_PATH</key>
<string>$(EXECUTABLE_FOLDER_PATH)/$(EXECUTABLE_NAME)</string>
<key>EXECUTABLE_PREFIX</key>
<string></string>
<key>EXECUTABLE_SUFFIX</key>
<string></string>
<key>FRAMEWORKS_FOLDER_PATH</key>
<string>$(CONTENTS_FOLDER_PATH)/Frameworks</string>
<key>INFOPLIST_PATH</key>
<string>$(CONTENTS_FOLDER_PATH)/Info.plist</string>
<key>INFOSTRINGS_PATH</key>
<string>$(LOCALIZED_RESOURCES_FOLDER_PATH)/InfoPlist.strings</string>
<key>JAVA_FOLDER_PATH</key>
<string>$(UNLOCALIZED_RESOURCES_FOLDER_PATH)/Java</string>
<key>LOCALIZED_RESOURCES_FOLDER_PATH</key>
<string>$(UNLOCALIZED_RESOURCES_FOLDER_PATH)/$(DEVELOPMENT_LANGUAGE).lproj</string>
<key>PBDEVELOPMENTPLIST_PATH</key>
<string>$(CONTENTS_FOLDER_PATH)/pbdevelopment.plist</string>
<key>PKGINFO_PATH</key>
<string>$(CONTENTS_FOLDER_PATH)/PkgInfo</string>
<key>PLUGINS_FOLDER_PATH</key>
<string>$(CONTENTS_FOLDER_PATH)/PlugIns</string>
<key>PRIVATE_HEADERS_FOLDER_PATH</key>
<string>$(CONTENTS_FOLDER_PATH)/PrivateHeaders</string>
<key>PUBLIC_HEADERS_FOLDER_PATH</key>
<string>$(CONTENTS_FOLDER_PATH)/Headers</string>
<key>SCRIPTS_FOLDER_PATH</key>
<string>$(UNLOCALIZED_RESOURCES_FOLDER_PATH)/Scripts</string>
<key>SHALLOW_BUNDLE</key>
<string>YES</string>
<key>SHARED_FRAMEWORKS_FOLDER_PATH</key>
<string>$(CONTENTS_FOLDER_PATH)/SharedFrameworks</string>
<key>SHARED_SUPPORT_FOLDER_PATH</key>
<string>$(CONTENTS_FOLDER_PATH)/SharedSupport</string>
<key>UNLOCALIZED_RESOURCES_FOLDER_PATH</key>
<string>$(CONTENTS_FOLDER_PATH)</string>
<key>VERSIONPLIST_PATH</key>
<string>$(CONTENTS_FOLDER_PATH)/version.plist</string>
<key>WRAPPER_NAME</key>
<string>$(WRAPPER_PREFIX)$(PRODUCT_NAME)$(WRAPPER_SUFFIX)</string>
<key>WRAPPER_PREFIX</key>
<string></string>
<key>WRAPPER_SUFFIX</key>
<string>.bundle</string>
</dict>
<key>Description</key>
<string>Wrapper</string>
<key>Identifier</key>
<string>com.apple.package-type.wrapper</string>
<key>Name</key>
<string>Wrapper</string>
<key>ProductReference</key>
<dict>
<key>FileType</key>
<string>wrapper.cfbundle</string>
<key>IsLaunchable</key>
<string>NO</string>
<key>Name</key>
<string>$(WRAPPER_NAME)</string>
</dict>
<key>Type</key>
<string>PackageType</string>
</dict>
<dict>
<key>BasedOn</key>
<string>com.apple.package-type.wrapper</string>
<key>DefaultBuildSettings</key>
<dict>
<key>GENERATE_PKGINFO_FILE</key>
<string>YES</string>
</dict>
<key>Description</key>
<string>Application Wrapper</string>
<key>Identifier</key>
<string>com.apple.package-type.wrapper.application</string>
<key>Name</key>
<string>Application Wrapper</string>
<key>ProductReference</key>
<dict>
<key>FileType</key>
<string>wrapper.application</string>
<key>IsLaunchable</key>
<string>YES</string>
<key>Name</key>
<string>$(WRAPPER_NAME)</string>
</dict>
<key>Type</key>
<string>PackageType</string>
</dict>
<dict>
<key>BasedOn</key>
<string>com.apple.package-type.wrapper</string>
<key>DefaultBuildSettings</key>
<dict>
<key>CONTENTS_FOLDER_PATH</key>
<string>$(WRAPPER_NAME)/Contents</string>
<key>DOCUMENTATION_FOLDER_PATH</key>
<string>$(LOCALIZED_RESOURCES_FOLDER_PATH)</string>
<key>EXECUTABLES_FOLDER_PATH</key>
<string>$(CONTENTS_FOLDER_PATH)</string>
<key>EXECUTABLE_FOLDER_PATH</key>
<string>$(CONTENTS_FOLDER_PATH)</string>
<key>FRAMEWORKS_FOLDER_PATH</key>
<string>$(CONTENTS_FOLDER_PATH)</string>
<key>INFOPLIST_PATH</key>
<string>$(WRAPPER_NAME)/ContentInfo.plist</string>
<key>INFOSTRINGS_PATH</key>
<string>$(LOCALIZED_RESOURCES_FOLDER_PATH)/ContentInfo.strings</string>
<key>JAVA_FOLDER_PATH</key>
<string>$(UNLOCALIZED_RESOURCES_FOLDER_PATH)</string>
<key>LOCALIZED_RESOURCES_FOLDER_PATH</key>
<string>$(UNLOCALIZED_RESOURCES_FOLDER_PATH)/$(DEVELOPMENT_LANGUAGE).lproj</string>
<key>PLUGINS_FOLDER_PATH</key>
<string>$(CONTENTS_FOLDER_PATH)</string>
<key>PRIVATE_HEADERS_FOLDER_PATH</key>
<string>$(CONTENTS_FOLDER_PATH)</string>
<key>PUBLIC_HEADERS_FOLDER_PATH</key>
<string>$(CONTENTS_FOLDER_PATH)</string>
<key>SCRIPTS_FOLDER_PATH</key>
<string>$(UNLOCALIZED_RESOURCES_FOLDER_PATH)</string>
<key>SHARED_FRAMEWORKS_FOLDER_PATH</key>
<string>$(CONTENTS_FOLDER_PATH)</string>
<key>SHARED_SUPPORT_FOLDER_PATH</key>
<string>$(CONTENTS_FOLDER_PATH)</string>
<key>UNLOCALIZED_RESOURCES_FOLDER_PATH</key>
<string>$(CONTENTS_FOLDER_PATH)</string>
<key>WRAPPER_SUFFIX</key>
<string></string>
</dict>
<key>Description</key>
<string>In-App Purchase Content</string>
<key>Identifier</key>
<string>com.apple.package-type.in-app-purchase-content</string>
<key>Name</key>
<string>In-App Purchase Content</string>
<key>ProductReference</key>
<dict>
<key>FileType</key>
<string>folder</string>
<key>IsLaunchable</key>
<string>NO</string>
<key>Name</key>
<string>$(WRAPPER_NAME)</string>
</dict>
<key>Type</key>
<string>PackageType</string>
</dict>
<dict>
<key>DefaultBuildSettings</key>
<dict>
<key>EXECUTABLE_NAME</key>
<string>$(EXECUTABLE_PREFIX)$(PRODUCT_NAME)$(EXECUTABLE_VARIANT_SUFFIX)$(EXECUTABLE_SUFFIX)</string>
<key>EXECUTABLE_PATH</key>
<string>$(EXECUTABLE_NAME)</string>
<key>EXECUTABLE_PREFIX</key>
<string>lib</string>
<key>EXECUTABLE_SUFFIX</key>
<string>.a</string>
</dict>
<key>Description</key>
<string>Mach-O static library</string>
<key>Identifier</key>
<string>com.apple.package-type.static-library</string>
<key>Name</key>
<string>Mach-O Static Library</string>
<key>ProductReference</key>
<dict>
<key>FileType</key>
<string>archive.ar</string>
<key>IsLaunchable</key>
<string>NO</string>
<key>Name</key>
<string>$(EXECUTABLE_NAME)</string>
</dict>
<key>Type</key>
<string>PackageType</string>
</dict>
</array>
</plist>
和这个内容iPhoneOSProductTypes.xcspec
<?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">
<array>
<dict>
<key>Class</key>
<string>PBXBundleProductType</string>
<key>DefaultBuildProperties</key>
<dict>
<key>FRAMEWORK_FLAG_PREFIX</key>
<string>-framework</string>
<key>FULL_PRODUCT_NAME</key>
<string>$(WRAPPER_NAME)</string>
<key>GCC_INLINES_ARE_PRIVATE_EXTERN</key>
<string>YES</string>
<key>LIBRARY_FLAG_NOSPACE</key>
<string>YES</string>
<key>LIBRARY_FLAG_PREFIX</key>
<string>-l</string>
<key>MACH_O_TYPE</key>
<string>mh_bundle</string>
<key>STRIP_STYLE</key>
<string>non-global</string>
<key>WRAPPER_EXTENSION</key>
<string>bundle</string>
<key>WRAPPER_NAME</key>
<string>$(WRAPPER_PREFIX)$(PRODUCT_NAME)$(WRAPPER_SUFFIX)</string>
<key>WRAPPER_PREFIX</key>
<string></string>
<key>WRAPPER_SUFFIX</key>
<string>.$(WRAPPER_EXTENSION)</string>
</dict>
<key>DefaultTargetName</key>
<string>Bundle</string>
<key>Description</key>
<string>Generic bundle</string>
<key>HasInfoPlist</key>
<string>YES</string>
<key>HasInfoPlistStrings</key>
<string>YES</string>
<key>IconNamePrefix</key>
<string>TargetPlugin</string>
<key>Identifier</key>
<string>com.apple.product-type.bundle</string>
<key>IsWrapper</key>
<string>YES</string>
<key>Name</key>
<string>Bundle</string>
<key>PackageTypes</key>
<array>
<string>com.apple.package-type.wrapper</string>
</array>
<key>Type</key>
<string>ProductType</string>
</dict>
<dict>
<key>BasedOn</key>
<string>com.apple.product-type.bundle</string>
<key>Class</key>
<string>PBXApplicationProductType</string>
<key>DefaultBuildProperties</key>
<dict>
<key>CODE_SIGNING_ALLOWED</key>
<string>YES</string>
<key>ENTITLEMENTS_ALLOWED</key>
<string>YES</string>
<key>GCC_INLINES_ARE_PRIVATE_EXTERN</key>
<string>YES</string>
<key>GCC_SYMBOLS_PRIVATE_EXTERN</key>
<string>YES</string>
<key>INSTALL_PATH</key>
<string>$(LOCAL_APPS_DIR)</string>
<key>MACH_O_TYPE</key>
<string>mh_execute</string>
<key>PROVISIONING_PROFILE_REQUIRED</key>
<string>YES</string>
<key>RESOURCE_RULES_REQUIRED</key>
<string>YES</string>
<key>STRIP_STYLE</key>
<string>all</string>
<key>WRAPPER_EXTENSION</key>
<string>app</string>
<key>WRAPPER_SUFFIX</key>
<string>.$(WRAPPER_EXTENSION)</string>
</dict>
<key>DefaultTargetName</key>
<string>Application</string>
<key>Description</key>
<string>Application</string>
<key>IconNamePrefix</key>
<string>TargetApp</string>
<key>Identifier</key>
<string>com.apple.product-type.application</string>
<key>Name</key>
<string>Application</string>
<key>PackageTypes</key>
<array>
<string>com.apple.package-type.wrapper.application</string>
</array>
<key>SupportsZeroLink</key>
<string>YES</string>
<key>Type</key>
<string>ProductType</string>
<key>Validation</key>
<dict>
<key>AdditionalValidationClass</key>
<string>XCiPhoneOSPlatformPlugin</string>
<key>Checks</key>
<dict>
<key>!( $(VALIDATE_PRODUCT) == NO && $(CODE_SIGN_IDENTITY) == 'iPhone Distribution' )</key>
<string>The Validate Built Product build setting was not enabled when building for Distribution.</string>
</dict>
<key>ValidationToolSpec</key>
<string>com.apple.build-tools.platform.validate</string>
</dict>
</dict>
<dict>
<key>Class</key>
<string>PBXBundleProductType</string>
<key>DefaultBuildProperties</key>
<dict>
<key>FULL_PRODUCT_NAME</key>
<string>$(WRAPPER_NAME)</string>
</dict>
<key>Description</key>
<string>In-App Purchase Content</string>
<key>HasInfoPlist</key>
<string>YES</string>
<key>HasInfoPlistStrings</key>
<string>NO</string>
<key>Identifier</key>
<string>com.apple.product-type.in-app-purchase-content</string>
<key>IsWrapper</key>
<string>YES</string>
<key>Name</key>
<string>In-App Purchase Content</string>
<key>PackageTypes</key>
<array>
<string>com.apple.package-type.in-app-purchase-content</string>
</array>
<key>Type</key>
<string>ProductType</string>
</dict>
<dict>
<key>AlwaysPerformSeparateStrip</key>
<string>YES</string>
<key>Class</key>
<string>PBXStaticLibraryProductType</string>
<key>DefaultBuildProperties</key>
<dict>
<key>CODE_SIGNING_ALLOWED</key>
<string>NO</string>
<key>EXECUTABLE_EXTENSION</key>
<string>a</string>
<key>EXECUTABLE_PREFIX</key>
<string>lib</string>
<key>EXECUTABLE_SUFFIX</key>
<string>.$(EXECUTABLE_EXTENSION)</string>
<key>FRAMEWORK_FLAG_PREFIX</key>
<string>-framework</string>
<key>FULL_PRODUCT_NAME</key>
<string>$(EXECUTABLE_NAME)</string>
<key>GCC_ENABLE_SYMBOL_SEPARATION</key>
<string>NO</string>
<key>INSTALL_PATH</key>
<string>/usr/local/lib</string>
<key>LIBRARY_FLAG_NOSPACE</key>
<string>YES</string>
<key>LIBRARY_FLAG_PREFIX</key>
<string>-l</string>
<key>MACH_O_TYPE</key>
<string>staticlib</string>
<key>PRIVATE_HEADERS_FOLDER_PATH</key>
<string>/usr/local/include</string>
<key>PUBLIC_HEADERS_FOLDER_PATH</key>
<string>/usr/local/include</string>
<key>REZ_EXECUTABLE</key>
<string>YES</string>
<key>SEPARATE_STRIP</key>
<string>YES</string>
<key>STRIP_STYLE</key>
<string>debugging</string>
</dict>
<key>DefaultTargetName</key>
<string>Static Library</string>
<key>Description</key>
<string>Static library</string>
<key>IconNamePrefix</key>
<string>TargetLibrary</string>
<key>Identifier</key>
<string>com.apple.product-type.library.static</string>
<key>Name</key>
<string>Static Library</string>
<key>PackageTypes</key>
<array>
<string>com.apple.package-type.static-library</string>
</array>
<key>Type</key>
<string>ProductType</string>
</dict>
</array>
</plist>
重新启动 XCode,然后清理您的项目并为您的设备再次构建它。