Easy methods to make CocoaPods use iOS SDK when validating podspec?


Is there an choice to make CocoaPods use iphoneos SDK as an alternative of iphonesimulator?

I am making an attempt to create a CocoaPods bundle with the iOS framework. I’ve arrange an area repo, created easy podspec pointing to zipped framework on my native machine and tried to push it. I am utilizing Intel x86_64 MacBook and my framework solely contains arm64 binaries.

Pod::Spec.new do |spec|
  spec.title         = "MyFramework"
  spec.model      = "0.0.1"
  spec.abstract      = "A brief description of MyFramework."
  spec.description  = <<-DESC
  take a look at creating podspec 
                   DESC
  spec.homepage     = "http://EXAMPLE/MyFramework"
  spec.license      = "WTFPL"
  spec.creator       = "Spec Writer"
  spec.platform     = :ios, "13.0"
  spec.supply       = { :http => 'file:///Customers/sergey/my-cocoapods-specs/MyFramework.framework.zip' }
  spec.ios.vendored_framework = "MyFramework.framework"
finish

On pushing the podspec CocoaPods tries to validate it by creating and constructing Xcode undertaking

-> Pod set up full! There's 1 dependency from the Podfile and 1 complete pod put in.
  Constructing with `xcodebuild`. 
  $ /usr/bin/xcodebuild clear construct -workspace
  /var/folders/_p/rv1wb_yx36bbblqmbs9vk6zc0000gn/T/CocoaPods-Lint-20230623-39252-s3fsmh-MyFramework/App.xcworkspace -scheme App -configuration Launch
  CODE_SIGN_IDENTITY=- -sdk iphonesimulator -destination id=16F6C838-B862-433E-95F5-1D261BF21FD5
  2023-06-23 10:34:17.741 xcodebuild[39262:37065719] DVTCoreDeviceEnabledState: DVTCoreDeviceEnabledState_Disabled set through person default (DVTEnableCoreDevice=disabled)
  Command line invocation:
      /Purposes/Xcode.app/Contents/Developer/usr/bin/xcodebuild clear construct -workspace /var/folders/_p/rv1wb_yx36bbblqmbs9vk6zc0000gn/T/CocoaPods-Lint-20230623-39252-s3fsmh-MyFramework/App.xcworkspace -scheme App -configuration Launch CODE_SIGN_IDENTITY=- -sdk iphonesimulator -destination id=16F6C838-B862-433E-95F5-1D261BF21FD5

  Person defaults from command line:
      IDEPackageSupportUseBuiltinSCM = YES

  Construct settings from command line:
      CODE_SIGN_IDENTITY = -
      SDKROOT = iphonesimulator16.4

and fails with linker error

ld: constructing for iOS Simulator, however linking in dylib constructed for iOS, file '/var/folders/_p/rv1wb_yx36bbblqmbs9vk6zc0000gn/T/CocoaPods-Lint-20230626-14275-uyh1a7-MyFramework/Pods/MyFramework/MyFramework.framework/mylibrary' for structure arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

I attempted to set SDKROOT in xcconfig part:

  spec.pod_target_xcconfig = {
      'SDKROOT' => 'iphoneos16.4'
  }
  spec.user_target_xcconfig = {
      'SDKROOT' => 'iphoneos16.4'
  }

however CocoaPods retains placing -sdk iphonesimulator to xcodebuild invocation.

Related Articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest Articles