appstore-sandbox

NSSavePanel not working when sandboxed? - OSX • Objective C

大兔子大兔子 提交于 2019-12-13 19:05:33
问题 I have the following save panel in my app. I have recently tried to sandbox it but unfortunately when sandboxed saving doesn't seem to be working. I understand that beginSheetForDirectory is depreciated, so possibly that's why it's not working? How can I get this to work with sandboxing? - (IBAction)saveButtonPressed:(id)sender { NSSavePanel *sp = [NSSavePanel savePanel]; [sp setRequiredFileType:@"jpg"]; [sp beginSheetForDirectory:[NSString stringWithFormat:@"%@/Pictures", NSHomeDirectory()]

Desktop Sandboxing Issue with Swift macOS

為{幸葍}努か 提交于 2019-12-12 18:26:08
问题 I've been trying to write a Mac app lately, and have run into an issue. This is not overly major but it would be great to have a solution. I have to load an image at runtime, specified by the user (so no, I cannot embed the image into the bundle as many alternatives suggest), and embed it into an NSTextView using NSAttributedText. The image loads fine from the Pictures directory (/Users/USERNAME/Pictures/IMAGE) etc, but not from the Desktop. I have checked the Capabilities tab in Xcode, and

How do I gain access to files referenced by another file when sandboxed (app-store)

耗尽温柔 提交于 2019-12-12 13:10:20
问题 For example if I have an XML file (exported from another app, so I have no control over the contents) that references images in different folders to the XML file, I am not able to read the images until the user has browsed to them using my app. I can get around it by making them browse to a higher level folder (even browsing to "/"), but it seems a bit crap to be telling the user "I can't access /path/to/file, can you please browse to it now, so I can open it?" Are there any better solutions

NSUserScriptTask: cancelling tasks?

拟墨画扇 提交于 2019-12-11 19:08:40
问题 Is there any way to cancel a running NSUserScriptTask? The only way that comes to mind is to launch a separate process (a command line tool) via NSTask, whose only purpose is to run the NSUserScriptTask, and then terminate the command line tool via NSTask when necessary. However, that seems a bit far-fetched and not very optimized... Any ideas? 来源: https://stackoverflow.com/questions/15599493/nsuserscripttask-cancelling-tasks

Sandbox entitlement to script iTunes via NSAppleScript

荒凉一梦 提交于 2019-12-11 12:03:30
问题 I'm trying to script iTunes from NSAppleScript in my Cocoa app in order to add a file to the library. In my entitlements file, I added the following: <key>com.apple.security.scripting-targets</key> <dict> <key>com.apple.itunes</key> <array> <string>com.apple.itunes.library.read-write</string> </array> </dict> I then call the AppleScript like this: var error: NSDictionary? = nil let appleScript = NSAppleScript(source: "tell application \"iTunes\" to add (POSIX file \"\(path)\") to library

Mac App Sandboxing- Updating files outside the sandbox

狂风中的少年 提交于 2019-12-11 12:02:08
问题 I have an Application for the Mac that I want to publish on in the app store. I order to get it published I need to put in a sandbox. The app access Sqlite files outside the sandbox which the user selects from a openpanel. The App works fine when is performs a select but it fails on inserts and updates. I can remember reading something about some function you could call that could give you write access to files outside the sandbox but for the life I can remember what is was Can anyone

NSUserScriptTask: accepted file types?

随声附和 提交于 2019-12-10 21:36:16
问题 I'm using NSUserScriptTask to run scripts the user placed in the Application Scripts directory. However, I'm finding it hard to find out which are the known types of scripts that NSUserScriptTask accepts and the docs don't help much either... Any ideas? So far I've tried these: .sh .applescript .scpt .scptd .txt And coudn't get any of them to work (the initWithURL:error: method returns nil) EDIT: I forgot to include the error! Silly me... Here's what gets printed on the log: Error Domain

swift + OS X sandboxing: treat 'NSVBOpenPanel' as a 'NSOpenPanel' :: because I need to get the sender in the delegate method

让人想犯罪 __ 提交于 2019-12-10 21:35:13
问题 Im using swift and I show a NSOpenPanel. In the delegate I need to look at the sender's prompt to distinguish which action to take: e.g. func show() { ... panel.delegate = self panel.prompt = "xy" panel.run .... } func show2() { ... panel.delegate = self panel.prompt = "abc" panel.run .... } //delegate func panel(sender: AnyObject, shouldEnableURL url: NSURL) -> Bool { let panelPrompt = (sender as! NSOpenPanel).prompt ... } without sandbox = WORKS fine the sender of the delegate is a

Mac OS Sandbox: Launching main application from helper

我是研究僧i 提交于 2019-12-10 14:38:13
问题 I have create in sandbox, an app which use a helper to start at login, as presented here. It works ok, but the next messages are logged in the console: lsboxd[1560]: Not allowing process 15208 to launch "/Applications/SandboxApp.app/Contents/Library/LoginItems/SandboxHelper.app" because it has not been launched previously by the user lsboxd[1560]: Not allowing process 15208 to register app "/Applications/SandboxApp.app/Contents/Library/LoginItems/SandboxHelper.app" for launch. I see that this

Alternatives for CGEventPostToPSN() for activating an other app's menu item in a sandboxed environment?

不羁岁月 提交于 2019-12-09 14:11:12
问题 I have this app where I need to activate an other app's menu item (like Print cmd+p) from within my app. Right now I'm using CGEventPostToPSN() to do the job and it works fine, but when I activate sandboxing, it stops working. CGEventPostToPSN(&psn, keyDownEvent); CFRelease(keyDownEvent); CGEventPostToPSN(&psn, keyUpEvent); CFRelease(keyUpEvent); My question now is what can I do when I need to enable sandboxing? I heard a lot about the Accessibility API but I was unable to find out how I can