博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

iOS开发日常

Posted on 2022-04-17 21:25  pencilCool  阅读(106)  评论(0编辑  收藏  举报

iOS

add child vc

https://www.swiftbysundell.com/basics/child-view-controllers/

kill usb

sudo killall -STOP -c usbd

国际化导出:

xcodebuild -exportLocalizations -workspace BinaryFlute.xcworkspace \
-localizationPath ./Localizations \
-exportLanguage zh-hans \
-exportLanguage zh-HK \
-exportLanguage zh-hant \
-exportLanguage en  %

InjectionIII 配置

#if DEBUG
Bundle(path: "/Applications/InjectionIII.app/Contents/Resources/iOSInjection.bundle")?.load()
//for tvOS:
Bundle(path: "/Applications/InjectionIII.app/Contents/Resources/tvOSInjection.bundle")?.load()
//Or for macOS:
Bundle(path: "/Applications/InjectionIII.app/Contents/Resources/macOSInjection.bundle")?.load()
#endif

xed 打开iOS工程

命令行中 swift package 拉依赖 (可以配合proxy 使用)

xcodebuild -resolvePackageDependencies -scmProvider system

符号断点

-[UINavigationController pushViewController:animated:]

brew aliyun mirror

    # 替换brew.git:
    cd "$(brew --repo)"
    git remote set-url origin https://mirrors.aliyun.com/homebrew/brew.git
    # 替换homebrew-core.git:
    cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"
    git remote set-url origin https://mirrors.aliyun.com/homebrew/homebrew-core.git
    # 应用生效
    brew update
    # 替换homebrew-bottles:
    echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.aliyun.com/homebrew/homebrew-bottles' >> ~/.zshrc
    source ~/.zshrc

采用 cocoapods-binary ,让工程二进制化

Gemfile:
source 'https://rubygems.org'
gem 'cocoapods','1.11.2'
gem 'cocoapods-binary', '~> 0.4.4'

Podfile:
plugin 'cocoapods-binary'
use_frameworks!(:linkage => :static)

pod 'AFNetworking',"3.0",:binary => true
pod 'SanyServiceDisclose', :path => './SanyServiceDisclose' 自己本地的lib  binary => true 不起作用 

对于baidu 地图等 header module 不规范的lib 可以 在工程 的依赖了 baidu sdk 的target 中 配置
Allow No-modular includes in Framework Modules  === YES  

或者不直接在我们 的头文件中再次暴露 baidu sdk 的头文件 

执行 
bundle exec pod install 就可以了预编译 依赖库了

fix xcode14.3 bug

Missing file libarclite_iphoneos.a (Xcode 14.3)

post_install do |installer|
    installer.generated_projects.each do |project|
          project.targets.each do |target|
              target.build_configurations.each do |config|
                  config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '13.0'
               end
          end
   end
end

fix xcode14 bug

/// https://stackoverflow.com/questions/72561696/xcode-14-needs-selected-development-team-for-pod-bundles

post_install do |installer|
  installer.generated_projects.each do |project|
    project.targets.each do |target|
        target.build_configurations.each do |config|
            config.build_settings['CODE_SIGNING_ALLOWED'] = 'NO'
         end
    end
  end
end

ipa 上传到pyger

apiKey=“xxxxx”
DIR=$(pwd)
message=$(git log -1 --oneline)
echo $message
echo $branch
APK_PATH="${DIR}/build/SanyCRM.ipa"
result=$(curl -F "file=@${APK_PATH}" -F "_api_key=${apiKey}"  -F "buildUpdateDescription=环境信息:${message}" https://www.pgyer.com/apiv2/app/upload)

mPaas 集成

iOS mPaas 集成  :
pod mpaas init
pod repo add mPaaS_iOS_specs https://code.aliyun.com/mpaas-public/podspecs.git  (这个官方文档上没写) 
pod mpaas update 10.1.68

Dsbridge 的用法注意事项:

JS
dsBridge.hasNativeMethod('goApp', 'asyn') 

检查 native 
- (void)goApp:(NSString *)p :(JSCallback) completionHandler  
是否存在

JS 
 dsBridge.call('goApp', xxx);

调用的 native 
- (void)goApp:(NSString *)p


前端可以改成 
 dsBridge.call('goApp', xxx,(a)=>{});
or
dsBridge.hasNativeMethod('goApp')