Question

I have created a QuickLook Generator for my application and I copied the quicklook generator to this location Containers/com.Aravindh.EgApp/Data/Library/QuickLook/QuickLookGenerator.qlgenerator by using this following code.

    NSString *path1 = [[NSBundle mainBundle] pathForResource:@"QuickLookGenerator" ofType:@"qlgenerator"];
    NSError *error;
    NSArray *paths = [[NSFileManager defaultManager] URLsForDirectory:NSLibraryDirectory inDomains:NSUserDomainMask];
    NSString *librayPath = [[paths objectAtIndex:0] path];
    librayPath = [NSString stringWithFormat:@"%@/Quicklook/QuickLookGenerator.qlgenerator",librayPath];
    if(![[NSFileManager defaultManager] fileExistsAtPath:librayPath]) {
        [[NSFileManager defaultManager] copyItemAtPath:path1 toPath:librayPath error:&error];
    }

But I am getting this error:

Error Domain=NSCocoaErrorDomain Code=513 "“QuickLookGenerator.qlgenerator” couldn’t be copied because you don’t have permission to access “QuickLook”." UserInfo=0x101518250 {NSSourceFilePathErrorKey=/Users/Aravindh/Desktop/EgApp/EgApp/build/Release/EgApp.app/Contents/Resources/QuickLookGenerator.qlgenerator, NSUserStringVariant=(
    Copy
), NSDestinationFilePath=/Users/Aravindh/Library/Containers/com.Aravindh.EgApp/Data/Library/Quicklook/QuickLookGenerator.qlgenerator, NSFilePath=/Users/Aravindh/Desktop/EgApp/EgApp/build/Release/EgApp.app/Contents/Resources/QuickLookGenerator.qlgenerator, NSUnderlyingError=0x10154dbb0 "The operation couldn’t be completed. Operation not permitted"}

Whether I have to mention anything in the Entitlementes.plist? How to Install QuickLookGenerator in the SandBox Environment ?

Was it helpful?

Solution

You don't need to copy the QuickLook plugin to ~/Library/QuickLook. If it's in YourApp.app/Contents/Library/QuickLook/ then the system will use it - this works with the sandbox because you don't need to do anything other than bundle the plugin with your app.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top