2016-01-17 49 views
0

我對iOS很新,對於AWS來說100%是新手。我正在構建一個需要上傳文件的應用程序。我通過CocoaPods下載了Amazon SDK,並使用橋接頭在Swift中使用它。橋接AWS軟件開發工具包上的XCode錯誤

這裏是我的頭:

#ifndef ObjC_Bridging_Header_h 
#define ObjC_Bridging_Header_h 

#import "AWSCore.h" 
#import "AWSS3.h" 
#import "AWSDynamoDB.h" 
#import "AWSSQS.h" 
#import "AWSSNS.h" 
#import "AWSCognito.h" 

#endif /* ObjC_Bridging_Header_h */ 

我指着我的構建設置告訴編譯器它是文件。

然後我試圖與此代碼配置SDK在我AppDelegate.swift:

var window: UIWindow? 
let cognitoAccountId = "I'm not going to post this" 
let cognitoIdentityPoolId = "I'm not going to post this" 
let cognitoUnauthRoleArn = "I'm not going to post this" 
let cognitoAuthRoleArn = "I'm not going to post this" 

func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool { 
    let credentialsProvider = AWSCognitoCredentialsProvider.credentialsWithRegionType(
     AWSRegionType.USEast1, 
     accountId: cognitoAccountId, 
     identityPoolId: cognitoIdentityPoolId, 
     unauthRoleArn: cognitoUnauthRoleArn, 
     authRoleArn: cognitoAuthRoleArn) 
    let defaultServiceConfiguration = AWSServiceConfiguration(
     region: AWSRegionType.USEast1, 
     credentialsProvider: credentialsProvider) 
    AWSServiceManager.defaultServiceManager().setDefaultServiceConfiguration(defaultServiceConfiguration) 


    return true 
} 

(是的,我把所有的ID字符串等我只是不想張貼)

一切正常,除了最後一行: AWSServiceManager.defaultServiceManager().setDefaultServiceConfiguration(defaultServiceConfiguration)

它錯誤說: "Value of type 'AWSServiceManager' has no member 'setDefaultServiceConfiguration'"

爲什麼一切工作除了這條線?怎麼了?

回答

0

AWSServiceManager對於defaultServiceConfiguration沒有固定器。

相反,你必須使用

AWSServiceManager.defaultServiceManager().defaultServiceConfiguration = defaultServiceConfiguration 

這會工作。

相關問題