使用iOS SDK進行Log Service各類操作前,您需要安裝iOS SDK。本文介紹iOS SDK的安裝方法。
前提條件
已開通Log Service。更多資訊,請參見開通Log Service。
已安裝iOS開發環境。更多資訊,請參見Apple Developer。
安裝SDK
建立iOS專案。
在專案檔夾中,建立Podfile檔案,並輸入匯入Log ServiceiOS SDK依賴包的命令。
# 請勿遺漏Master倉庫。 source 'https://github.com/CocoaPods/Specs.git' source 'https://github.com/aliyun-sls/Specs.git' # 中國內地倉庫,必須添加 source 'https://gitee.com/aliyun-sls/Specs.git' pod 'AliyunLogProducer', '~> 4.3.17'更多版本資訊,請參見Aliyun Log iOS SDK Release on GitHub。
在專案檔夾下,執行以下命令匯入依賴包。
pod install --repo-update安裝成功後,您就可以在專案中調用Log ServiceiOS SDK的介面。
相關文檔
在調用API介面過程中,若服務端返回結果中包含錯誤資訊,則表示調用API介面失敗。您可以參考API錯誤碼對照表尋找對應的解決方案。更多資訊,請參見API錯誤處理對照表。
Log Service除自研的SDK外,還支援公用的阿里雲SDK,關於阿里雲SDK的使用方式,請參見Log Service_SDK中心-阿里雲OpenAPI開發人員門戶。
為滿足越來越多的自動化Log Service配置需求,Log Service提供命令列工具CLI(Command Line Interface)。更多資訊,請參見Log Service命令列工具CLI。
更多範例程式碼,請參見Aliyun Log iOS SDK on GitHub。