function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Narinder Singh 1Narinder Singh 1 

Native iOS App - Check and delete Smartstore soup

Hi,

In my native app built using iOS SDK, how can I check if my smartsore already exist and if so delete it before re-creating it?

Any tutorial/ sample code available?
Best Answer chosen by Narinder Singh 1
Gaurav KheterpalGaurav Kheterpal
You need to have a class that implements the SmartStore interface such as
 
@implementation SmartStoreInterface : NSObject

and then write a method where you can check if soupExists and then delete using removeSoup like this
 
- void myDeleteSoup
{

   if ([self.store soupExists:kMySoupName]) {
       [self.store removeSoup:kMySoupName];
   }
}
Hope this helps.

If my answer helps resolve your query, please mark it as the 'Best Answer' & upvote it to benefit others and improve the overall quality of Discussion Forums.

Gaurav Kheterpal
Certified Force.com Developer| Salesforce Mobile Evangelist| Developer Forums Moderator| Dreamforce Speaker

 

All Answers

Gaurav KheterpalGaurav Kheterpal
You need to have a class that implements the SmartStore interface such as
 
@implementation SmartStoreInterface : NSObject

and then write a method where you can check if soupExists and then delete using removeSoup like this
 
- void myDeleteSoup
{

   if ([self.store soupExists:kMySoupName]) {
       [self.store removeSoup:kMySoupName];
   }
}
Hope this helps.

If my answer helps resolve your query, please mark it as the 'Best Answer' & upvote it to benefit others and improve the overall quality of Discussion Forums.

Gaurav Kheterpal
Certified Force.com Developer| Salesforce Mobile Evangelist| Developer Forums Moderator| Dreamforce Speaker

 
This was selected as the best answer
Narinder Singh 1Narinder Singh 1
Thanks as always sir!