Last Updated: Sep 27, 2017

Introduce framework directly

The OSS iOS SDK framework needs to be introduced.

In Xcode, drag the OSS iOS SDK framework and drop it to your target, and select Copy items if needed in the pop-up 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 the OSS iOS SDK framework or the Pod dependency. Either way works.

Introduce the header file to the project

  1. #import <AliyunOSSiOS/OSSService.h>

Note: After 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 should be introduced:

  1. libresolv.tbd
  2. 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 is to say, newly submitted apps are not allowed to use NSAllowsArbitraryLoads to bypass the ATS limitation by default. We’d better ensure 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 above. Specifically, the SDK will not issue any non-HTTPS requests. At the same time, the SDK supports endpoint with the https:// prefix. You only need to set the correct HTTPS endpoint to ensure that all network requests comply with the requirements.

Therefore, you must pay attention to the following:

  • Use a URL with the https:// prefix for setting the endpoint.
  • Make sure that the app will not initiate non-HTTPS requests when signing and getting STSToken callbacks.

Descriptions of OSSTask

You will 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 also wait till the task is finished (synchronous wait). For example:

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