Commit a4ee0590 authored by Tobias's avatar Tobias Committed by Felix Paul Kühne

simulator app groups workaround for when entitlements are not correctly added for a simulator build

parent 6247f5dd
......@@ -218,7 +218,15 @@
MLMediaLibrary *mediaLibrary = [MLMediaLibrary sharedMediaLibrary];
NSURL *groupURL = [[NSFileManager defaultManager] containerURLForSecurityApplicationGroupIdentifier:@"group.org.videolan.vlc-ios"];
#if TARGET_IPHONE_SIMULATOR
// if something went wrong with the entitlements in the Simulator
if (!groupURL) {
NSArray *pathComponents = [[[NSBundle mainBundle] bundlePath] pathComponents];
pathComponents = [pathComponents subarrayWithRange:NSMakeRange(0, pathComponents.count-4)];
NSString *groupPath = [[NSString pathWithComponents:pathComponents] stringByAppendingPathComponent:@"Shared/AppGroup/fake-group.org.videolan.vlc-ios"];
groupURL = [NSURL fileURLWithPath:groupPath];
}
#endif
NSString *oldBasePath = [mediaLibrary libraryBasePath];
NSString *oldPersistentStorePath = [oldBasePath stringByAppendingPathComponent: @"MediaLibrary.sqlite"];
......
......@@ -44,6 +44,15 @@ static NSString *const VLCDBUpdateNotificationRemote = @"org.videolan.ios-app.db
[super awakeWithContext:context];
NSURL *groupURL = [[NSFileManager defaultManager] containerURLForSecurityApplicationGroupIdentifier:@"group.org.videolan.vlc-ios"];
#if TARGET_IPHONE_SIMULATOR
// if something went wrong with the entitlements in the Simulator
if (!groupURL) {
NSArray *pathComponents = [[[NSBundle mainBundle] bundlePath] pathComponents];
pathComponents = [pathComponents subarrayWithRange:NSMakeRange(0, pathComponents.count-4)];
NSString *groupPath = [[NSString pathWithComponents:pathComponents] stringByAppendingPathComponent:@"Shared/AppGroup/fake-group.org.videolan.vlc-ios"];
groupURL = [NSURL fileURLWithPath:groupPath];
}
#endif
MLMediaLibrary *mediaLibrary = [MLMediaLibrary sharedMediaLibrary];
mediaLibrary.libraryBasePath = groupURL.path;
mediaLibrary.additionalPersitentStoreOptions = @{NSReadOnlyPersistentStoreOption : @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