This is a migrated thread and some comments may be shown as answers.

creating data ios sdk

4 Answers 53 Views
Apple iOS SDK
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Kevin
Top achievements
Rank 1
Kevin asked on 10 Feb 2016, 04:40 PM
I am struggling  with the backend services api. My latest problem is with creating a data entry to add to a content type. the create method listed in the docs appears to be missing or deleted from the api. See line 61 of screenshot. as for the method that is in the api what is a selector that is mentioned in the 2nd and 3rd parameters. 

4 Answers, 1 is accepted

Sort by
0
Dimitar Dimitrov
Telerik team
answered on 12 Feb 2016, 03:31 PM
Hi Diego,

The create item functionality is essential to the iOS SDK and I think that it might be a bug of xcode, that you don't see the definition of the function. Here a snippet of how it actually looks.
/*!
 Creates a new EVObject in background.
 @param object The object to be created.
 @param block The block to execute. The block should have the following argument signature: (BOOL success, NSError *error)
 */
- (void)create:(id)object block:(EVObjectResultBlock)block;
 
/*!
 Saves a new EVObject in background.
 @param object The object instance to be created in everlive.
 @param target The object to call selector on.
 @param selector The selector to call. It should have the following signature: (void)requestCompletedWithResult:(id)result error:(NSError*)error. error will be nill on success.
 */
- (void)create:(id) object target:(id) target selector:(SEL)selector;


You can just use the first definition with a block callback. Here is an example how it is done:
let dataStore: EVDataStore = EVDataStore.sharedInstance() as! EVDataStore
         
        //Create item
        let newMessage:Message = Message.init();
        newMessage.content = "New message content"
        newMessage.createdByName = "John Doe"
         
        dataStore.create(newMessage) { (success:Bool, error:NSError!) -> Void in
            if(success){
                print("message created")
            }else{
                print("error \(error)")
            }
        }

Basically you need to get an instance of our data store, that takes care of creating new items. Then create an instance of your class and populate it with the values you want and pass it to the create function of the dataStore. In the callback you'll receive either an error or a success variable that indicates if the creation was completed successfully.

I hope you'll find this example helpful. If you need more information, do not hesitate to contact us.

Regards,
Dimitar Dimitrov
Telerik
 
Everlive is now Telerik Backend Services, and is part of the Telerik Platform.
 
0
Kevin
Top achievements
Rank 1
answered on 12 Feb 2016, 04:22 PM
Dont see how it could be an xcode bug it said dataStore has no member create with the given parameters and i also opened the datastore.h in the everlive sdk and the method wasnt in the file there. can i just paste the above create method (first one) in to this file?
0
Kevin
Top achievements
Rank 1
answered on 12 Feb 2016, 04:24 PM

**i also opened the datastore.h in the everlive sdk in a text editor and the method wasnt in the file there either.

sorry should proof read my post.

0
Dimitar Dimitrov
Telerik team
answered on 12 Feb 2016, 04:41 PM
Hi Diego,

I am attaching a fresh build of the iOS SDK that contain the above mentioned declaration of the method. I don't know how it is possible to be absent, without manually deleting it.

Would you please try the version I am sending in your project and tell me if any problems persist.

Regards,
Dimitar Dimitrov
Telerik
 
Everlive is now Telerik Backend Services, and is part of the Telerik Platform.
 
Tags
Apple iOS SDK
Asked by
Kevin
Top achievements
Rank 1
Answers by
Dimitar Dimitrov
Telerik team
Kevin
Top achievements
Rank 1
Share this question
or