2016-09-18 5 views
1

私は実際にインターネット上でソリューションを見つけることができない場合を除いて、stackoverflowに関する質問はしません。 ここでは、メソッドのオーバーライドに関する問題があります。これは、DynamoDB用のAWS生成コードです。イムSWIFT 3.0 を使用して私がオーバーライドを削除しようとしましたが、何の使用が、私はこのエラーを取得していない:AWS Dynamodbテストで迅速な3エラー

/Users/*****_*****/Desktop/APPS/Beer On The Go/AmazonAws/Models/NoSQL/Bars.swift:57:16: Method 'JSONKeyPathsByPropertyKey()' with Objective-C selector 'JSONKeyPathsByPropertyKey' conflicts with method 'jsonKeyPathsByPropertyKey()' from superclass 'AWSDynamoDBObjectModel' with the same Objective-C selector

この問題を解決するための任意のヒント?あなたはスウィフト3実装&新しいメソッド名(通知小文字の「JSON」)のために、更新タイプを使用する必要が

override class func JSONKeyPathsByPropertyKey() -> [NSObject : AnyObject] { 
    return [ 
      "_userId" as NSObject : "userId" as AnyObject, 
      "_barId" as NSObject : "barId" as AnyObject, 
      "_category" as NSObject : "Category" as AnyObject, 
      "_description" as NSObject : "Description" as AnyObject, 
      "_name" as NSObject : "Name" as AnyObject, 
    ] 
} 

Error msg

+0

あなたは、二重の戻り値の型を確認しましたスーパークラスメソッド? – Paulw11

+0

ケグ - あなたは本当に下の大きな答えをチェックしてください! – Fattie

答えて

5

public override static func jsonKeyPathsByPropertyKey() -> [AnyHashable : Any] 
    return [ 
      "_userId" as AnyHashable : "userId" as Any, 
      "_barId" as AnyHashable : "barId" as Any, 
      "_category" as AnyHashable : "Category" as Any, 
      "_description" as AnyHashable : "Description" as Any, 
      "_name" as AnyHashable : "Name" as Any 
    ] 
} 
+0

素晴らしいチップをありがとう! – Fattie

+0

ここで私はこの時代に同じサンプルコードを使用する際に問題があります。それは誰でもここでゴーグルを助けるかもしれません:http://stackoverflow.com/questions/40615830/weird-swift-3-issue-with-latest-amazon-aws-mobile-sample-code – Fattie