Search code examples
ioscocoapodsxcframework

Pod lib lint fails for xcframework


I have xcode project with static lib and aggregate solution where I added Multi Platform Script at Build Phases so I can create xcframework:

SCHEME_NAME=${PROJECT_NAME}
FRAMEWORK_NAME=${PROJECT_NAME}
SIMULATOR_ARCHIVE_PATH="${BUILD_DIR}/${CONFIGURATION}/${FRAMEWORK_NAME}-iphonesimulator.xcarchive"
DEVICE_ARCHIVE_PATH="${BUILD_DIR}/${CONFIGURATION}/${FRAMEWORK_NAME}-iphoneos.xcarchive"
# Simulator xcarchieve
xcodebuild archive \
  -scheme ${SCHEME_NAME} \
  -archivePath ${SIMULATOR_ARCHIVE_PATH} \
  -sdk iphonesimulator \
  SKIP_INSTALL=NO \
  BUILD_LIBRARY_FOR_DISTRIBUTION=YES 
# Device xcarchieve
xcodebuild archive \
  -scheme ${SCHEME_NAME} \
  -archivePath ${DEVICE_ARCHIVE_PATH} \
  -sdk iphoneos \
  SKIP_INSTALL=NO \
  BUILD_LIBRARY_FOR_DISTRIBUTION=YES 
# Remove older version
rm -rf "${HOME}/Desktop/${FRAMEWORK_NAME}_${APPOXEE_SDK_VERSION}"

# Create Products && Documentation && SDK directories
mkdir -p "${HOME}/Desktop/${FRAMEWORK_NAME}_${APPOXEE_SDK_VERSION}/Documentation"
mkdir -p "${HOME}/Desktop/${FRAMEWORK_NAME}_${APPOXEE_SDK_VERSION}/SDK"

# Create xcframwork combine of all frameworks
xcodebuild -create-xcframework \
  -library ${SIMULATOR_ARCHIVE_PATH}/Products/usr/local/lib/lib${FRAMEWORK_NAME}.a -headers ${SIMULATOR_ARCHIVE_PATH}/Products/usr/local/lib/${FRAMEWORK_NAME}Headers \
  -library ${DEVICE_ARCHIVE_PATH}/Products/usr/local/lib/lib${FRAMEWORK_NAME}.a -headers ${DEVICE_ARCHIVE_PATH}/Products/usr/local/lib/${FRAMEWORK_NAME}Headers\
  -output ${HOME}/Desktop/${FRAMEWORK_NAME}_${APPOXEE_SDK_VERSION}/SDK/${FRAMEWORK_NAME}.xcframework

which creates xcframework just fine. Inside that xcframework there is info.plist enter image description here

which says that all architecture arm64, armv7 and i386, x86_64 are present at xcfremework, the same results I have when I do lipo -info

Podspec file looks like:

Pod::Spec.new do |s|

  s.name         = "TestSDK"
  s.version      = "6.0.4"
  s.summary      = "Test SDK enables developers to harnest the full power of Test Engage Platform on their iOS applications."
  s.description  =  <<-DESC
                    Test SDK enables push notification in your iOS application, for engaging your application users and increasing retention.
                    DESC
  s.homepage     = "https://mapp.com"
  s.license      = { :type => "Custom", :file => "Licence.txt" }
  s.author       = { "Test Digital" => "https://test.com/contact-us/" }
  s.source       = { :git => "https://github.com/TestCloud/TestSDK.git", :tag => "6.0.4" }
  s.ios.framework = 'UserNotifications'
  s.platform     = :ios, "10.0"
  s.ios.vendored_frameworks = "SDK/TestSDK.xcframework"
  s.preserve_paths = 'SDK/TestSDK.xcframework'
  s.resource_bundle = { 'TestSDKResources' => 'SDK/TestSDKResources.bundle' }
  s.requires_arc = true

end

and pod lib lint returns me an error: Unable to find matching .xcframework slice in '../../../../../../../../Users/ssad.ter/Desktop/private_pod/TestSDK/SDK/TestSDK.xcframework RwarSDK library ios-arm64_armv7 ios-i386_x86_64-simulator' for the current build architectures (arm64 x86_64 i386).

but it contains those architecture as I explained.

the only way when pod lib lint went successfully is when I add to pod lib lint --configuration=Debug

But from the script you can see that Build for Distribution is set to YES and SKIP INSTALL to NO, same thing is done at build settings at XCode. And the Archive when you go to Edit scheme option at XCode is set to Release mode.

Can someone point me what may be the problem here?


Solution

  • Your plist shows you have only x86_64 and i386 architecture available for the simulator. Are you running the command on M1 mac? If yes you need to have arm64 arch support for the simulator as well or you can run pod lib lint under rosetta emulation like this:

    arch -x86_64 pod lib lint