1

salesforcemobilesdk-ios と統合された iPad アプリケーションを作成しています。オフライン機能については、smartStore フレームワークを使用しています。スープを作成している間、SFSoupIndex の配列を渡します。

(つまり、indecesArray)

以下のコードを見ることができます。

let soupIndexForAccount__c = SFSoupIndex(path: "account__c", indexType: "string", columnName: "account__c")
        let soupIndexForAddress_Line_2__c = SFSoupIndex(path: "Address_Line_2__c", indexType: "string", columnName: "Address_Line_2__c")
        let soupIndexForCity__c = SFSoupIndex(path: "City__c", indexType: "string", columnName: "City__c")
        let soupIndexForName = SFSoupIndex(path: "Name", indexType: "string", columnName: "Name")
        let soupIndexForPhone__c = SFSoupIndex(path: "Phone__c", indexType: "string", columnName: "Phone__c")
        let soupIndexForPostal_Code__c = SFSoupIndex(path: "Postal_Code__c", indexType: "string", columnName: "Postal_Code__c")
        let soupIndexForIsPersonAccount = SFSoupIndex(path: "IsPersonAccount", indexType: "string", columnName: "IsPersonAccount")
        let indecesArray:NSArray = NSArray(objects: soupIndexForAccount__c,soupIndexForAddress_Line_2__c,soupIndexForCity__c,soupIndexForName,soupIndexForPhone__c,soupIndexForPostal_Code__c,soupIndexForIsPersonAccount)
        let registeredOrNot = self.store.registerSoup("Address", withIndexSpecs: indecesArray as [AnyObject])
            print(registeredOrNot)
        exists = self.store.soupExists("Address")
        print(exists)
            let tempToCheck = self.store.allSoupNames()
        let toSee = self.store.indicesForSoup("Address")

exists価値がありますtrue。つまり、Addressスープが存在することがわかります。取得しようとしているときに、 に値がallSoupNames()見つかりました。間違いがなければ、変数には挿入するインデックスの値が必要です。しかし、それは示しています。niltempToChecktoSeenil

間違いを見つけるのを手伝ってください

4

1 に答える 1

1

store申告を間違えたようです。すべてが完璧です。

グローバルにストア変数を宣言する必要があります

var store = SFSmartStore()

あなたのviewDidLoad()

store = SFSmartStore.sharedStoreWithName(kDefaultSmartStoreName) as! SFSmartStore

それがうまくいくことを願っています:)

于 2016-07-14T08:25:30.223 に答える