Step1. インストール

    Step1. インストール


    記事の要約

    次のいずれかの方法を選択して Shoplive iOS SDKをインストールします。

    重複してインストールしないでください。
    Shoplive iOS SDKは、 Swift Package Manager、または CocoaPods どちらかの方法でインストールする必要があります。


    方法1 : CocoaPodsを使用してインストールする

    1. CocoaPodsを設定します。

    # In project home directory
    cd ~/projects/PlayShopLive
    
    # If you don't have CocoaPods
    sudo gem install cocoapods
    
    # If your project didn't have CocoaPods initialized
    pod init

    2. 現在使用している Podfileに、以下の行を追加します。

    source 'https://github.com/CocoaPods/Specs.git'
    
        # Set it to the same minimum supported version as configured in your project.
        # The Shoplive iOS SDK supports iOS 11.0 and above. It cannot be configured for versions below iOS 11.0.
        platform :ios, '11.0'
        use_frameworks!
    
        # Please configure the Project Target for installing the Shoplive iOS SDK.
        target 'PlayShopLive' do
            pod 'ShopLive', '1.5.4'
            pod 'ShopliveSDKCommon', '1.5.4'
        end

    3. CocoaPodsをインストールします。

    # Run the installation command in the Project home directory.
    # Include the update command to ensure that the changes from the pod repository are reflected.
    
    # Method 1. pod repo update and, pod install sequentially
    pod repo update
    pod install
    
    # Method 2. pod repo update and pod install together
    pod install --repo-update

    Apple M1 で機能しない場合は、次のコマンドを実行します。

    sudo arch -x86_64 gem install ffi
    arch -x86_64 pod install

    4. インストールが完了したら、 Project - Finderによって生成されたファイルを確認します。

    1092

    5. xcworkspace ファイルを開いて Project を確認します。


    方法2 : Swift Package Managerを使用してインストールする

    1. Xcodeプロジェクト内のProjectPackage Dependenciesタブを開きます。

    2. Package Dependencies に、以下を追加してください。

    dependencies: [
        .package(url: "https://github.com/shoplive/ios-sdk", .exact(from: "1.5.5")),
        .package(url: "https://github.com/shoplive/common-ios", .exact(from: "1.5.5"))
    ]

    インストールに失敗した場合は、キャッシュをクリアしてください。

    3. Shoplive iOS SDKパッケージ を 適用する対象を選択します。

    4. Package DependenciesShoplive iOS SDKがインストールされていることを確認してください。