How can I make an SQLite database within an iPhone app available to the desktop? - iphone

My Android app stores its SQLite database on the SD card, so that when the phone is connected to a PC my desktop application can access it using an ODBC driver. Is a similar technique possible on the iPhone?
I know that iPhones do not have SD cards.

I use iTunes file sharing to access sqlite DBs on both the iPhone and iMac; iTunes moves the data. Enabled in the plist

As it has been said, it can't be done.
However what you could do is to embed a small Web Server into your App, and let the users to download the DB ( or even visualize it ), via WiFi on their homes/work. This approach would work for Windows/Mac/Linux users, and several apps are already doing it this way.
Good luck!

Not built-in, unfortunately. You'll have to roll your own Wi-Fi syncing system. You could use iCloud when it comes out in the fall, but that only works on Macs for now.

SQLite is present in the iPhone SDK, but there's no way to flag a file stored by your application as being visible to the file system when you plug your iPhone into the computer. As stated already by Chris Long, Apple's answer to this criticism is iCloud, which allows you to do synchronisation between arbitrarily many devices without cables, but that isn't available yet. The iOS 5 beta is available to registered developers and is publicly known to function with iCloud, so you could start developing now.
More painful temporary alternatives are to email the database out (there's a supplied way to do in-app email) or to expect your user to drag and drop the thing out of iTunes.

Related

Can a Mac OSX app access CloudKit without being on the Mac App Store?

Being on the Mac App Store is a requirement to access iCloud.
Will the same apply to accessing CloudKit?
The scenario is to have an Mac OSX application share data with an iOS counterpart via CloudKit.
According to this article - http://9to5mac.com/2014/06/05/icloud-drive-enables-non-mac-app-store-apps-to-use-icloud-document-storage/ - you do not but I'm seeking confirmation from any developer who has actually managed to do it.
This changed for Mac apps according to this WWDC video (see at minute 6:00):
https://developer.apple.com/videos/play/wwdc2016/226/?time=359
It's now available outside of the mac app store.
The article that you link to does not relate to CloudKit, and in fact does not even mention CloudKit. CloudKit is not iCloud.
What the article says (which is probably true) is that apps distributed outside the app store can access iCloud Drive. This is a new feature yet to be officially released which will apparently be something like Dropbox. Apps will probably be able to read/write files in iCloud Drive just like in any other folder on a Mac.
CloudKit is an entirely separate system with a web service-style API for reading and writing structured data using Apple's servers. It's not available to apps outside of the app store, because those APIs won't work unless the app has the appropriate capabilities via Apple's app provisioning process.
Since CloudKit is released in iOS 8 now, the question itself is valid though.
Quoting from the documentation:
CloudKit is an app service available only to apps distributed through the App Store and Mac App Store

Access iOS app documents directory from OS X

I'm working on an iOS app that creates some files and saves it in its documents directory. It would be really helpful for this app if I could create an OS X app that could access that apps documents directory as well as the pictures on the device. I know it's possible because of this app, but I can't seem to find a way to implement it. The iOS app does need to be approved by apple, but the desktop app doesn't. With these apps I am targeting non-jailbroken iOS 5 devices and OS X Lion. Any ideas on how I could do this?
A few other solutions I am considering:
upload the apps documents directory to iCloud and then download it on the desktop
upload to dropbox for auto syncing
make the desktop app into a server and upload from the app to the desktop over the network
Those are all backup solutions, but it would be great if I could do this without having to depend on the network.
Take a look at: libimobiledevice. It's a library designed just for that. Anyway, all of this is not supported by Apple, as there isn't any public API for accessing the filesystem.
You can make your device to act as a HTTP server. There are several 3rd parties libraries that can help you get started. I personally have used iPhonrHTTPServer3 which is based on CocoaHTTPServer?

Copying data from a free iOS version to a full version of my app?

How could a full version of my iOS app access / copy the database / settings from the free version ?
I'm thinking of providing a free version of my app and I can't see how people then buying the full version could get access to the data from my free version ?
All apps are isolated on iOS. They are installed as different iOS system users. One user do not have permission to access another user's files. In the old times, one common approach to address this problem is to enable iTunes file sharing. And tell users to manually copy the files.
Your better bet is to use the freemium model to sell your app. Make the app free, and unlock extra features via in-app-purchase. This way, your files, documents, settings won't need transferring to the pro version. The app itself becomes pro after unlocking.
Here is the guide from Apple: https://developer.apple.com/library/ios/#documentation/NetworkingInternet/Conceptual/StoreKitGuide/Introduction/Introduction.html (though not very intuitive).
The walkthrough here: http://troybrant.net/blog/2010/01/in-app-purchases-a-full-walkthrough/ is very helpful.
Last but not least, be aware that in-app-purchase is crackable. So please read: How to detect "IAP crackers"? , Verifying In App Purchase Receipt from Client , and https://stackoverflow.com/questions/4715414/apple-in-app-purchase-verify-receipt , verify in app purchase , In App Purchase Receipt verification within app .
Note that you are supposed to setup a server to validate iap receipts. Though it's doable from within the app, it's not safe. As far as I can remember, you can test in-app-purchase through StoreKit in iOS simulator v5.0, that should be Xcode 4.2. Before that, it can only be tested on a device.
#Dominik Hadl mentioned you can use a server to sync the file. The operation is usually complicated. If you prefer this idea, you can choose to use custom url scheme to launch one app from another to ease the operation. See steps below:
User press "Begin sync" in the free app to upload the file to your server
Server return the ID of the file to the free app
User press "Launch Pro App and Download my file", which leads to a custom url scheme to launch your Pro version (must be installed first), with the file ID
Pro version use the file ID to download that file directly
I think the only way how you can do this is syncing the data with some server, registering the device and the syncing the data back to the full version.
Because all iOS apps are sandboxed, they can't access any other application data (unless you have jailbroken iOS).
Since multiple apps can share the same iCloud container, I'd say that the best practice nowadays is to "simply" store the data in iCloud.
(I'm putting "simply" under quotes, because it is easy to put data in iCloud and take it out; but if you actually want to do syncing, you may need to do more than just "I'll load from iCloud and save to iCloud" in order to provide the best experience to the user.)

Accessing the iPhone filesystem from a Mac OS X application

I need to get a file (sms.db) from an iPhone connected to a Mac. I cannot find any way to access the iPhone filesystem searching in Apple Developers Connection...
I cannot SSH to the iPhone, the application I want to develop is meant to be used on non-jailbroken iPhones... And I would like to avoid some MacFuse modules I found googling, too... I would like to access the filesystem thru some sort of API, the simpler the better.
Thanks!
This api was developed to allow access to ios devices:
http://www.libimobiledevice.org/
There is no Apple-documented public API for accessing the entire filesystem on a stock OS iOS device. Even private OS/API calls won't work due to the app sandbox restrictions.
Xcode, iTunes, and probably other apps that take over the iTunes USB driver, are using a non-Apple-documented private API that only works over the USB connection.
It appears that DiskAid silences all nay sayers. That app seems to have complete access to the iOS device filesystem - whether or not iTunes is running and whether or not the files are shared. It even sees files down to root level. I am still trying to figure out how it is done. Oh yea, this is all on a non jailbroken device.
It is not possible for non-jailbroken iPhone due to file system restrictions.
You can't access the filesystem from an OSX application, the filesystem is locked down.
Phoneview (as mentioned in a few comments) does not allow access to the file system.
It uses public APIs to get things like call data and contacts, and allows you to copy files into one location on the phone.
From the FAQ: "PhoneView will store your files in the media section of the iPhone's disk"
Smoke and mirrors.
If it's for your own app, use the document sharing included in iOS 4.x. You can then have files show up in iTunes, and drop files from the desktop into your app's section.
A tutorial is found here:
Ray Wenderlich's nice tutorial

Can an iPhone OS app do a search of the device's filesystem?

Can I do a search of the iPhone filesystem from within an application? I need to search an iPhone OS device and return a list of all apps installed on an iPhone OS device. I am fairly aware of Apple's restrictions and rules concerning what apps can and mostly cannot do outside of the sandbox -- and know that aside from the Photo Album an Address Book (via specified classes) an application is not allowed to access much of anything outside of its home directory (sandbox) for security. But the boundaries are fuzzy.
Anyway, back to the question: Can UISearchBarDelegate (or any other class/protocol) allow me to search the iPhone device?
Unfortunatly you are still sandboxed, the only way to access the devices' filesystem is to create an application that is a jailbreak designed application.
Not strictly true - the app FileSystem, for example, allows you to browse the iOS file structure and view many (though not all) of the files. You can access almost all of the files from the iTunes backup however.