How to make iPhone app sync data through laptop? - ios

Currently my application is getting data from remote server through web services. But some times user are in area where network is rarely available. So in that case I just want to sync data for application through their laptop (window or mac).
For example I need to sync 100 images in to the app. I create an environment on laptop where I create a folder and keep images there and once iPhone get connected to laptop through wifi all images get synced with the application.
However I don't want automatically it can be usually on button action. But please guide me is there any way?

Just create a web service on the laptop and use that to do the storage. I have done similar things and I have gone the route of storing data locally in a Core Data model and then syncing to a server when the user comes back within range.

Related

How to get the saved text file from my iOS App to PC?

I build an iOS App that collects data via BLE and saves it as text files. What I want to do now is to retrieve the saved data on my PC (Windows) for further analysis. As the developer I know I can download the App container via Xcode for accessing the saved file and it works well. However, I wonder if there’s any approach that I can get the saved files without using Xcode? Can I save the text files to a public location so I can access them directly?
In short, you can't do what you want in this exact way, as iOS devices do not support the USB mass storage protocol. The only way to get files out is using iTunes, which can access your iOS device's Documents folder.
Of course, you could reverse-engineer that protocol, but that's a bit unreliable and might break if Apple ever changes something.
Instead, find another way. E.g. you could have your PC app contain a tiny HTTP server and have your iOS app send an HTTP request to it that contains the file's data. Alternately you could even go via an actual server on the internet.
Or, given all iOS users have iCloud, you could also just save your data to iCloud, then have your PC users install Apple's iCloud for Windows stuff and then just access the file from there.
If I understand you correctly, you want to access the client's data on the PC.
You can create a file server or use a third party service like Amazon S3(https://aws.amazon.com/s3/).
Client upload that collects data through the http/https protocol.
PC download the client's data and analysis.

Is it possible to run queries on the offline local version of Firebase on mobile device?

I'm considering to use Firebase as the server database for the mobile app (iOS). The point is user should be able to:
Work offline with data
Run some queries on data even if it's offline
So I believe the first problem is not a problem anymore as for Firebase implemented the local offline version but what about the second one?
The scenario is: user downloads data when it's online and keep working with loaded data even if it's offline. What does it mean - the app allows user doing search by different criteria, so I have to implement some type of queries on the mobile. I can't figure out though if it's possible with Firebase.

Core Data - Savings and sharing images via iCloud

I have an app that allows a user to either take photo or point to a photo on from their camera roll. This record must be peristed locally. A record consists of text and an image. Savings this data on a single device seems simple, as I can persist the link to the image or store the image locally in the file system if taken via camera.
Problem is how to share this record via iCloud to make record available to all instances of the app on multiple devices. I.e iPhone creates a record with an image, which is then available to view on iPad or Apple TV.
Is it efficient to store a UIImage in a Core Data record and make this available via iCloud? Many people saying not for local storage
My concern is this could potentially be some large quantities of data?
Does anyone have any thoughts on how to solve this issue?
I´m working on a similar app, for me working with http://Parse.com is a solution.
If your user have an internet connection and can wait to upload the images/text files you can save it directly using Parse (with a fancy progress Bar!) But if you want to make it network-less proof, you might work as whatsapp. I mean using Core Data to save your files locally, then try to upload the imagens whenever there is internet available.
There are some others clouds DB you can use, but I´m familiar with this one.
You can upload to iCloud using NSFileManager.
There is a complete walkthrough on how to do that.

Best practice to sync webservice with offline storage on iOS

I have been working on a few iOS applications that talk to a REST API on the web server and than sync some data down for offline usage. The app then stores data locally if network connection is not available and than syncs with backend whenever the Internet connection is available.
I am wondering if there is a nice pattern or set of rules or library that can be used. I would rather not code this again and again. I know the business logic / sync logic would be different for each app but the rest of the work (ie. storing it locally, calling REST API) can be abstracted out.
Any ideas?
I use the RestKit framework in my app for the exact scenario you describe. The downloaded data are stored in a Core Data store for offline usage.

iOS: filesharing without iTunes?

I develop an enterprise application for iOS and the user should be able to add files from the desktop to the application.
I implemented this using filesharing, which works great.
Now this company wants to get rid of iTunes from their machines (which is quite understandable, iTunes is a very invasive process).
The question is, is it still possible to somehow use filesharing without iTunes? maybe with another application?
Or what other way is there to send files to the app (preferrably without the need of an internet connection)
//edit: must work on windows 7 and must not require to install iTunes (there are some other tools that allow access to the iPad filesystem, but they go through drivers installed by iTunes)
You could exchange data via the local wireless network (a connection to the internet is not required, just the iOS device and the Windows computer need to be on the same network).
One option:
You can then create a simple TCP/IP connection over sockets between an iOS app and a Windows application and exchange the data you want.
However you probably need to implement a suitable simple Windows application to do this.
An other, maybe simpler, solution:
You could start a webserver in your iOS-App and show it's IP on the screen. By entering this IP in a browser on the desktop computer you can access websites on the iOS device, which can make documents available for download or receive uploads.
For how to do this, have a look at this question.
There are a number of ways to achieve this, ranging from trivial to sophisticated.
Your question says that you would prefer to avoid an internet connection. Simple solutions may require it - if you want to abstract the difficult parts, you're going to have to let somebody do the dirty work, and that's probably going to be someone(thing) on the internet. Midrange solutions may require a network but not internet connection. A sophisticated solution could probably be whatever you want - but one thing I would say, is that trying to tap into the USB connector is either going to result in a hacktastic or very complicated solution to implement.
One method would be to integrate a third party framework that basically does what your looking for. Look at the Dropbox development kit, for example - allowing Windows (or any platform) users to drop files on their desktops into a shared dropbox, and this can then be read by an iOS application which includes the iOS drobox API.
Another method would be to setup a simple WebDAV server in your office. Host it on a windows box, or a cheap linux box. Give users desktop's access to the share via whatever protocol you want (eg, Windows File Sharing). Then you'd implement a WebDAV client in your app (eg, WTClient) to pull files.
Finally, you could build your own transmission system. A sophisticated example might involve Bonjour and TCP/IP, a simpler-but-custom solution may involve a simple JSON web service running off a local (or remote) server.
I have suggestion but that will require the Internet. I would suggest you to use the DropBox API in the windows and iPhone both. It's awesome to use and very simple for file sharing.
Now a days everybody have dropbox account and have files in it to share. So that shouldn't cost anything other than a bit of implementation (this learning can also be used in other file sharing applications).
Here are some guidance:
iOS
REST API
You can add apps and documents to USB-connected devices with the Apple Configurator
You may use a simple Ftp server installed on PC, so you can connect to server from Ios and upload/download files from iOS to PC....
http://developer.apple.com/library/ios/#documentation/Networking/Conceptual/CFNetwork/CFFTPTasks/CFFTPTasks.html
All work is done by Pc and your app will use IP (Intranet or Internet) of PC to share all files.
From Ios you can read all files in FTP server and work with them.
I use the FileBrowser app to get access to network shares over WiFi and will allow you to load supported files to the device. The company responsible is creating an API to allow you to do this within your own app: https://twitter.com/#!/Stratospherix/status/193114857271336960

Resources