0

What is the best way to save object parameters to DB in ios? => like sending values to server application and server will save the parameters to db? And later that ios-app will get the properties and create the new object again.

What is the best way to do it? For ex, saving CALayer or UIImageView attributes like size, position, color, border width etc..

AykutE
  • 344
  • 3
  • 15
  • if you are sending some data to server, why do you want to save it locally? – hackerinheels Aug 12 '14 at 03:18
  • Why do you want to send size/position/color...etc., of UIImageView to server? Thats a pretty strange requirement. – bhargavg Aug 12 '14 at 03:34
  • @bhargavg Users will create some designs with views and i need to save these designs for future use. – AykutE Aug 12 '14 at 03:53
  • @hackerinheels for now i don't need to save properties to local. But later, offline app using is being necessary, i will also save same properties to local db inside the ios device. – AykutE Aug 12 '14 at 03:55

1 Answers1

1

You have to create a data model which defines what this data looks like.

Once you have it, you will need to define some sort of REST api against your server to get/post/put/delete this data. To implement this network layer you can look at:

https://developer.apple.com/library/ios/documentation/Cocoa/Conceptual/URLLoadingSystem/Articles/UsingNSURLSession.html

AFNetworking and RestKit are other useful libs to consider

To store locally you can look at CoreData - https://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/CoreData/cdProgrammingGuide.html

hackerinheels
  • 1,141
  • 1
  • 6
  • 14
  • What do you think about the data model? Is this the best way => creating nsdictionary for each object/view/image. converting nsdict to json and sending to server with AFNetworking.?? Also there will be a lot of properties. Do you think saving 1 varible to 1 column in db is good db mapping? – AykutE Aug 12 '14 at 04:07