iPhone iOS5 iCloud do both apps have to be open to receive each other's iCloud updates? - iphone

I'm testing a library-based iPhone app with iCloud enabled. With such app, changes to the core data persistent store are propagated across multiple devices.
What interests me is: Do iCloud "documents and data" changes are propagated across devices when the app that needs to be updated is closed?
Scenario: Device A makes changes, Device B's app is closed. Once the user restarts device B some time later, the changes are already present.
or
Does the app have to be open on additional devices to request data model updates?
Scenario: Device A makes changes to iCloud based core data stack. Device B's app comes online, checks if there are changes, requests changes to be downloaded.
Thank you for the clarification!

The former option is closer to the reality, but neither of your options describes the situation correctly.
The point is, if you use CoreData with the iCloud, the update will come whenever
your app is running
and the OS decides it's the right time to tell the app.
Your app then passively respond to what the OS tells you, as in any event-driven app development. Read Apple's documentation and/or related WWDC slides available again on Apple's developer website.
Also, Drew McCormack has a series of great blog posts on this topic, called "Under the sheets with iCloud and CoreData", starting here.

Related

Coredata iPhone to iPad/Mac with iCloud?

We have finished writing an iPhone App that uses coredata.
In further versions we plan to add an iPad App that is able to display the data collected by the iPhone App (and of corse modify, use it) to give more interaction possibilities to the user.
My question is: Is it possible to move existing coredata (of already installed apps on iphones) to the cloud and read that data out with an iPad application?
If yes: can you point me in the right direction of where to start?
If no: is there another alternative to access coredata created with an iPhone App with an iPad app?
When using Core Data's built in iCloud support it doesn't matter what kind of device you're on, only that the Core Data stack is initialized the same way. Any iOS device or Mac can use the same iCloud store, and data created on one can be read on another.
One crucial detail though: If you already have a data store and you add iCloud support, those pre-existing records do not automatically get migrated to the cloud. iCloud works based on transaction logs, and transaction logs are only created when you save changes. Existing data that doesn't immediately change generates no transactions, and therefore doesn't go to the cloud.
If you have existing data when you add iCloud, you'll need to migrate the data to a new data store to force transactions for those existing records. You can do this fairly easily using NSPersistentStoreCoordinator's migratePersistentStore:toURL:options:withType:error: method. It's not hard, but it's not always obvious that it's necessary.
To get started, I first suggest watching Apple's WWDC videos on iCloud-- especially WWDC 2012's session 227, Using iCloud with Core Data. Next, I suggest extreme caution, because as of today Core Data's iCloud support is still, shall we say, far from being the most reliable of Apple's APIs.

Acceptance of Location tracking app with nsTimer in background in apple market

I have created this location tracking app, that uses nstimer in background to fetch location every 4 mins.
I am wondering if there will be any problem in submitting the app in the market place..
If you know something regarding it, can you please let me know.
Thanx.
If it's relevant to what your app is doing I don't think it will be a problem.
This is from Apple's App Store Review Guidelines:
4.1 Apps that do not notify and obtain user consent before collecting, transmitting, or using location data will be rejected
4.2 Apps that use location-based APIs for automatic or autonomous control of vehicles, aircraft, or other devices will be rejected
4.3 Apps that use location-based APIs for dispatch, fleet management, or emergency services will be rejected
4.4 Location data can only be used when directly relevant to the features and services provided by the app to the user or to support
approved advertising uses
But pay attention that if you want your app to keep getting location updates even in background, you need to declare this in your plist file, otherwise when the app goes to background you won't be able to get location updates.
Declaring Your App’s Supported Background Tasks
Support for some types of background execution must be declared in
advance by the app that uses them. An app declares support for a
service using its Info.plist file. Add the UIBackgroundModes key to
your Info.plist file and set its value to an array containing one or
location—The app keeps users informed of their location, even while it
is running in the background.
I've gotten one app through. You have to make sure that the user is informed exactly as to what is going on. So dialogs have to be very specific and have a privacy policy in place.
4 minutes is a little bit extreme if that's a permanent state of your app.. I don't think Apple would allow that if they found it during app review. Would it not suffice to just have it updated based on movement? ie. the significant location change api?
The app I did this for used significant location change api for background location tracking and then stepped it up to higher frequency tracking if the app was actually open.

