- (void)fetchRecordChangesWithCompletionHandler:

18 views
Skip to first unread message

rdu...@comcast.net

unread,
Jan 18, 2016, 11:22:02 PM1/18/16
to YapDatabase
Hi,
I am moving my apps into iCloud syncing and need to sync between iOS and os x versions of the app. I am looking at the CloudKitToDo example which does just what I want and trying to modify it now for my os x app and wondering how to work with the fetchRecordChangesWithCompletionHandler(s) as it uses the UIBackgroundFetchResult parameter. Am wondering how to look at that from os x side?

Thanks,  Rob




Robbie Hanson

unread,
Jan 19, 2016, 12:32:54 PM1/19/16
to yapda...@googlegroups.com
On OS X you might “#ifdef” it to use a different parameter type. Something like this:

#if TARGET_OS_IPHONE
- (void)fetchRecordChangesWithCompletionHandler:
                            (void (^)(UIBackgroundFetchResult result, BOOL moreComing))completionHandler;
#else
- (void)fetchRecordChangesWithCompletionHandler:
                            (void (^)(MyEnumResultType result, BOOL moreComing))completionHandler;
#endif

-Robbie Hanson


--
You received this message because you are subscribed to the Google Groups "YapDatabase" group.
To unsubscribe from this group and stop receiving emails from it, send an email to yapdatabase...@googlegroups.com.
To post to this group, send email to yapda...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

rdu...@comcast.net

unread,
Jan 19, 2016, 4:55:56 PM1/19/16
to YapDatabase
Thanks Robbie,
Initially I thought that might work but cloudKitManager.m is filled with method references to UIBackgroundFetchResult and I don't see how I can make the enum with correct values as the UIBackgroundFetchResult types won't be returned (not on OS X) to use. Will they?

I am looking at fetchRecordChangesCompletionBlock for the CKFetchRecordChangesOperation but again that uses CKServerChangeToken, NSDate, error...  

Bottom line is I currently use a simple NSArchiving of my objects stored locally and the NStableView is simply bound to the model object store so this is probably a bit over my head to get the Cloud bit integrated through Yap. I can adopt Yap easily for my iOS app but need to sync with OS X side. But it seems a bit tricky to refactor the iOS side for me. If anyone has an example of an NSTableView example or version of CloudKitToDo, please let me know. Thanks for YapDatabase - a great piece of work!

Rob

rdu...@comcast.net

unread,
Jan 20, 2016, 9:44:07 AM1/20/16
to YapDatabase
Digging deeper as there are no UIBackgroundFetchResultNewData types on os x I can only use fetchRecordChangesCompletionBlock and at least get the error out of that and just use moreComing. It won't have all the checks you set up with UIBackgroundFetchResult results.

Cheers,  Rob
Reply all
Reply to author
Forward
0 new messages