Search code examples
macoscocoapodsmac-catalystswiftystorekit

dyld: Library not loaded: @rpath/SwiftyStoreKit.framework/Versions/A/SwiftyStoreKit - macCatalyst


Run fails with the error for mac Catalyst

require 'cocoapods-catalyst-support'
 platform :ios, '10.0'

target 'MyApp' do
 use_frameworks!

pod 'SwiftyStoreKit'
end

# Configure your macCatalyst dependencies
catalyst_configuration do
    # Uncomment the next line for a verbose output
     verbose!

    # ios '<pod_name>' # This dependency will only be available for iOS
    # macos '<pod_name>' # This dependency will only be available for macOS
end

post_install do |installer|

    installer.configure_catalyst
  installer.pods_project.targets.each do |target|
    target.build_configurations.each do |config|
      config.build_settings['APPLICATION_EXTENSION_API_ONLY'] = 'No'
      config.build_settings['ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES'] = 'Yes'
     end
  end
end
end

This is my podfile ,ya this contains more pods other. than SwiftyStoreKit. i am able to run without the SwiftyStoreKit, but if i add at then getting this error and breakpoint

dyld: Library not loaded: @rpath/SwiftyStoreKit.framework/Versions/A/SwiftyStoreKit
  Referenced from: /Users/admin/Library/Caches/...../Build/Products/Debug-maccatalyst/MyApp.app/Contents/MacOS/MyApp
  Reason: image not found

i am using this tool to exclude pods for mac catalyst: https://github.com/fermoya/cocoapods-catalyst-support

using

Xcode : 12.4 macOS : Big Sur 11.2.2


Solution

  • Integrating SwiftStoreKit with Swift Package Manager solves the issue.

    If you are using Xcode 11 or later:

    1. Click File
    2. Swift Packages
    3. Add Package Dependency...
    4. Specify the git URL for SwiftyStoreKit.

    https://github.com/bizz84/SwiftyStoreKit.git