Is there a way to completely disconnect an App from iCloud?

My App can work with or without iCloud support.
If a user connects a device to iCloud and then wants to disconnect it, it's pretty easy for me to copy all data back to the local sandbox and stop using iCloud, and this device won't contribute anything new to iCloud anymore. However, changes from other devices will still be received (although not handled) on this device.
Is there a way to completely disconnect the device from iCloud, so that new changes won't be received?
iCloud stores data in a folder called "Mobile Documents." Your app's container resides in this folder. iOS devices know about new files and changes immediately. However, they do not actually download the file until the app specifically requests it. Here's an example scenario:
Someone is running your app on their iPhone and their iPad. They use iCloud on both. However, on their iPhone they disable your app's iCloud but leave their iCloud account active. This means that their device always knows about changes. But since your app never requests those documents, they are never downloaded to the device and therefore do not take up space. Also, iOS will automatically remove the local copy of an iCloud file to free up space if necessary.
For more information, see developer.apple.com/icloud, specifically the videos on how to use iCloud.
You can simply stop responding to the NSNotifications received by your app. You can either unregister your views from these notifications, or ignore them when they're received.

Checking incoming call notification in iPhone

I am working on iPhone game application, in which user can play game and records some data.
My problem is that the application not supporting background processing. In my application if call's appearing then my application is terminated. But I need to save user current state.
I have read some blog and post in which they have mention that core telephony frame work can give us all such state and notification. But someone mention that core telephony API is an private API. If will use this API then APPLE accept my application or not? I need to save my application current state.
You are looking for the answers in the wrong place. You do not need any access to the telephony API.
Apps by default enter the background and return to the foreground, on modern devices and iOS versions - Perhaps you are running your app on an older device or on iOS version 3.x, in which case all apps (not just yours) will be terminated when they are "exited".
Even in this case the solution is not the telephony API, but handling a notification sent to your app about your application terminating - You can save state there, and then reload it when your app is re-run.
Check out these links for more information:
App states and transitions
Multitasking

Sending notifications from Mac to iPhone/ iPad/ iPod touch

I currently sell a Mac-only productivity tool that uses visual and audio notifications to remind the user of certain events taking place.
I've started planning the iPhone and iPad versions of that Mac program and would like to be able to provide notification services from the Mac to the iPhone, e.g. instead of the Mac playing an audio cue, the iPhone could vibrate, etc.
I have so far done very little iPhone development and I'm not really sure how the various push notification services work. Is this easy enough to do? or is a "challenge".
A few more potentially relevant pieces of information:
there will be a Dropbox-based sync between the iPhone and the Mac versions, so there is also the possibility of "sharing" a file that would prompt some action
it might be acceptable as a first step to not have "background" notifications and require that the iPhone client is running
What authentication issues should I expect to deal with?
You'll need to implement APNs (Apple Push Notification Service) in both your app and your server.
To clarify a few things:
You'll need a server doing those transferring messages job between the user's Mac/PC and their iDevices.
Your server will decide when to push what kind of notification to which user's device.
After that, your server sends a message to Apple's APNs server, which will push that message on your behalf.
It's absolutely OK that your app can be in the background or even closed when the APNs message arrives at the user's device. The user will be guided by the OS to open your app.
If the user has explicitly disabled your app's APNs function in her/his device, or, if the user cancels the APNs alert when it arrives, your app won't be launched if it originally stays in the background or if it hasn't been open yet.
The user will be asked to enable (as you put it, authenticate) your app's APNs function by the OS in her or his device when your app is launched for the first time.
It's not a challenging task for an experienced iOS developer or an experienced PHP developer, since Apple's documents and APIs are pretty straightforward. However, configuration on the server side can be a little tricky.
I believe Stack Overflow already has tons of information on how to enable APNs in iOS apps. All you need to do is be specific in your question and do the search work beforehand.
Hope that helps.