3

I'm creating an ipad application which is integrated with salesforcemobilesdk-ios . for offline capability I'm using smartStore framework. while I'm creating the soup i'm passing SFSoupIndex's array.

(i.e indecesArray)

You can see the code below.

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 has value 'true'. That means we can understand that there is Address soup exists. When I'm trying to retrive allSoupNames() I found nil value in tempToCheck . toSee variable have to have the values of indexes that we insert if there was no mistake. But it is showing nil.

Please help me finding the mistake

1 Answer 1

1

It is looking like you have made a store declaration wrongly. Everything is perfect.

globally you need to declare a store variable

var store = SFSmartStore()

in your viewDidLoad()

store = SFSmartStore.sharedStoreWithName(kDefaultSmartStoreName) as! SFSmartStore

Hope it will work :)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .