0
我正在使用NSMediaQueries檢測已拍攝的新屏幕截圖。但爲了將我的應用程序推送到商店,我需要將它應用於沙盒。使用NSMediaQueries和沙盒
不幸的是,沙箱打破了我的NSMediaQueries,因爲我無法訪問返回的URL。
我知道雲應用程序是沙盒,能夠抓住最新的截圖。
有沒有人有一個提示如何解決這個問題?
謝謝。
提取代碼:
query = [[NSMetadataQuery alloc] init];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(queryUpdated:) name:NSMetadataQueryDidStartGatheringNotification object:query];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(queryUpdated:) name:NSMetadataQueryDidUpdateNotification object:query];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(queryUpdated:) name:NSMetadataQueryDidFinishGatheringNotification object:query];
[query setDelegate:self];
[query setPredicate:[NSPredicate predicateWithFormat:@"kMDItemIsScreenCapture = 1"]];
[query startQuery];
numberOfScreenshots = [query resultCount];
[self uploadToAmazonS3:[[[query results]objectAtIndex:([query resultCount]-1)]valueForAttribute:NSMetadataItemURLKey]];
你在訪問什麼?在粘貼板上返回的網址是?此外,沙盒時,你必須啓用你想要你的應用程序做的權利。您應該閱讀[App Sandbox設計指南](http://developer.apple.com/library/mac/#documentation/Security/Conceptual/AppSandboxDesignGuide/AboutAppSandbox/AboutAppSandbox.html),以確保您已正確實施沙盒。 – sud0
我讀過它。這些是截圖圖像? 是的,他們確實返回的URL(非沙盒模式指向桌面) – BrainOverfl0w
你在哪裏訪問的URL?你可以發佈一些代碼嗎? – sud0