Xcode Parse.com save to csv/any file? - ios

I pretty much finished my project. It's ticket booking app based on Parse.com written in objective c in Xcode. Also i want to mention i'm pretty new in objective C world.
One functionality is TableView which shows user his order history, it is followed by ViewController which shows orders details.
Now one of requirements of this app was "save and load data". My lecturer says that it HAS to have this function(no matter if it's really that useful). So i figured i could make "save" for order history. Then when app has no access to internet user could load csv file(previously saved) and look up his order history with details(again in tableview > view controller).
I'm pretty tired and i have no idea how to come around this. I think that best file format would be CSV, but i've never worked with these in Xcode. I'm looking for any advice or an idea on how to handle that.

Related

Saving and Filtering Favourites from a UITableViewController without Core Data

I am building a simple informational based app that provides the users with built in Leaflets and Images to view, on a variety of topics. It's a UITabBar -based application where the first tab is a list of Leaflets, the second is a list of Videos and the third is a list of Languages. Each tab is represented by a UITableViewController.
I would like to set up a favouriting mechanism where users can swipe across any leaflet or video in the UITableViewCell and "favourite" it. Whichever they favourite will then get added to the 4th tab called (unimaginatively), Favourites.
I'm not using Core Data with this application because there's no real need to do that and because I'm quite new to this concept, I'm wondering on the best way to save up to 50 favourites. How would I store this? Would I use something like a NSUserDefault for example?
It's a broad question because I've looked online and I'm not quite sure how to approach this.
I would really appreciate if anyone had any guides or thoughts on how to firstly save this and secondly, how to fetch the favourites for the favourites tab. Would/Could I use something like a NSFetchedResultsController even though I'm not using Core Data?
Should I just use Core Data with this, to save the favourites?
Any thoughts on this would really be appreciated.

Creating you own database with Parse for an iOS app in Swift

I need to know if I can use Parse for what i need. Let me give you some context. I am new to coding for iOS in Swift. I am creating an app, and a big part of it is displaying info to the user depending on what country they select.
So at the start of the app, they will select a country. I have used Parse a little bit through an online course, so I know how to signup and create users etc.
What i want to know if i can do?
Can i use Parse to create my own database? So have a Class called country_data, and then in that class, have all the countries with info about them. As an example of what i mean, see the table below:
Then, in the app, i can check that if the user selects 'Spain' for example, I can display all the Info for Spain.
Everything i've done in Parse so far had been about sending info to Parse that Ive created from the code in Xcode. But i need to know if i can go into my app in Parse and create this database myself.
Is this possible and is it the right way to do what i'm looking for. Any suggestions welcome, and thanks! Please ask questions if you need me to explain more.
Nick
Good news OP,
(1) yes Parse is absolutely perfect for this.
Parse is now at http://back4app.com
Here...
It literally took me less time to do that, than it took to answer your question!
It's almost unbelievable to understand how much time "BAAS" services save, in the new "BAAS" era.
(2) 196 countries. You should be OK :) Anything up to a few million countries will work fine. After that Parse will get a little slow on searches.
(3) "But I need to know if i can go into my app in Parse and create this database myself."
Yes, using the internet and a computer,
just go to back4app.com, log in, and click on your project. Click on "Core". (Parse software also offers features like Analytics, etc. For the database system, just click on "Core".)
Notice the button "Add Class", click that and type in "Country". Add a column called "name" which is a "String".
Make another new class "City". Again make a "String" column "name", and also make a column that is a "Pointer" to "Country".
You're completely done.
It is far quicker than me typing it here, heh

Core Data creating new objects Swift

New to iOS development..
Basically what i'm trying to do is hard code data into my app using core data. Two different types will be stored, both strings: quotes and authors (There will be around 20 of each in the app). I have a button on my Storyboard as an IBaction that when clicked will populate a label with a new quote and author. My struggle right now is 1) finding out how to create this data and 2) how to fetch this data.
Every resource i'm finding online goes through tutorials on how to store data that a user typed in and then fetch it from a button. I'm trying to figure out how to store data without user input and then fetch it. Any help is appreciated. Sorry for asking what I am sure is a pretty simple question.
Unfortunately, though this would seem like a simple task, to my knowledge there is know "built-in" way to prepopulate CoreData. You can build up a core database and then copy it into an app, or possibly use a third party solution, though. Searching for "prepopulate coredata" here and on google should give you a start.
Here's a couple threads that might help:
Any way to pre populate core data?
iOS CoreData - prepopulate db with existing indexes

Sending PFUsers images from Parse

This is the last thing I need to develop my client based app but have seriously hit a hard rock.
I am trying to send Users images directly from Parse and have a handful of images displayed to them. What is the best way to go about this? I already have a User Login & Registration completely set up. I also have a UIViewController filed as ConceptPage and a PFImageView filed as Concept1.
Ideally I would like to have these images stored in the "User" Class by adding "File" Columns. I've already went ahead and made one file column called "concept1"
Any help would be greatly appreciated at this point considering I'm now 2 weeks in of research on this topic.

Can my iOS App load a XML file and Generate Interface from the information within XML?

I'm working on a home automation project. Here's what I want to do:
The app starts and it'll have a button to load an XML file.
The XML will have information about the rooms in the house like "Living Room, Dining Room, Kitchen etc.". It'll also have information about the equipment, like "Home Theater, TV, Blu-Ray Player, etc. in this case with a relation with the room that they belong" and so on with IR, RS-232 cmds, etc.
I'll install this app in different houses, so I intend just to change the XML file as the house changes.
I intend to generate the UI from the information contained in the XML file. E.g. The house has only "Living Room and Dining Room". The tab bar will show only those two tabs.
So, my questions:
Will Apple reject my app?
Can my customers just download the app from the App Store, and change and load the XML file? I mean, there's a package in the .app file, is it possible to open it and change the .xml file inside it?
Is it possible to change the UI as the XML information changes?
EDIT: more questions:
#competent_tech is saying that dynamic generation of code isn't allowed, but I'll change the code within the .storyboard or .xib .nib files, isn't it?
About the Contacts: I think is a little bit different idea, because in the contacts app, e.g.: there are 10 fields to fill out, like first name, last name, e-mail, phone number, etc. As a user, if I don't fill out the e-mail field, it'll still be there anyway. My plan is kind of different:
The house has 2 equipments to control: - Tab bar with item 1 and item 2.
The house has 3 equipments to control: - Tab bar with item 1 and item 2 and item 3.
Do you still think this is possible?
Can you recommend a book about this? I couldn't find anything useful myself.
Unfortunately, only apple can answer the rejection question.
However, from what you have described, there shouldn't be an issue since this is configuration-based changes instead of code changes. Apple specifically prohibits download of code and dynamic generation of code.
You can liken it to Contacts: iOS doesn't come configured with contacts, they allow you add them and configure different things about them. This sounds very much like what you are doing.
You should be able to download an XML file from a website or web service and use that to configure the app. We use a web service to retrieve data into the local Sqlite database to configure nomenclature and UI component visibility based on the current user and it works quite nicely.
With generating code they mean executable code, not the generating of views or viewcontrollers. If that is forbidden too, you could distribute your app via addhoc, but you need one developer program per 99 clients.

Resources