Home > Blockchain >  XCODE 13 create own framework with dependencies
XCODE 13 create own framework with dependencies

Time:10-14

i am creating my custom framework with dependency(Alamofire,SVGKit,lottie, etc)

my problem is when i created it and import locally it works fine but when i import via pod its not working.

[![enter image description here][1]][1]

when i import it like above picture its working

then i created podspec file like below, passed the validation then i pushed framework and podspec file on github.

Pod::Spec.new do |s|

 s.name         = "testSDK"
 s.version      = "1.0.0"
 s.summary      = "test"
 s.description  = <<-DESC
       test
               DESC

 s.homepage     = "https://github.com/test/test"
 s.license      = { :type => "MIT", :file => "LICENSE" }
 s.author           = { "john" => "[email protected]" } 
 s.ios.deployment_target = '12.0'
 s.ios.vendored_frameworks = 'testSDK.framework'
 s.source        = { :git => 
 'https://github.com/test/test.git',
         :tag => s.version.to_s
        }
 s.swift_version = '5.0'
 s.exclude_files = "Classes/Exclude"

 s.dependency 'Alamofire', '~> 5.4.1'
 s.dependency 'IQKeyboardManagerSwift', '~> 6.5.6'
 s.dependency 'lottie-ios', '~> 3.2.1'
 s.dependency 'SVGKit', '~> 3.0.0'
 s.dependency 'CocoaLumberjack/Core', '~> 3.7.2'

 s.pod_target_xcconfig = {
 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'arm64'
 }
 s.user_target_xcconfig = { 
 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'arm64' 
 }

  end

then i installed the pod it's given this error

yld[45478]: Symbol not found: 
$s9Alamofire21URLRequestConvertibleP02asB010Foundation0B0VyKFTq
Referenced from: 
/Users/john/Library/Developer/CoreSimulator/Devices/5A694E99-89DA-418E-8BAC- 
19BA00DDDD40/data/Containers/Bundle/Application/FB5D28A0-9089-4428-B32F- 
AA2CCF6EC7CE/ios-sdk-example.app/Frameworks/testSDK.framework/testSDK

Expected in: /Users/john/Library/Developer/CoreSimulator/Devices/5A694E99- 
89DA-418E-8BAC-19BA00DDDD40/data/Containers/Bundle/Application/FB5D28A0-9089-4428- 
B32F-AA2CCF6EC7CE/ios-sdk-example.app/Frameworks/Alamofire.framework/Alamofire
Symbol not found: $s9Alamofire21URLRequestConvertibleP02asB010Foundation0B0VyKFTq

Referenced from: 
/Users/john/Library/Developer/CoreSimulator/Devices/5A694E99-89DA-418E-8BAC- 
19BA00DDDD40/data/Containers/Bundle/Application/FB5D28A0-9089-4428-B32F- 
AA2CCF6EC7CE/ios-sdk-example.app/Frameworks/testSDK.framework/testSDK

Expected in: /Users/john/Library/Developer/CoreSimulator/Devices/5A694E99- 
89DA-418E-8BAC-19BA00DDDD40/data/Containers/Bundle/Application/FB5D28A0-9089-4428- 
B32F-AA2CCF6EC7CE/ios-sdk-example.app/Frameworks/Alamofire.framework/Alamofire 

Summary

When import my custom framework locally its working.But from github its not working [1]: https://i.stack.imgur.com/F0OjZ.png

CodePudding user response:

I have added below code in my test.podspec file and upload on my github address with podfile and podfile.lock and it worked.

s.public_header_files = "test.framework/Headers/*.h"
s.source_files = "test.framework/Headers/*.h"
  • Related