zoukankan      html  css  js  c++  java
  • iOS——KSAdSDK

    CocoaPods 接入 KSAdSDK

    project 'Unity-iPhone.xcodeproj'
    
    source 'https://cdn.cocoapods.org/'
    
    # Uncomment the next line to define a global platform for your project
    platform :ios, '9.0'
    
    use_frameworks!
    inhibit_all_warnings!
    
    target 'Unity-iPhone' do
      # Comment the next line if you don't want to use dynamic frameworks
      use_frameworks!
    
      resourcePath='../../Resource/' #资源总路径
    
      # Pods for Unity-iPhone
    
      pod 'KSAdSDK', '3.3.14'
      pod 'Masonry', '~> 1.1.0'
      pod 'JLRoutes'
      pod 'Aspects'
      pod 'SDWebImage', '5.9.4'
      pod 'CocoaLumberjack'
      pod 'MJExtension'
      pod 'BlocksKit/Core'
    end
    

    PS:这里使用的是Unity导出的Xcode工程

    
    pod init Unity-iPhone.xcodeproj
    
    pod install
    
    

    如果安装时遇到:

    [!] CocoaPods could hot find compatible versions for pod "KSAdSDK" : In Podfile:

    ~~~

    • out-of-date source repos which you can update with "pod repo update' or with pod install --repo-update .
    • mistyped the name or version.
    • not added the source repo that hosts the Podspec to your Podfile.

    遇到上方的错误时可以根据提示更新资源仓库:pod repo update,或者直接更新并安装即可 pod install --repo-update

    手动方式接入KSAdSDK

    一、将KSAdSDK.framework文件手动加入工程,因为该sdk为动态库,所以需要在
    General->Frameworks,Libraries,and Embedded Content
    中将KSAdSDK.framework的Embed修改为Embed&Sign

    二、修改Xcode --> File --> Project Settings/Workspace Settings-->Build System 修改为 Legacy Build System(Deprecated)

    三、在上传应用商店时注意要移除 x86_64, i386两个架构,不然在交付App Store时会提示如下错误

    ERROR ITMS-90087: "Unsupported Architectures. The executable for xiaochijie.app/Frameworks/KSAdSDK.framework contains unsupported architectures '[i386, x86_64]'."
    
    ERROR ITMS-90125: "The binary is invalid. The encryption info in the LC_ENCRYPTION_INFO load command is either missing or invalid, or the binary is already encrypted. This binary does not seem to have been built with Apple's linker."
    
    

    解决方法:

    在Build Phases中添加以下Run Scripts脚本

    APP_PATH="${TARGET_BUILD_DIR}/${WRAPPER_NAME}"
    
    # This script loops through the frameworks embedded in the application and
    
    # removes unused architectures.
    
    find "$APP_PATH" -name '*.framework' -type d | while read -r FRAMEWORK
    
    do
    
    FRAMEWORK_EXECUTABLE_NAME=$(defaults read "$FRAMEWORK/Info.plist" CFBundleExecutable)
    
    FRAMEWORK_EXECUTABLE_PATH="$FRAMEWORK/$FRAMEWORK_EXECUTABLE_NAME"
    
    echo "Executable is $FRAMEWORK_EXECUTABLE_PATH"
    
    EXTRACTED_ARCHS=()
    
    for ARCH in $ARCHS
    
    do
    
    echo "Extracting $ARCH from $FRAMEWORK_EXECUTABLE_NAME"
    
    lipo -extract "$ARCH" "$FRAMEWORK_EXECUTABLE_PATH" -o "$FRAMEWORK_EXECUTABLE_PATH-$ARCH"
    
    EXTRACTED_ARCHS+=("$FRAMEWORK_EXECUTABLE_PATH-$ARCH")
    
    done
    
    echo "Merging extracted architectures: ${ARCHS}"
    
    lipo -o "$FRAMEWORK_EXECUTABLE_PATH-merged" -create "${EXTRACTED_ARCHS[@]}"
    
    rm "${EXTRACTED_ARCHS[@]}"
    
    echo "Replacing original executable with thinned version"
    
    rm "$FRAMEWORK_EXECUTABLE_PATH"
    
    mv "$FRAMEWORK_EXECUTABLE_PATH-merged" "$FRAMEWORK_EXECUTABLE_PATH"
    
    done
    
    REF

    https://u.kuaishou.com/home/detail/1157

  • 相关阅读:
    [工作札记]01: CS系统中分页控件的制作
    【非技术】试占新型肺炎的情况与发展趋势
    给培训学校讲解ORM框架的课件
    SAAS云平台搭建札记: (二) Linux Ubutu下.Net Core整套运行环境的搭建
    SAAS云平台搭建札记: (一) 浅论SAAS多租户自助云服务平台的产品、服务和订单
    开源三维地球GIS引擎Cesium常用功能的开发
    Asp.net管理信息系统中数据统计功能的实现
    [Thrift]学习使用Thrift
    使用Netty实现一下简单RPC
    [Redis]Redis做简单的分布式限流
  • 原文地址:https://www.cnblogs.com/sylvan/p/15313618.html
Copyright © 2011-2022 走看看