2016-07-23 5 views
0

Xcode 6からXcode 7に変換したときに、HKストアの読み書きが次の行に「より多くのコンテキストなしで式の型があいまいです」というエラーが表示されました。 'let healthKitTypesToRead = Set(arrayLiteral:[' and 'let healthKitTypesToWrite =セット(配列リテラルは:[」私はこの赤い警告エラーを修正する、または別のコードを書くことができますどのようにヘルスキットへの読み書きはXcode 7に変換されませんでした: '式のタイプがより多くのコンテキストなしで曖昧です'エラーを修正するには?

// 1. Set the types you want to read from HK Store 
let healthKitTypesToRead = Set(arrayLiteral:[ 
    HKObjectType.quantityTypeForIdentifier(HKQuantityTypeIdentifierHeartRate), 
    HKObjectType.quantityTypeForIdentifier(HKQuantityTypeIdentifierActiveEnergyBurned), 

    ]) 

// 2. Set the types you want to write to HK Store 
let healthKitTypesToWrite = Set(arrayLiteral:[ 
    HKObjectType.quantityTypeForIdentifier(HKQuantityTypeIdentifierActiveEnergyBurned), 
    ]) 

はHKス​​トアに読み取り/書き込みに

答えて

0

私は単に「それをout.'QuantityTypeForIdentifier働いに必要? featureTypeForIdentifierに変更し、その他の書式設定を変更する:

{ 
// 1. Set the types you want to read from HK Store 
let healthKitTypesToRead = Set(arrayLiteral: 
    HKObjectType.characteristicTypeForIdentifier(HKQuantityTypeIdentifierHeartRate)!, 
    HKObjectType.characteristicTypeForIdentifier(HKQuantityTypeIdentifierActiveEnergyBurned)! 
) 

// 2. Set the types you want to write to HK Store 
let healthKitTypesToWrite = Set(arrayLiteral: 
    HKObjectType.characteristicTypeForIdentifier(HKQuantityTypeIdentifierActiveEnergyBurned)! 
) 
関連する問題