25 Jul 2013, 16:20
Mypic_pragsmall

Cesare Rocchi (15 posts)

Welcome to the forum of iCloud for Developers. Thanks for buying a copy of the book!

Feel free to post questions about the book and iCloud in general.

26 Jul 2013, 01:50
Generic-user-small

iDevelop (16 posts)

Just purchased book, reading it and testing source code.

As far as the iCloud Core Data will there be changes/updates for the iOS 7?

Thank you for writing this book.

29 Jul 2013, 07:39
Mypic_pragsmall

Cesare Rocchi (15 posts)

Yes, the book will be updated to iOS7.

29 Jul 2013, 21:00
Generic-user-small

iDevelop (16 posts)

Great looking forward to it.

On brand new projects, do you suggest implementing it with the iOS 6 way or wait for the iOS 7 way for iCloud and Core Data?

30 Jul 2013, 08:53
Mypic_pragsmall

Cesare Rocchi (15 posts)

I am still building my opinion about that :)

31 Jul 2013, 05:13
Generic-user-small

iDevelop (16 posts)

I hear you :)

05 Oct 2013, 04:23
Generic-user-small

iDevelop (16 posts)

Just a follow up, since iOS 7 has been released any updated on using iCloud with Core Data using iOS 7?

Thanks.

06 Oct 2013, 11:21
Mypic_pragsmall

Cesare Rocchi (15 posts)

I didn’t notice many changes on that side. WWDC features only one video about the topic and it’s all focused on the Mac. I have tested the examples on in the book and they all works on iOS7. If you stumble upon any issue please let me know.

-c.

25 Oct 2013, 16:28
Generic-user-small

iDevelop (16 posts)

Under the procedure - (void) loadData:(NSMetadataQuery *)query once the document is opened it does a self.tableView reloadData which makes the UITableView reload entire table with every document.

Do you have an example code on how to do this without reloading the entire UITableView but just insert/Update/Delete appropriate rows?

Also with four records entered I see the self.tableView reloadData get called between 6 to 12 times when editing or creating a new record. Anyway to reduce this by checking when all files are downloaded then reload table?

Thank you.

28 Oct 2013, 19:48
Mypic_pragsmall

Cesare Rocchi (15 posts)

I don’t have an example right away but you can use tableView’s insertRowsAtIndexPaths:withRowAnimation: instead of reloadData. You will probably have to decide how you want items sorted (you can’t assume you get them in chronological order). The purpose of the book was to show iCloud functionalities, so I didn’t focus too much on the UI side of things. UITableView’s reloadData is highly optimized though, and reloads only visible cells. Unless you have noticed some performance issue (or want cell animations) I’d recommend to stick to it.

01 Dec 2013, 07:18
Generic-user-small

iDevelop (16 posts)

Thanks for the previous answer and I am making changes to use insertRowsAtIndexPaths:

I have a question if this the default way that iCloud UIDocument works or something else.

Every time the app loads the first time it looks like every single file is downloaded every time. I assumed that once a file is downloaded it is kept locally on the device under the iCloud url Document folder. If there were a change to that file then I would download the latest.

In order to test is to make sure that you remove the sample project app from memory then start the app.

I tried your sample and it does the same as my project. Because over time the number of files has grown greatly it is extremely slow to load all files.

Any ideas or suggestions? Thank you.

02 Dec 2013, 08:36
Mypic_pragsmall

Cesare Rocchi (15 posts)

The “Ubiquity container”, is a special folder within the app. If you delete the app that folder (and its content) is deleted too from the device. When you install and run the app again, the content is re-downloaded from iCloud, so there is no need to re-create the content for testing.

02 Dec 2013, 18:02
Generic-user-small

iDevelop (16 posts)

Yes, I understand about the “Ubiquity Container” folder is repopulated if the app is deleted.

My issue is a bit different, I do not remove the app I just remove the app from running in the background (double tap home button and remove app). Then I start the app and the check to see if the files in the “Ubiquity Container” have been downloaded always comes back as false but I do see the files there.

Below is my code

`

    NSError *error = nil;
    NSNumber* isDownloaded = 0;

    if ([fileURL getResourceValue:&isDownloaded forKey:NSURLUbiquitousItemIsDownloadedKey error:nil]) {
        if (![isDownloaded boolValue]) {
            // Download the file if necessary - BUT ALWAYS DOWNLOADS EVERY FILE EVERY TIME IT IS RUN
            [[NSFileManager defaultManager] startDownloadingUbiquitousItemAtURL:fileURL error:&error];
            NSLog(@"error: %@",error);
            [self.allContacts addObjectsFromArray:[[NSMutableArray alloc] initWithContentsOfURL:fileURL]];
        }
    }
    else {
        [self.allContacts addObjectsFromArray:[[NSMutableArray alloc] initWithContentsOfURL:fileURL]];
    }

`

Any thoughts?

Thanks for the help it is appreciated.

04 Dec 2013, 17:19
Mypic_pragsmall

Cesare Rocchi (15 posts)

May I ask why are you adopting this pattern? The gist of iCloud is that you open a file when you need it: if it’s local it opens right away, otherwise it’s downloaded and when it’s local you get a notification.

05 Dec 2013, 06:28
Generic-user-small

iDevelop (16 posts)

Great question :)

In this particular app the UITabView shows detailed information that is stored as an NSArray in each file. Because of this I cannot just show the file names or one or two pieces of information then open each file when user opens it. The information is actually show in each cell.

I am open to any ideas.

05 Dec 2013, 10:58
Mypic_pragsmall

Cesare Rocchi (15 posts)

I’d probably go with a file package. See chapter 5 & 6.

05 Dec 2013, 23:12
Generic-user-small

iDevelop (16 posts)

Thanks Cesare.

ps: This is an existing project and I was hoping not to re-do with file packages but I might not have any other choice.

03 Jan 2014, 15:38
Twitter1_pragsmall

Nigel Hamilton (2 posts)

I am just working through “iCloud For Developers”, running on iOS 7. I did the first part where I had yet to add Notifications. I ran on my iPhone, and then, the iPad to check that the 2nd device did not get updates with the latest entries (as I had yet to implement Notifications). However, I found that the second device did have the latest entries, even without Notifications. Does that sound possible? I did have a problem with the cell not showing subtitles. I ran the downloaded code for the chapter to check the subtitles in cell and realised that my problem was due to iOS 7 master-detail using storyboards automatically and so I had to change the storyboard cell to use subtitles.

04 Jan 2014, 20:24
Mypic_pragsmall

Cesare Rocchi (15 posts)

What do you mean by first part? The key-value store part?

05 Jan 2014, 19:27
Twitter1_pragsmall

Nigel Hamilton (2 posts)

Yes - the key value store part.

06 Jan 2014, 10:19
Mypic_pragsmall

Cesare Rocchi (15 posts)

Then yes, it is possible that content is propagated even if you don’t add notifications. This happens only with kvs.

  You must be logged in to comment