Merge lp:~urbanape/ubuntuone-ios-files/fix-deleted-assets-crash into lp:ubuntuone-ios-files

Proposed by Zachery Bir
Status: Merged
Approved by: Jason Foreman
Approved revision: 41
Merged at revision: 41
Proposed branch: lp:~urbanape/ubuntuone-ios-files/fix-deleted-assets-crash
Merge into: lp:ubuntuone-ios-files
Diff against target: 75 lines (+1/-22)
2 files modified
Files/Files-Info.plist (+1/-1)
Files/U1AutoUploadsManager.m (+0/-21)
To merge this branch: bzr merge lp:~urbanape/ubuntuone-ios-files/fix-deleted-assets-crash
Reviewer Review Type Date Requested Status
Jason Foreman (community) Approve
Review via email: mp+85371@code.launchpad.net

Description of the change

This branch fixes the crashes that are caused by trying to deal with non-existent ALAssets during the re-queueing previous uploads step. Now, all asset fetch failures will be dealt with at the time of the upload operation. This isn't necessarily the best way, but right now, it at least prevents crashy failure.

To post a comment you must log in.
Revision history for this message
Jason Foreman (threeve) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'Files/Files-Info.plist'
2--- Files/Files-Info.plist 2011-12-09 20:45:10 +0000
3+++ Files/Files-Info.plist 2011-12-12 18:04:37 +0000
4@@ -41,7 +41,7 @@
5 <key>CFBundleSignature</key>
6 <string>????</string>
7 <key>CFBundleVersion</key>
8- <string>25</string>
9+ <string>26</string>
10 <key>LSRequiresIPhoneOS</key>
11 <true/>
12 <key>NSMainNibFile</key>
13
14=== modified file 'Files/U1AutoUploadsManager.m'
15--- Files/U1AutoUploadsManager.m 2011-12-09 19:56:28 +0000
16+++ Files/U1AutoUploadsManager.m 2011-12-12 18:04:37 +0000
17@@ -370,7 +370,6 @@
18 matchingPredicate:p
19 withSortDescriptors:[NSArray arrayWithObject:sortBy]
20 error:&error];
21- __block NSMutableArray *assetsDeletedFromLibrary = [NSMutableArray array];
22
23 [previouslyQueuedU1Assets enumerateObjectsUsingBlock:^(U1Asset *u1asset, NSUInteger idx, BOOL *stop) {
24 if (u1asset.fileNode.parent == self.remoteUploadFolder)
25@@ -380,7 +379,6 @@
26 if (asset == nil)
27 {
28 NSLog(@"In the results block, but asset is nil!");
29- [assetsDeletedFromLibrary addObject:u1asset];
30 }
31 else
32 {
33@@ -394,7 +392,6 @@
34 }
35 } failureBlock:^(NSError *error) {
36 NSLog(@"Error: %@", error);
37- [assetsDeletedFromLibrary addObject:u1asset];
38 }];
39 }
40 else
41@@ -406,7 +403,6 @@
42 if (asset == nil)
43 {
44 NSLog(@"In the results block, but asset is nil!");
45- [assetsDeletedFromLibrary addObject:u1asset];
46 }
47 else
48 {
49@@ -428,26 +424,9 @@
50 }
51 } failureBlock:^(NSError *error) {
52 NSLog(@"Error: %@", error);
53- [assetsDeletedFromLibrary addObject:u1asset];
54 }];
55 }
56 }];
57-
58- // Iterate over the assetsDeletedFromLibrary, and clean them up.
59- [self.dataRepository dispatchAsyncBlockWithManagedObjectContext:^(NSManagedObjectContext *context) {
60- for (int i = 0; i < [assetsDeletedFromLibrary count]; i++)
61- {
62- U1Asset *assetToBeDeleted = [assetsDeletedFromLibrary objectAtIndex:i];
63- U1FileNode *placeholderNode = assetToBeDeleted.fileNode;
64- [context deleteObject:assetToBeDeleted];
65- if (placeholderNode.generation == nil)
66- {
67- [context deleteObject:placeholderNode];
68- }
69- [self.dataRepository save:NULL];
70- }
71- [assetsDeletedFromLibrary release];
72- }];
73 }
74
75 - (NSString *)remoteUploadFolderPath;

Subscribers

People subscribed via source and target branches