All Products
Search
Document Center

Object Storage Service:Installation

Last Updated:Dec 12, 2023

OSS SDK for iOS allows you to programmatically manage resources in Object Storage Service (OSS). For example, you can manage buckets, upload objects, download objects, and process images. This topic describes how to install OSS SDK for iOS.

Prerequisites

  • iOS: iOS 8.0 or later is used.

  • macOS: macOS 10.10 or later is used.

Directly import the framework

For more information about how to generate a framework for OSS SDK for iOS, visit GitHub.

In Xcode, drag the framework to the required section of Target. In the dialog box that appears, select Copy items if needed.

Pod dependency

If your project uses Cocoapods to manage dependencies, add the following dependency to the Podfile. In this case, you do not need to import the OSS SDK for iOS framework.

pod 'AliyunOSSiOS'           
Note

You can add the framework or add the pod dependency.

Import the header file to your project

#import <AliyunOSSiOS/OSSService.h>            
Important

After you import the framework, add -ObjC to Other Linker Flags in Build Settings of your project. If the -force_load option is configured for your project, add -force_load <framework path>/AliyunOSSiOS.

Use the SDK in a Swift project.

OSS provides the Objective-C version of OSS SDK for iOS. In a Swift project, you can use the Objective-C version of the SDK for hybrid programming. OSS provides a demo that shows how to use the SDK in a Swift project. For more information, visit GitHub.

Compatible with IPv6-only networks

Domain name resolution in wireless networks is prone to hijackings. To address this issue, OSS SDKs for mobile devices support HTTPDNS for domain name resolution and directly use IP addresses to send requests to the OSS server. In an IPv6-only network, compatibility issues may occur. Apple has updated its App Store Review Guidelines to require apps to provide IPv6 compatibility. OSS SDK for iOS starts providing IPv6 support from V2.5.0. In OSS SDK for iOS V2.5.0 and later, aside from Objective-C settings, the following system libraries must be imported:

libresolv.tbd
CoreTelephony.framework
SystemConfiguration.framework            

About the ATS

During Worldwide Developers Conference (WWDC) 2016, Apple announced that all the apps in App Store must support App Transport Security (ATS) from January 1, 2017. In other words, all apps submitted to App Store after the aforementioned date are not allowed to use NSAllowsArbitraryLoads to bypass the ATS limitation. Additionally, apps must connect to servers over HTTPS. App reviews fail if apps do not meet these requirements.

OSS SDK for iOS 2.6.0 and later support ATS. OSS SDK for iOS does not send requests over a protocol other than HTTPS. In addition, OSS SDK for iOS supports endpoints that start with the https:// prefix. With a valid HTTPS endpoint configured, requests sent are compliant.

Important
  • When you specify an endpoint, make sure that the endpoint starts with https://.

  • Make sure that only HTTPS requests are initiated when you implement callbacks such as generating signature and obtaining tokens from Security Token Service (STS).