Skip to content

jawngee/aws-sdk-ios-v2

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

##This fork contains a working version of the SDK for Cocoa. Please read below on usage.##

To use in Cocoa applications, do a recursive clone:

git clone --recursive https://github.com/jawngee/aws-sdk-ios-v2.git

This fork has added the dependencies as submodules for a couple of reasons. First, and I'm probably alone in this feeling, but I hate cocoapods for a number of valid and invalid reasons.

Second, the iOS specific code actually exists in the Bolts dependency, but can still be compiled and used with the iOS specific classes removed.

Once you've cloned the repo, to get it working in your project:

  1. Drag the AWSiOSSDK.xcodeproj to your project.
  2. In build phases, add "AWSCocoaSDK" as a Target Dependency.
  3. In Link Binary With Libraries phase, add "libAWSCocoaSDK.a"
  4. In build settings, in Header Search Paths, add the directory where you cloned this repo to and make sure that it is recursive.
  5. Add -ObjC to Other Linker Flags.

You can now include in your code:

#import "AWSCore/AWSCore.h"
#import "SQS/AWSSQS.h"

You should now be good to go. I will be tracking Amazon's repo and merging in changes as they are made.

BTW, there's no good reason this can't work both in iOS and Cocoa, except the iOS engineers at Amazon have decided to include a dependency that requires it (though the actual iOS Specific stuff isn't used at all).

Anyways, enjoy.

This is a developer preview of the AWS SDK for iOS v2. The repository name may change when the SDK goes out of the preview.

Version 2 of the AWS SDK for iOS Developer Preview

Version Platform

We are happy to announce that based on your feedback, we have made significant improvements to our AWS SDK for iOS. We rebuilt the AWS SDK for iOS from the ground up to conform to Objective-C conventions and take advantage of new features in the Cocoa framework. The new SDK will also improve interoperability with a number of other frameworks and projects in the iOS developer ecosystem.

We have significantly reduced the footprint by reducing the number of files and number of classes. The SDK supports all of the existing functionality, and it also includes several new features.

Highlights

  1. Amazon DynamoDB Object Mapper - We have made it easier to use DynamoDB from the AWS SDK for iOS by providing the DynamoDB Object Mapper for iOS. The DynamoDB Object Mapper makes it easy to set up connections to a DynamoDB database and supports high-level operations like creating, getting, querying, updating, and deleting records.

  2. S3TransferManager - We have rebuilt the S3TransferManager to utilize BFTask. It has a clean interface, and all of the operations are now asynchronous.

  3. ARC support - The SDK is now ARC enabled from the ground up to improve overall memory management.

  4. BFTask support - Async methods with complex logic often cause deeply nested blocks in Objective-C. With native BFTask support, you can chain async requests instead of nesting them. This makes the logic cleaner while keeping the code more readable.

  5. Conforming Objective-C recommendations - We are better at conforming to Objective-C best practices. The SDK returns NSErrors instead of throwing exceptions. iOS developers will now feel at home when using the AWS Mobile SDK.

  6. Official Cocoapods support - Including the AWS SDK for iOS in your project is now easier than ever. You just need to add pod "AWSiOSSDKv2" to your Podfile.

Requirements

  • Xcode 5 and later
  • iOS 7 and later

Installation

AWSiOSSDKv2 is available through CocoaPods, to install it simply add the following line to your Podfile:

pod "AWSiOSSDKv2"

Getting Started is Easy Using Swift

It is easy to use the AWS SDK for iOS with Swift. Please see five simple steps below to get started with Swift.

  1. Create an Objective-C bridging header file.

  2. Import the service headers in the bridging header.

     #import "DynamoDB.h"
    
  3. Point SWIFT_OBJC_BRIDGING_HEADER to the bridging header by going to Your Target => Build Settings => SWIFT_OBJC_BRIDGING_HEADER.

  4. Create a default service configuration by adding the following code snippet in the @optional func application(_ application: UIApplication!, didFinishLaunchingWithOptions launchOptions: NSDictionary!) -> Bool application delegate method.

     let credentialsProvider = AWSStaticCredentialsProvider.credentialsWithAccessKey(yourAccessKey, secretKey: yourSecretKey)
     let defaultServiceConfiguration = AWSServiceConfiguration(region: AWSRegionType.USEast1, credentialsProvider: credentialsProvider)
     AWSServiceManager.defaultServiceManager().setDefaultServiceConfiguration(defaultServiceConfiguration)
    
  5. Make a call to the AWS services.

     let dynamoDB = AWSDynamoDB.defaultDynamoDB()
     let listTableInput = AWSDynamoDBListTablesInput()
     dynamoDB.listTables(listTableInput).continueWithBlock{
         (task: BFTask!) -> AnyObject! in
         let listTablesOutput = task.result() as AWSDynamoDBListTablesOutput
    
         for tableName : AnyObject in listTablesOutput.tableNames {
             println("\(tableName)")
         }
    
         return nil
         }
    

Using Objective-C

  1. Import AWSCore header in the application delegate.

     #import <AWSiOSSDK/AWSCore.h>
    
  2. Create a default service configuration by adding the following code snippet in the application:didFinishLaunchingWithOptions: application delegate method.

     AWSStaticCredentialsProvider *credentialsProvider = [AWSStaticCredentialsProvider credentialsWithAccessKey:@"YourAccessKey" secretKey:@"YourSecretKey"];
     AWSServiceConfiguration *configuration = [AWSServiceConfiguration configurationWithRegion:AWSRegionUSEast1 credentialsProvider:credentialsProvider];
     [AWSServiceManager defaultServiceManager].defaultServiceConfiguration = configuration;
    
  3. Import service headers where you want to use the services.

     #import "S3.h"
    
  4. Make a call to the AWS services.

     AWSS3TransferManagerUploadRequest *uploadRequest = [AWSS3TransferManagerUploadRequest new];
     uploadRequest.bucket = yourBucket;
     uploadRequest.key = yourKey;
     uploadRequest.body = yourDataURL;
     uploadRequest.contentLength = [NSNumber numberWithUnsignedLongLong:fileSize];
    
     [[transferManager upload:uploadRequest] continueWithBlock:^id(BFTask *task) {
     	// Do something with the response
         return nil;
     }];
    

Talk to Us

This is a Developer Preview, and we will make changes based on your feedback. Visit the Issues to leave feedback and to connect with other users of the SDK.

Author

Amazon Web Services

License

AWSiOSSDKv2 is available under the Apache License. See the LICENSE file for more info.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Objective-C 99.7%
  • Ruby 0.3%