Commit 65cf74bf authored by Tobias's avatar Tobias

use watch directory as temporary directory for file transfers to watch

parent 08d3b61b
......@@ -206,7 +206,8 @@ static VLCWatchCommunication *_singeltonInstance = nil;
MLMediaLibrary *library = [MLMediaLibrary sharedMediaLibrary];
NSPersistentStoreCoordinator *libraryPSC = [library persistentStoreCoordinator];
NSPersistentStore *persistentStore = [libraryPSC persistentStoreForURL:[library persistentStoreURL]];
NSURL *tmpURL = [NSURL fileURLWithPath:[NSTemporaryDirectory() stringByAppendingPathComponent:persistentStore.URL.lastPathComponent]];
NSURL *tmpDirectoryURL = [[WCSession defaultSession] watchDirectoryURL];
NSURL *tmpURL = [tmpDirectoryURL URLByAppendingPathComponent:persistentStore.URL.lastPathComponent];
NSMutableDictionary *destOptions = [persistentStore.options mutableCopy] ?: [NSMutableDictionary new];
destOptions[NSSQLitePragmasOption] = @{@"journal_mode": @"DELETE"};
......@@ -250,7 +251,8 @@ static VLCWatchCommunication *_singeltonInstance = nil;
- (void)transferImage:(UIImage *)image forObjectID:(NSManagedObjectID *)objectID {
NSString *imageName = [[NSUUID UUID] UUIDString];
NSURL *tmpURL = [NSURL fileURLWithPath:[NSTemporaryDirectory() stringByAppendingPathComponent:imageName]];
NSURL *tmpDirectoryURL = [[WCSession defaultSession] watchDirectoryURL];
NSURL *tmpURL = [tmpDirectoryURL URLByAppendingPathComponent:imageName];
NSData *data = UIImageJPEGRepresentation(image, 0.7);
[data writeToURL:tmpURL atomically:YES];
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment