Installation

Last Updated: Mar 27, 2018

Introduce framework directly

For more information about how to obtain the OSS iOS SDK framework, click here.

In Xcode, drag the OSS iOS SDK framework and drop it to your target, and select Copy items if needed from the dialog box.

Pod dependency

If your project manages dependencies using a Pod, add the following dependency to the Podfile. In this case, you do not need to import the OSS iOS SDK framework.

  1. pod 'AliyunOSSiOS'

Cocoapods is an outstanding dependency manager. Recommended reference documents: CocoaPods Installation and Usage Tutorial.

You can directly introduce OSS iOS SDK framework or the Pod dependency, any of the options can be prefered.

Introduce the header file to the project

  1. #import <AliyunOSSiOS/OSSService.h>

Note: Once you introduce the OSS iOS SDK framework, add -ObjC to Other Linker Flags of Build Settings in your project. If the -force_load option has been configured for your project, add -force_load <framework path>/AliyunOSSiOS.

Compatible with IPv6-Only networks

The OSS mobile SDK has introduced the HTTPDNS for domain name resolution to solve the problem of domain resolution hijacking in a wireless network and directly uses IP addresses for requests to the server. In an IPv6-Only network, compatibility issues may occur. The app officially issued the review requirements for apps, requiring apps to be IPv6-only network compatible. To this end, the SDK starts to be compatible from V2.5.0. In the new version, apart from -ObjC settings, two system libraries must be introduced:

  1. libresolv.tbd
  2. CoreTelephony.framework
  3. SystemConfiguration.framework

The ATS policy of Apple

At WWDC 2016, Apple announced that starting January 1, 2017, all the apps in Apple App Store must enable App Transport Security (ATS). That means, newly submitted apps are not allowed to use NSAllowsArbitraryLoads to bypass the ATS limitation, by default. It is to be ascertained that all network requests of the app are HTTPS-encrypted. Otherwise, the app may not pass the review.

This SDK provides this support in V2.6.0 and beyond. Specifically, SDK does not issue any non-HTTPS requests. At the same time, the SDK supports endpoint with the https:// prefix. You must set the correct HTTPS endpoint to ascertain all network requests comply with the requirements.

Therefore, you must consider the following:

  • Use a URL with the https:// prefix for setting the endpoint.

  • Make sure that the app does not initiate non-HTTPS requests when signing and getting STSToken callbacks.

Descriptions of OSSTask

You must get an OSSTask immediately for all operations that call APIs:

  1. OSSTask * task = [client getObject:get];

You can configure a continuation for the task to achieve asynchronous callback. For example:

  1. [task continueWithBlock: ^(OSSTask *task) {
  2. // do something
  3. ...
  4. return nil;
  5. }];

You can wait till the task is completed (synchronous wait). For example:

  1. [task waitUntilFinished];
  2. ...
Thank you! We've received your feedback.