在插件IOS文件夹下新建Framework文件夹,把需要导入的第三方库文件放到这里面
然后找到***.podspec文件添加如下代码:
//.framework文件路径
s.vendored_frameworks = 'Framework/*.framework'
//.a文件路径
s.vendored_libraries = 'Framework/*.a'
//.bundle资源文件路径
s.resource ='Framework/*.bundle'
我的插件使用swift,不过大部分库都是oc写的,要用switft调用oc,还需要加入桥接文件,在Classes文件夹下创建,插件名-Bridging-Header.h文件,头文件代码如下:
#import <BytedFaceVerifySdk/BytedCertWrapper.h>
在这里面导入库的头文件即可,还需要在.podspec文件里添加如下代码:
s.public_header_files = 'Classes/**/*.h'
然后就可以在swift文件里调用到oc库的方法了。
我的最终.podspec文件如下:
Pod::Spec.new do |s|
s.name = 'bytedcert'
s.version = '0.0.1'
s.summary = 'A new Flutter plugin project.'
s.description = <<-DESC
A new Flutter plugin project.
DESC
s.homepage = 'http://example.com'
s.license = { :file => '../LICENSE' }
s.author = { 'Your Company' => 'email@example.com' }
s.source = { :path => '.' }
s.source_files = 'Classes/**/*'
s.vendored_frameworks = 'Framework/BytedFaceVerifySdk.framework'
s.resource = 'Framework/action_liveness.bundle','Framework/byted_cert.bundle','Framework/reflection_liveness.bundle'
s.public_header_files = 'Classes/**/*.h'
s.dependency 'Flutter'
s.platform = :ios, '9.0'
# Flutter.framework does not contain a i386 slice.
s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES', 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'i386' }
s.swift_version = '5.0'
end