view · edit · sidebar · attach · print · history

20130925-update-barcode-image-saving

<< | Index | >>


Summary

  • Create saving of image on iCloud
  • Create sync On/OFF switch in Settings

Commits / Patches / Pull Requests

Index / Status


Save barcode images on iCloud

links

Currently got this error.
Maybe URL path has problem.

2013-09-25 11:52:03.325 generika[1714:60b] -[ProductManager storeBarcode:ofEan:] [Line 158] itemAtURL #=> file:///var/mobile/Applications/BF151CD8-6BB9-484C-BAA1-9BBEEC502A3B/Documents/barcodes/7680451140154_1380077523.png
2013-09-25 11:52:03.327 generika[1714:60b] -[ProductManager storeBarcode:ofEan:] [Line 159] barcodesDir #=> file:///private/var/mobile/Library/Mobile%20Documents/4B37356EGR~org~oddb~generika/Documents/barcodes/7680451140154_1380077523.png
2013-09-25 11:52:03.334 generika[1714:60b] -[ProductManager storeBarcode:ofEan:] [Line 161] error #=> The operation couldn’t be completed. (Cocoa error 4.)

After create of directory "barcodes" in iCloud stroge, save works.

# move file to iCloud
    saved = [fileManager setUbiquitous:true
                             itemAtURL:[NSURL fileURLWithPath:filePath]
                        destinationURL:[dir URLByAppendingPathComponent:fileName]
                                 error:&error];

# copy local file to iCloud
    NSString *fileName = [filePath lastPathComponent];
    saved = [fileManager copyItemAtURL:[NSURL fileURLWithPath:filePath]
                                 toURL:[dir URLByAppendingPathComponent:fileName]
                                 error:&error];

I copied image in async block.


Remove image from iCloud

used removeAtItemURL:error of NSFileManager.

    NSURL *dir = [[ubiq URLByAppendingPathComponent:@"Documents" isDirectory:YES]
                        URLByAppendingPathComponent:directory isDirectory:YES];
    NSFileManager *fileManager = [NSFileManager defaultManager];
    NSError *error = nil;
    saved = [fileManager removeItemAtURL:[dir URLByAppendingPathComponent:fileName]
                                   error:&error];

Create iCloud sync switch in settings

Create Sync switch in settings. This value is stored in NSUserDefault.


Load updated images via notification for updates in multi devices

continue to weekend.

view · edit · sidebar · attach · print · history
Page last modified on September 25, 2013, at 10:09 AM