I just upgraded Xcode to version 4.5, but I now get this error when trying to run it on my 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.
edit: It can also be that the project expects you to have http://www.iosopendev.com/ installed.
My error was "target specifies product type 'com.apple.product-type.library.dynamic', but there's no such product type for the 'iphoneos' platform"
Inside of the appropriate directory, per TwiterZX's's comment, run the following commands:
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.
After the first [ inside of iPhoneOSProductTypes.xcspec, paste:
{ "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:
{ "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!
You probably lost The application part from your XCode Specifications
Exit XCode and Go to (for Xcode from MacAppStore):
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/Xcode/Specifications/
Backup these two files before editing: iPhoneOSPackageTypes.xcspec
iPhoneOSProductTypes.xcspec
Overwrite this content to 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
<?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>
Restart XCode then Clean your Project and build it again for you device.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With