Store photos in mysql database with iOS app - ios

I am looking for a how to create a mysql database with the photos which are uploaded by my iOS app.
I have already programming the picker and the upload part, but I have no idea how to create this database considering that will have 3 different voices "localization , type , date ".

Do you mean a database on the iPhone? If on your iPhone, the typical solution is sqlite. I personally use an Objective C wrapper, FMDB for that, that gets you out of the weeds of sqlite programming. Or check out Core Data if you want to be a little more Cocoa about it.
If, as I suspect, you're talking about your server database, then this is probably not the right forum for that question about how to create a server database. You need to be more specific, and include code samples of what you've tried.

Related

Xcode 8/Swift 3: make API information available offline? [duplicate]

This question already has an answer here:
How to make offline database for my app?
(1 answer)
Closed 6 years ago.
I'm currently working on an application in Xcode 8/Swift 3 which runs through APIs. Essentially, I'm parsing information using SwiftyJSON from my MySQL database which keeps the content current and easily updated.
To keep it so the content is also available offline, I'd like to introduce a facility where the data is downloaded and stored on the phone so it is available in "offline mode".
I know it's a completely open question but can anyone point me in the correct direction of how I could make this JSON information available offline? I've tried searching the net with no success.
I know it's not Swift, but the absolute master of this has recently open sauced his master piece: Dash for iOS.
Reviewing what he's done to get rapid scrolling and searches might give some deep insight into how to best do this as done by someone with (arguably) more experience in this area than anyone other than Apple:
https://github.com/Kapeli/Dash-iOS
I will prefer here 2 option either I will go with 1.SQLite DB or 2. NSURLCache
For SQLite DB you can use FMDB wrapper-https://github.com/ccgus/fmdb
For NSURLCache check this link Best way to Cache JSON from API in SWIFT?
If you just want to save json then go with NSURLCache for offline mode.
Achieving offline for iOS is having two best paths they are CoreData and SQLITE. As per the definition of CoreData suggests it is a Model layer of the project. It comes with less efforts on developer side. Bit contrast SQLITE having the same way but little efforts on it.
In my project we are using the CoreData for offline maintenance. Really we have few concerns on the Relational data fetching, Although there is a Predicates representing CoreData for the same still it is limited to some part. These type of situations SQLITE is really a life saver. We can easily fetch the records with simple JOIN commands.
Conclusion:
If you have more complex data relations it's really better to go with the SQLITE, Apart from CoreData is best choice.

Developing Quiz App - Data Storage iOS

I am planning to develop a quiz app in iOS and doing it offline. I need to store 100s of questions and options in that app. How to store? How does core data comes in handy here? Is there any other good methods for this problem?
The app is meant to be offline.
You can also use SQLite database for saving Questions and Answers offline for your Quiz app. You can create tables in SQLite and save and fetch data from that using SQLite queries.
I would recommend you to use realm.io. It measures better than core data, its fast and simple to use. On https://realm.io there is lots of documentation.
I find realm much easier to set up and in generally to comprehend. It works nicely with SwiftJSON and hence in my view much easier to connect to backend.
Preloading core data can be quite cumbersome and to me it seems that core data still relies heavily on objective c.
On the other Core Data is made by Apple so it could be more stable solution on longer run (parse.com)

Core Data iCloud sync or smth else?

I build an iOS app which works with base. User can work with it everywhere, that is cool. When application starts for the first time, obviously, base will be empty. For now, user's base stores data locally with Core Data. But there is a case, when user may have his own base with a lot of data and he do not want to start work from scratch. For this reason I want to create simple Cocoa App for macOS, which will allow user to import some data from, for example - CSV file.
Both Core Data models (iOS app and macOS app) will be the same. I just want to make sync between two platforms.
I think it's possible with cloudKit, but which way is the best? Core Data Sync or smth like supporting MySQL database on server, etc...
Thanks in advance!
Asking which method is "best" is a matter of opinion, but in mine, Apple has made working with iCloud fairly simple. If all you want to do is sync between platforms, I would use cloudKit. There seems to be no reason to spin up your own MYSQL database instance and introduce another level of complexity, when the functionality you're looking for is free and easily accessible.
See this WWDC16 video for some cloudKit tips: https://developer.apple.com/videos/play/wwdc2016/226/

Database app approach

I am digging in this forum but could not realize which way to start. I need to build an app in Swift that searches in its internal database for a ZIP CODE and retrieves the street name, just two columns ZIP and Street but it is a list of more than 20K ZIP codes lines.The user will be able only to search not edit, add nor delete. I learned and please correct me if I am wrong: CoreData is good for small databases, and can not import from a list of ZIP codes I already have, neither allows to open the coredata database to edit/copy or add outside of the app, so How Apple wants us to use CoreData if the users must populate the database in the iphone.SQLite in Swift is fast but there is not many good tutorials in the internet, most of them show only how to work with CoreData. I just found one or two tutorial in Swift SQLite. No one shows how to import data from other database, To work with SQLite in Swift I will need a wraper like FMDB or SwiftData, the documentation is too technical for my knowledge so I have no idea which one should I go.Hope somebody can help me and show me the direction and maybe some help in this journey as well.
Jade.
Core Data is a Framework that will help you build the Model (in a Model/View/Controller app) of your App. Core Data is not database technology.
It helps you persisting your data. For that, you can save data in memory (fast & good for testing), in binary, XML form (not in iOS, yes in Mac) or using a SQLite DB as storage.
The normal use scenario is to store Core Data's objects inside a SQLite database. So it's not a "should I select between SQLite / Core Data". It's more a "I'll learn Core Data and it will use SQLite under the hood"
Using Core Data you can do full CRUD in memory (inside a CD Context) that gets saved in DB. So you can import your ZIP codes inside a DB and then access them just in read only mode (just querying Core Data). Querying in Core Data == fetching
You can then bundle that Pre-populated DB with your app and use it. Why? Because Core Data plays nicely with UIKit, so UITableViewController, for example, fits perfectly with NSFetchResultsController
It's a steep learning curve, but it'll pay off if you keep using data you want to persist in your apps.

SQLite or CoreData [duplicate]

This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
Use CoreData or SQLite on iPhone?
I would like to build an App which enables you too find stores (for example stores with your favourite shoe brand) even when you're not connected with WiFi or 3G.
For now the App should have a couple of possibilities:
User selects his favourite brand and gets a list of nearby stores. After that the user must be able to select a store to get the address, contact information and maybe a map;
User selects a certain city, gets a list of the available brands, selects one and gets a list of stores in that city selling the selected brand.
Since I'm new to making this kind of Apps, I have started doing my homework. I know I have to use a database to store all the data and found out there are a lot of ways to do so. One of them, creating a MySQL Database, wouldn't be an option since it can't be used offline. If I'm right two other methods are SQLite or CoreData.
Problem is, I'm getting kinda lost in all the available information which makes it hard for me to start. Are both methods possible for this App and which one is the easiest for this job?
I was hoping someone could point me in the right direction and maybe give me an usefull link or tutorial to continue with my App.
Thanks in advance! :)
Only use SQLite if you already know it, or you know that your use case is one of the rare few that has proven difficult for Core Data.
Thus, I would think your decision is simple. Use Core Data. It's extremely simple, unless you start updating data from multiple threads/contexts at the same time, then it gets pretty hairy relatively quickly.
There are tons of tutorials available online for Core Data, and ou always have Apple's documentation and sample code on their developer web site.
If you've never used MySQL or SQLite, just use CoreData. But if you have used MySQL or SQLite, i would recommend using SQLite as it will be easy for you to understand and thus you will be able to develop your app faster.

Resources