How to add downloaded content to an IOS app? - ios

I´m trying to make an iPhone-app where the users can buy and download new content (sound files).
I´ve used the API from Urban Airship to set up the "in-app store", so the buying and downloading the new files part is covered and seems to work as it should - but I´m having a hard time figuring out how to add the new content to my app so the user can access it..
The app comes with 3 sound files to start with, and I´m using a Plist to display and play these files - displayed in a tableview based on my plist.
In my simple mind I´m thinking that I need to add the new content to my existing plist, or I should get my tableview to display content from multiple plists so every new download could contain a plist with info about the downloaded files..
This is my first time trying to make an app, and I am completely lost!
How do I add downloaded content to my app? Should i do something else instead of the plist?

You can copy your initial plist from the app bundle, where it isn't writeable, to your app's Documents directory, where you can write and append info to the plist as necessary. Then just populate your table from that one plist.

Related

Create a file through a Cordova/Phonegap app that can be opened by another app (ios)?

I'm able to create and save files using cordova-plugin-file, and have been saving and accessing them from within the app to cordova.file.documentsDirectory.
The problem it seems is that all the directories that one can save to are private, Cordova-plugin-file documentation
I would like to be able to have these files saved in (or moved to) the ios blue "files" folder, so that they can be opened by other apps such as Numbers, Pages, etc. It seems so simple there has to be a way to do this, but I can't find it after more than a few evenings of searching and trying different ways.
I'd be grateful if someone could point me in the right direction.
From what I can tell you can save to the documents directory "cordova.file.documentsDirectory". By default this directory is shared with iCloud, so a file saved here could be opened through the ios File folder and a user could then select the files and hit the share icon to open with the appropriate app, such as Numbers etc.
In order to turn on iCloud you have to pay the developer fee to Apple and select the options to do so. I found the article "Working with the Files App in iOS 11" to be helpful in starting this process.
I don't have the paid developer account yet, but from what I'm reading it should work once I activate one. I'm open to a better solution or critique.

How do I obtain a .plist saved in Documents, programmatically with Swift or manually from Finder/Xcode?

Background
I have a dictionary with more than 100 keys that I've stored in a property list that I can transfer/load/save to from one Xcode project to another.
Research
I've looked at several posts on StackOverflow but most of them seem to deal with loading a plist from the main bundle, copying it to the Documents directory and loading/saving it from there with no way of retrieving it to use in other projects.
TLDR
I want to be able to 'export' a plist created programmatically as a separate file I can use in other projects unrelated to the current one.
Update
Thanks to #NSNoob I've figured out that I can manually access the new plist from the Documents directory. Now the question is, how? Isn't iOS sandboxed without access to the filesystem unless it's jailbroken?
You can get Documents directory contents of your app like following:
Connect your device to your mac
Open your Xcode
Click on Window and select Devices
Click on your device
Search for your app in installed apps list
Click on your app
Click on gear icon
Click on Download Container.
Right Click on Saved xcappdata file.
Click on Show package contents.
That will open your documents directory and you will be able to find your modified plist there.

iOS Documents/Inbox folder new coming data

I'm writing an ios app and I managed to add it to "open with.." feature for any other types.My question is after I opened the file with my app how can handle it? I know it will be saved in Documents/Inbox folder in the app however my app will be dynamic and will extend in time.I need to access initially opened file's variables (like name, path etc).
My second question is, after I get the file I want to show ViewController1 rather than when the app normally started ViewController. Should I need to store the count of Documents/Inbox files or are there any other ways?

View files in app's filesystem for iOS for testing?

I am working on an app right now that is supposed to generate a text document from an NSString , save it to the app's documents foldr, and then upload it to the iCloud.
I want to check and see if the file is actually being created and saved in the Documents folder in my app's Sandbox.
How do you look at the files saved on an iPhone? (Either on the phone
or when it is connected via USB to my Mac.)
This is just for testing purposes and all I want to do is view the file name and contents, not edit them in any way.
In addition to pdesantis's answer, you can achieve what you want through Xcode rather than relying on third-party tools. Open the Organiser, select the Devices tab, select Applications under the relevant device in the column on the left, then select the app you're interested in in the large area on the right and click Download at the bottom of the screen to grab its current local storage.
Try this
http://www.macroplant.com/iexplorer/

IOS: save a csv o txt file when I delete an app

I'm creating an app and when a person use this app, lot informations are recorded in a txt file;
If I want to make changes at this app, I must delete app from device. Then, how can I save the txt file before I delete the application?
Is there a way to do this?
Instead of deleting the app to make changes, install an updated app with the old app in place to preverve the content of the Documents folder (NSDocumentDirectory).
You could also save the data in the cloud whenever the app exits.

Resources