Import data from free app to paid app - ios

I developed a free application where you can save some user data. Now I developed a paid version without any ads and some other new features. I would like to have the data from the free app version transferred! How can I achieve this the best way?
Edit: you can save data of a played game with some infos (gamescore, playername, date etc) via NSKeyedArchiver. You can see all your saved data in a table view. I would like to see these stored data in the paid version as well, but how can I share the data? The given answers don't seem to be the straightest way!

I've never done this before but the way I can think of on how to do this is by first getting the location of your file (if it is Core Data, it is in your Documents folder) and then depending on how you want to import data either:
Attach the file to an email and have the user email himself and then open the file with your app
Send the file to a server, which then the user can access and download the file
A good starting point is Apple's documentation on NSFileManager and this tutorial. This other one deals with preparing for sharing files and custom extensions.

Modify both apps to register for and handle custom URLs. Have the paid app try to send a request URL to launch the free app. If the free app handles the URL it can send data back using the paid app's URL.

Related

Web data storage and download services

I have an iOS app that currently uses CloudKit to store data. I want to be able to create a download link for each user that if anyone were to go to that link, they would download a piece of data (a small amount) specific to a user. I saw that CloudKit can also be used with the web using CloudKit JS but this would require me to host a server. I was also considering storing each of the user's data in a separate folder on a Dropbox account and then the download link going to that folder but I'm concerned with whether the user would be able to navigate to other folders and download other files.
Any suggestions on the best way to do this (maybe an API) would be much appreciated!

Import core data from free app to paid app in Swift

I have a free version of an app and a paid version. I'd like to give users the option to import their existing data from the free version into the paid version.
Currently the data is stored in Core Data.
I've looked at existing solutions across the internet and SO, the existing solutions suggest making a request from the free application to the paid application using a URL request that contains the data. (e.g. http://mobileorchard.com/lite-to-paid-iphone-application-data-migrations-with-custom-url-handlers/)
So my question is, how is best to implement the solution in Swift:
Is the URL method still the best approach?
Are there any code samples available?
One idea I've had is to convert the entire DB to JSON, then to make a request with the JSON payload and deserialise it into Core Data the other side. Create json string from core data and vice versa?
What I'd do is set up an app group that both apps can access. Put your data in the app group folder and access it from both versions. You don't need to copy it, just leave it where it is.
To do this:
Set up an app group in the "App Groups" section of the target settings in Xcode. Use the same app group for both versions.
Find the location of the app group folder with:
NSURL *groupURL = [[NSFileManager defaultManager]
containerURLForSecurityApplicationGroupIdentifier:
#"GROUP_NAME_HERE"];
Or in Swift:
//swift
let groupURL = NSFileManager.defaultManager().containerURLForSecurityApplicationGroupIdentifier("groupIdentifier")
Modify your Core Data setup code to put the persistent store file in the directory you found in the previous step.
Since you have existing apps, you probably want to move the existing data into the new app group directory. You'd do this by using migratePersistentStore:toURL:options:withType:error: to move the existing store to the new location from step 2.
At this point both apps can read and write the same directory. When people buy the paid app, the data is literally already there for it.
The keyword is Inter-App Communication. One straightforward way would be to write a URL scheme handler.
From: iPhone OS Programming Guide
Apps communicate only indirectly with other apps on a device. You can
use AirDrop to share files and data with other apps. You can also
define a custom URL scheme so that apps can send information to your
app using URLs.
Note: You can also send files between apps using a
UIDocumentInteractionController object or a document picker. For
information about adding support for a document interaction
controller, see Document Interaction Programming Topics for iOS. For
information about using a document picker to open files, see Document
Picker Programming Guide.
https://developer.apple.com/library/ios/documentation/iPhone/Conceptual/iPhoneOSProgrammingGuide/Inter-AppCommunication/Inter-AppCommunication.html

User stats required for an offline iOS web app

I'm creating an iPad bespoke web app for a sales team which, on occasions, will need to work offline. So far, so good.
The client wants to be able to grabs stats of when the app is used by the sales team? Am I able to write to a file locally, then upload this file or email it at a given time?
Many thanks
If I understand your question correctly, the answer is YES!
You can write and read any kinds of file to your app document. Please check this link. After grabbing your file info, you can send it by email or dropbox or......

share core data between many users on app

I wanna develop an iOS app as the platform for many users. Is it possible to enable multiple users of my app to share resources on the same core data database?
The other alternative to iCloud (with the whole ownership issue) is to have an online server that stores the data remotely.
Then you can create a web service to store and retrieve the data from the server onto the device.
yes This can be done using a custom url scheme on the iphone by help of iCloud URL.
but it has some dark sides.If you use a custom url scheme, only one application "owns" the data. The other application would have to import data from the main application.
another method is system pasteboard i.e. clipboard. you can put stuff on it and then launch another application with a URL that tells the other app to check the pasteboard.There's also the system pasteboard .
for more information on custom URL scheme check this link

How can I transfer files from one application to another in the same iOS device?

I am writing an iOS application that performs conversion of a file saved by another application on the same device to another format. How can I transfer files from one application to another in the same device? Note that the files are non-textual files.
UIDocumentInteractionController is your friend.
Basically it works like this:
App 1 registers as being able to handle files of type XYZ
App 2 implements UIDocumentInteractionController and will give users the options to "send the file to App1" (I believe this has to be user activated)
App 1 implements -(BOOL)application:openURL:sourceApplication:annotation: and deals with the transferred file which will be saved in your Documents/Inbox directory. From there you can copy the file elsewhere and then manipulated it, making sure you clean up by getting rid of the original one saved on the Inbox folder.
Class reference available here
Document interaction programming guide available here
If you are developing both apps, you can store shared information in the keychain as long as your bundle identifiers conform to the same bundle seed id. See here for more info. Of course, if you are making both applications, you can use a URL scheme to pass in base64 encoded data as well.
Update: As rog said below, UIDocumentInteractionController is great, but it is only available for 4.2 and up, so you are cutting out a major portion of your users if you want to use it.

Resources