Xcode 4.5:iphoneos 没有“com.apple.product-type.application”产品类型

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/12549633/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 01:35:12  来源:igfitidea点击:

Xcode 4.5: no "com.apple.product-type.application" product type for iphoneos

xcodecompiler-errorsxcode4.5

提问by Tyilo

I just upgraded Xcode to version 4.5, but I now get this error when trying to run it on my iPhone:

我刚刚将 Xcode 升级到 4.5 版,但现在尝试在我的 iPhone 上运行它时出现此错误:

target specifies product type 'com.apple.product-type.application', but there's no such product type for the 'iphoneos' platform

It works fine on the simulator and it used to work in version 4.4.

它在模拟器上运行良好,它曾经在 4.4 版中运行。

采纳答案by Riad Krim

You probably lost The application part from your XCode Specifications

您可能丢失了 XCode 规范中的应用程序部分

Exit XCodeand Go to(for Xcode from MacAppStore):

退出XCode转到(对于 MacAppStore 中的 Xcode):

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/Xcode/Specifications/

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/Xcode/Specifications/

Backup these two files before editing: iPhoneOSPackageTypes.xcspeciPhoneOSProductTypes.xcspec

编辑前备份这两个文件: iPhoneOSPackageTypes.xcspeciPhoneOSProductTypes.xcspec

Overwrite this content to iPhoneOSPackageTypes.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>

and this content to iPhoneOSProductTypes.xcspec

和这个内容 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 &amp;&amp; $(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>

Restart XCode then Clean your Project and build it again for you device.

重新启动 XCode,然后清理您的项目并为您的设备再次构建它。

回答by Joseph Lennox

edit: It can also be that the project expects you to have http://www.iosopendev.com/installed.

编辑:也可能是该项目希望您安装http://www.iosopendev.com/

My error was "target specifies product type 'com.apple.product-type.library.dynamic', but there's no such product type for the 'iphoneos' platform"

我的错误是“目标指定产品类型'com.apple.product-type.library.dynamic',但'iphoneos'平台没有这样的产品类型”

Inside of the appropriate directory, per TwiterZX's's comment, run the following commands:

在适当的目录中,根据 TwiterZX 的评论,运行以下命令:

sudo plutil -convert json iPhoneOSProductTypes.xcspec
sudo plutil -convert json iPhoneOSPackageTypes.xcspec

Editing these files can be made a lot easier if you use a json pretty service on your file's contents first.

如果您首先在文件内容上使用 json 漂亮服务,则可以更轻松地编辑这些文件。

After the first [ inside of iPhoneOSProductTypes.xcspec, paste:

在 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"
    ]
},

After the first [ inside of iPhoneOSPackageTypes.xcspec, paste:

在 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"
    }
},

Now you need to convert those files back to binary:

现在您需要将这些文件转换回二进制文件:

sudo plutil -convert binary1 iPhoneOSProductTypes.xcspec
sudo plutil -convert binary1 iPhoneOSPackageTypes.xcspec

That should do it!

应该这样做!