Xcode 11.4 issue: iOS xibs do not support target device type "iphone"

I've got a problem bulding a framework from the commandline. I want to build a framework that I want to use in multiple apps.


Using XCode 11.4 and the appropriate command line tools, I cannot build it. It always leads to the following error when it wants to compile xibs:


CompileXIB /Users/homeoffice/Entwicklung/iOS-Entwicklung/hr-appcommons-ios/appcommons/SophoraDocument/View/Views/Document/GeoTagCollectionCell.xib (in target 'appcommons' from project 'appcommons')
    cd /Users/homeoffice/Entwicklung/iOS-Entwicklung/hr-appcommons-ios
    export XCODE_DEVELOPER_USR_PATH=/Applications/Xcode.app/Contents/Developer/usr/bin/..
    /Applications/Xcode.app/Contents/Developer/usr/bin/ibtool --errors --warnings --notices --platform macosx --module appcommons --output-partial-info-plist /Users/homeoffice/Entwicklung/iOS-Entwicklung/hr-appcommons-ios/build/appcommons.build/Release-iphoneos/appcommons.build/GeoTagCollectionCell-PartialInfo.plist --auto-activate-custom-fonts --target-device iphone --target-device ipad --minimum-deployment-target 13.1 --output-format human-readable-text --compile /Users/homeoffice/Entwicklung/iOS-Entwicklung/hr-appcommons-ios/build/Release-iphoneos/appcommons.framework/GeoTagCollectionCell.nib /Users/homeoffice/Entwicklung/iOS-Entwicklung/hr-appcommons-ios/appcommons/SophoraDocument/View/Views/Document/GeoTagCollectionCell.xib
/* com.apple.ibtool.errors */
/Users/homeoffice/Entwicklung/iOS-Entwicklung/hr-appcommons-ios/appcommons/SophoraDocument/View/Views/Document/GeoTagCollectionCell.xib: error: iOS xibs do not support target device type "iphone".


Using XCode 11.3.1 and the approproate command line tools, the build works and compileing the exact same xib is just fine:


CompileXIB /Users/homeoffice/Entwicklung/iOS-Entwicklung/hr-appcommons-ios/appcommons/SophoraDocument/View/Views/Document/GeoTagCollectionCell.xib (in target 'appcommons' from project 'appcommons')
    cd /Users/homeoffice/Entwicklung/iOS-Entwicklung/hr-appcommons-ios
    export XCODE_DEVELOPER_USR_PATH="/Applications/Xcode 11.3.1.app/Contents/Developer/usr/bin/.."
    /Applications/Xcode\ 11.3.1.app/Contents/Developer/usr/bin/ibtool --errors --warnings --notices --platform macosx --target-device ipad --module appcommons --output-partial-info-plist /Users/homeoffice/Entwicklung/iOS-Entwicklung/hr-appcommons-ios/build/appcommons.build/Release-iphonesimulator/appcommons.build/GeoTagCollectionCell-PartialInfo.plist --auto-activate-custom-fonts --minimum-deployment-target 13.1 --output-format human-readable-text --compile /Users/homeoffice/Entwicklung/iOS-Entwicklung/hr-appcommons-ios/build/Release-iphonesimulator/appcommons.framework/GeoTagCollectionCell.nib /Users/homeoffice/Entwicklung/iOS-Entwicklung/hr-appcommons-ios/appcommons/SophoraDocument/View/Views/Document/GeoTagCollectionCell.xib
2020-04-15 10:59:37.608 ibtoold[20964:142218] DEBUG: Added to environment: {
    CFStringDisableROM = 1;
}

It seems like the programm ibtool in XCode 11.4 is placing an extra parameter --target-device iphone and this target device is unknown.

Interestingly, I can build the framework within XCode. I can archive it and use ist.

With the commandline, however, it fails.

I am building like so:

xcodebuild -project appcommons.xcodeproj -scheme build-framework -configuration Release clean build



Any ideas?

Replies

Me too, :(
any update here?

I'm facing the same issue with Xcode 12.5

I came across the problem when I created a xib inside an spm package, it seems like that Xcode uses a broken xib template. I resolved the issue by opening the xib as source and replacing the document and device tag with the following code:

<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="16097" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">

    <device id="retina4_7" orientation="portrait" appearance="light"/>

For the ones that have that issue, simply add -destination 'generic/platform=iOS' in your command

xcodebuild -project appcommons.xcodeproj -scheme build-framework -configuration Release -destination 'generic/platform=iOS' clean build

That will remove --platform macosx and set the correct --minimum-deployment-target 13.1 from ibtool command line