iCloud update policy on CoreData in development and production mode - objective-c

as specified in the subject I am developing un application that made use of CoreData and its built in iCloud feature.
Whenever I connect my devices (an iPad and an iPhone) to xcode and run the application, I can see after few minutes the log of CoreData updating data. In both devices on iCloud section, I can see my application full entitled for iCloud.
First question: how often are iCloud content pushed (or pulled) to devices ? Is there a way to force this ?
Second, I noticed that the devices, once disconnected from Xcode, doesn't update their data anymore.
While if plugged again and run the app, the data get updated.
So the question, is iCloud in development mode (the app is not yet submitted to App Store) working only trough xcode, and if yes why ?
Or am I doing something wrong within the objective-c code itself ?
thanks

The updates are getting pushed to iCloud servers whenever you save CoreData moc.
The updates are getting pushed from iCloud to device automatically. There's no way to force it as far as I know.
It can take from seconds to dozens of minutes for an update from iCloud to appear on your device (also depends on your connection speed). Apple doesn't give any guarantees on when it will actually happen.
I haven't seen any difference in iCloud behavior whether app started fom XCode or not. Check your code and UI updates base on iCloud pushes.

Related

Objective-C: check state of do not disturb per application on OS X

MAC OS X has settings per application and you can turn on Do Not Disturb Mode just for a specific one: https://www.reddit.com/r/apple/comments/2r0bji/do_not_disturb_mode_in_os_x_when_using_a_specific/
Also...there is a way to detect the DND mode set for the whole system, based on this: Programmatically check state of do not disturb on OS X
But is there any API that would allow me to do a check per application and see if it has DND enabled or not?
There is no per-app Do Not Disturb in macOS.
The closest you're probably going get to this is retrieving the enabledRemoteNotificationTypes method of NSApplication
This returns a NSRemoteNotificationType value, which contains a bitmask whose values indicate the types of push notifications that the app requested.
The possible values are:
NSRemoteNotificationTypeNone - The app should not display a badge.
NSRemoteNotificationTypeBadge - The app should display a badge.
NSRemoteNotificationTypeSound - The app should play a sound.
NSRemoteNotificationTypeAlert - The app should display an alert.
This is only going to be useful for the current running app and you can get more info from the Apple Developer site
Another potential place to look:
You can find the SQLite database that NotificationCenter uses at in following directory:
getconf DARWIN_USER_DIR + /com.apple.notificationcenter/db, however do be careful, as mine wasn't in /db, the latest version was in /db2
Prior to Yosemite, this file was located at ~/Library/Application\ Support/NotificationCenter/
I haven't gone through this database so I can't tell you whether or not applicable settings reside here, but it's a good place to start looking.
If you're publishing your app on the App Store, you probably won't be able to use this method because of sandboxing, but it's worth a try either way.

How big can an iPad app be within its sandbox?

I will be making an iPad app with many images (embedded) and it will be around 2gbs. I have made apps this size before for b2b with no issues. My question is does this 2gb limit Apple has extend to the downloading of new content packages? So the app ships much like a magazine app - at about 30-50mbs, say. And then you can download packages that might make the entire app 12gbs.
Apple's app size limit (50MB currently) only applies to mobile downloads, but not to WiFi downloads or purchases on your computer. There are a number of apps available today that exceed this limit (>1GB for some navigation packages that ship with custom offline map data).
However, that's not really a good user experience. Since there is still no incremental update system available on the App Store, the users will have to download the full app after every update.
Downloading this content from your own server after purchase might be a better option, if you can afford the traffic, since that data won't be cleared during an update. Make sure you disable iCloud backups for it though.
That being said, I wonder what kind off app requires 2GBs of essential images. Are you sure every user needs all of them at the same time? Can't you just download what is necessary?
The size limit of 2 GB only applies to the app itself, i.e. what's downloaded from the App Store. The size of things that the app downloads once it's installed is not really limited, but you must make sure that large data is not backed up via iTunes/iCloud, otherwise your app will very likely be rejected for violation of the iOS data storage guidelines.

Is NSUbiquitousKeyValueStore certified to work without a connection?

The documentation doesn't seem very clear about this, but can I rely on NSUbiquitousKeyValueStore to persist data locally when the device is not connected, or should I also use a NSUserDefaults?
From the iCloud design doc with regards to Key Value storage
Always effectively available. If a device is not attached to an account, changes created on the device are pushed to iCloud as soon as the device is attached to the account.
(in the table at the bottom of the page)

How can I synchronize items with the cloud while my app is in the background?

