iOS

组件化整体设计 - 补充中...

关键词

  • 依赖注入 DI
  • IoC 控制反转 Java
  • 通信: 中间者(target-action), url, 面向接口
  • pod 管理组件
  • 组件, 下沉基础组件, 公共组件, 业务组件, Foundation - UI
  • 模块, 业务模块
  • 其他

组件化通信方式

组件化的资源加载方式

静态库

问题

微信分享功能打包 pod 时,依赖 WechatOpenSDK , 主项目使用 use_frameworks, 导致, 无法编译通过

  1. 初步解决

Podspec 配置

  s.dependency 'WechatOpenSDK', '~> 1.8.2'

  s.pod_target_xcconfig = {
      'FRAMEWORK_SEARCH_PATHS' => '$(inherited) $(PODS_ROOT)/WechatOpenSDK',
      'OTHER_LDFLAGS'          => '$(inherited) -undefined dynamic_lookup'
  }

而主项目和各上层项目的 Podfile 中配置如下

 #静态库.a 在最后面添加如下内容:
    pre_install do |installer|
        # workaround for https://github.com/CocoaPods/CocoaPods/issues/3289
        Pod::Installer::Xcode::TargetValidator.send(:define_method, :verify_no_static_framework_transitive_dependencies) {}
    end
    
    post_install do |installer|
        installer.pods_project.targets.each do |target|
            target.build_configurations.each do |config|
                config.build_settings['ENABLE_BITCODE'] = 'NO'
            end
        end
    end

发现 debug 环境下, 没有问题, 但是 Release 环境 启动就崩溃

dy

Exception Type:  EXC_BREAKPOINT (SIGTRAP)
Exception Codes: 0x0000000000000001, 0x000000012000d088
Triggered by Thread:  0

Filtered syslog:
None found

Dyld Error Message:
Dyld Message: Symbol not found: _OBJC_CLASS_$_SendAuthReq
  Referenced from: /private/var/mobile/Containers/Bundle/Application/A73C1507-D652-4A28-8658-AAB219F36379/iLawSchool.app/Frameworks/iLSWechatService.framework/iLSWechatService
  Expected in: flat namespace
 in /private/var/mobile/Containers/Bundle/Application/A73C1507-D652-4A28-8658-AAB219F36379/iLawSchool.app/Frameworks/iLSWechatService.framework/iLSWechatService
  Dyld Version: 370.1

Binary Images:

目前的解决方案还是,全部把pod 做成 s.static_framework = true

组件化整体构思

相关文章

iOS
支付宝扫码打赏 微信打赏

若你觉得我的文章对你有帮助,欢迎点击上方按钮对我打赏

扫描二维码,分享此文章

段连洁's Picture
段连洁

iOSer

Subscribe to JAY 站 | Share Thoughts

Get the latest posts delivered right to your inbox.

or subscribe via RSS with Feedly!

Comments