In my iPad app, the user can enter data online or offline, storing the data in SQLite, and when the user goes online, he hits a "sync" button, whereupon the data will be synced up to the cloud.
If the user enters data offline, the data persists in the local SQLite DB. If the data is not yet synced, I set a badge to the number of records pending sync.
When the user starts up his iPad, he should get some alert on startup saying "There are 5 records pending to sync." Then all the pending records will be synced, without opening my app.
Has anyone come across a similar scenerio? Does anyone have any idea how I can do that?
Before iOS 5.0 it was not possible to synchronize data with your application when the application was not running. However there were some scenarios when the app could e.g finish a download when the App was terminated but this background-processing is rather limited.
Now if you want to sync to the cloud and have the same data available on another iOS device or on a Mac app then I guess iCloud might be exactly what you are looking for.
So a possible scenario with iCloud might look like this:
You have your iCloud enabled App installed on two iPads
On both iPads you are logged in with your iCloud account (this has to match since iCloud is tied to a given Apple ID
When your App stores some data on iPad1 it will automatically be synced to the cloud
On the same time this data is downloaded to the iPad2 (which has to have internet connection) while your application is not yet launched. This is only possible with iCloud
When you now start your App on iPad2 (even if it is now offline) you will have the current data available within your App.
However, if you are running your own server backend, and maybe need more control over the data on the server, iCloud might not (yet) fit your needs there. You might want to check out the documentation or the sample code for iCloud: iCloud for Developers (Apple Developer Account required)
If you chose not to use iCloud then there is currently no way that you can sync data while your application is not running.
Edit:
A scenario without iCloud could look like this:
You enter Data on iPad1 while offline and set the badge to the number of unsynced items
Later you have internet connection, so you start the app and the items can be synced to your server.
Your server stores the newly arrived entries and could now send a Push notification to your App which is installed on iPad2 telling the user that there are n new entries on the server.
From that notification the user could now decide to open the app and the new items could then be downloaded to the iPad2.
If the user dismisses the notification then no data is downloaded until he starts your App the next time.

iOS Crash Reporter Service / Alternative to MacDevCrashReports.com

I'm looking for a iOS crash reporter web service. I know MacDevCrashReports but they currently do not accept new sign ups.
I know there is a open source crash reporter framework on GitHub, but I don't want to put that stuff on a server, configure it and so on. A nice web service would be much nicer.
Thanks,
Patrick
I've been using Crittercism for my iOS and Android apps. It's saved me a LOT of time. It has a few more features than BugSense and Hoptoad.
MacDevCrashReports is running out, since I am not able to continue providing the service for free, the amount of data is just too huge. 100.000 crash reports e.g. require about 2GB of storage. BUT I am working on a new service with some friends to provide enhanced functionality for managing crash reports and other developer related data. You might want to check for HockeyApp for news about that.
Until then, you can also use the source MacDevCrashReports is based on, on your own web server. It is completely open source and available at GitHub.
The process of collecting crashes is using PLCrashReporter. Which is more reliable and is async-safe. There are also cases of crashes, like crashes in objc runtime, where it will result in a deadlock (Information by Landon Fuller, creator of PLCrashReporter).
Symbolication of PLCrashReporter created crash log files, can be done with the dSYM bundles, check this description.
Regarding the AppStore argument from Peter. As Patrick points out, this is not working for Ad-Hoc builds, which is one big issue, since you want to find and fix the crashes while testing. On the other side, the crash reports in iTunes Connect are very inaccurate:
The data set only updates once a day
The data is only available after users sync their devices with iTunes and only IF they agreed sending that data. Since most users don't understand the dialog, they deny
You only get a subset of crashes, the top 5
You don't get instant reports, as opposed using an in-app reporter
You don't get grouping of similar crashes as the web service does
You don't get a web interface to work with the crashes, make notes, mark as fixed, etc.
iTunes connect reports for my app to have 0 (zero) crashes, but in my database there are about 200! Check this blog post by futuretap about their experience and findings of using an in-app crash reporter.
There is a new service called BugSense . Give it a shot!
For ad-hoc crash reports you can use TestFlight. It has TestFlights SDK, using which you can collect crash reports and additional data, checkpoints, feedbacks.
If you're distributing through the App Store, you should get crash reports in iTunes Connect.
We're playing around with Hoptoad for some apps. Looks to work pretty well.
I've used HockeyApp and Crashlytics with great success. HockeyApp is nice in that once you've added your IPA file to their service they even provide a download page for you to distribute your build to your testers.
Crashlytics is a little cleaner from a UX perspective but it's still in beta and has a bit of a wait period whereas HockeyApp you can use immediately and it's a bit more mature. It also seems Crashlytics gives preference to apps that are already in the app store when you sign up for the program.
You can also check out BugHD,support iOS,Mac & Android Crash Report
For tracking crashes, I really like Appsee for iOS (although also great for Android apps). It gives detailed crash reports, and also session recordings that let you visually monitor all crashes within your app.
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
Appsee.start()
return true
}