How to using ScriptingBridge in the entitlements - objective-c

I wanna control 'Finder' in my app, so I can minimize Finder. I tried ScriptingBridge, but it doesn't work in Sanboxed. But it works when the app is not sandboxed. So I check the Apple's developer documents, seems that I have to set com.apple.security.scripting-targets in entitlements when I need to use ScriptingBridge in sandbox. But it doesn't say anything about the setting, so what should I do in the setting in order to control finder? Thanks in advance.
here is entitlements :
com.apple.security.scripting-targets
???????
????

Finder does not have any scripting access groups. You could add the temporary exception com.apple.security.temporary-exception.apple-events as documented here.
To find scripting targets see here: How can I know the Apple Event Access Groups used by an application?
If you'd like to distribute your app in App Store, however, you're out of luck. By scripting Finder, your app will not pass the review into the App Store.

Finder does not have any scripting access groups on purpose, because it lets you dodge sandbox file system restrictions. (As the other answer mentions, you could use the old temporary-exception.apple-events entitlement to script Finder anyway, but it won't pass store review.) Try using NSWorkspace instead, in particular the -openFile, -launchApplication, and -selectFile methods. If by "minimize" you really meant "hide", then see -[NSRunningApplication hide].

Related

How do I find a certain application on the user's PC and transfer data to it? (VB)

I'm developing an app on the Windows desktop so Win7 users have the app, but for Win8 users I'm also developing a Metro app.
My problems are,
if a user opens a file (e.g. "Blue.xyz"), I want an app to come up that asks which environment to open it in, but first it has to find all the apps that can open the file and display them.
Then I need to pass the data as a parameter to the app Chosen.
In the .NET framework 4.5.1, I can't find the System.GetEnvironmentVariable command so I can create a common location for both environments to access. These are my options:
Comment for clarification.
Regarding your 3rd question, the function is there, just now showing on MSDN page:
After having an inspiration, I found some code that can get pretty close to what I want.
Dim filepicker As New Windows.Storage.Pickers.FileOpenPicker
CommonFolder = Windows.Storage.Pickers.PickerLocationId.DocumentsLibrary
I should just be able to tack this on the end after that:
CommonFolder.Replace("\Documents","")
and it should give me "C:\Users\someuser" and then I can add "\MyAppStorage"
Thanks for all the help though! This code isn't very clean, so feel free to edit and make it better!

Are there any update frameworks for iOS apps?

I need to be able to update my app from within the app itself. I know Sparkle works for Mac Apps but I can't seem to find any for iOS.
Edit: I am not asking how to bypass the review process. I was thinking that there might be frameworks similar to Clutch.io that allow updates to images/documents/etc from within the app. Or things like UrbanAirship that manage in app purchase data that allows an app to be extended from the app itself.
You can't replace your app with an updated one (except through the App Store) and you can't replace parts of your app with updated parts (that would make your app's code signature invalid); you can only update stuff that's outside of your app's bundle.
You can't update the app binary yourself, the system is responsible for updating all apps.
Though, if you just want to update some data in your app you can do that for sure.
Here is what I was looking for:
http://code.google.com/p/cooliris-toolkit/
It has a class called RemoteUpdater which allows me to download zip files of images/data or whatever I like to extend my content.
Depends on your needs. If you dont want to see the app you can also do an Enterprise Deploy.
Used by corporations to distribute apps to their clients or employees.
Needs a separate Apple account which costs more.
Uses same process as deploy to appstore
Archive > Distribute > create ipa/plist > copy these to webserver with html page with link to plist and user clicks on link from Safari on iOS Device and it installs.
Going back to CArpp Store review process after that is painful.

How to check if your iOS app code is using an api that is not allowed on the app store?

I know that there are some restricted api's or code that are not allowed to be in your app when you submit it to the app store.
How do you know what they are? Is there a way to check your app before you submit it to ensure you have not used such api's?
It is probably better to avoid this problem at the design stage, than trying to fix it later, so I was wondering if there is any tool in Xcode, or document to determine this.
The way Apple intends for you to do this is to use XCode's Validation feature. When you're submitting an app, you build for achiving (or Archive from the XCode menu). Then, you open up Organizer to see the archive you just created. At this point, you can press the Validate button in Organizer. That will perform a validation, without actually submitting the app. It will tell you if you're using Private APIs. Depending on how you use them, it might identify what the violation is:
There's definitely ways that code can fool this validation step, and "get away" with using Private APIs until the reviewer looks at the bundle. But, as far as I know, those ways would all be intentional methods of hiding Private API usage, and it sounds like you're trying to discover accidental usage.
If you fail this Validation test, then you might want to use something like AppScanner, mentioned in alan duncan's answer. But, for completeness, I wanted to make sure people knew that this Validation step is available in XCode, and checking for Private API usage is one of the things it's doing before you submit (and have to wait a few days to be told what you did wrong). Also, even if you don't use the Validate button in Organizer, but just use Submit, the tool is performing a Validation for you. The only difference is whether the bundle actually gets uploaded to iTunes Connect.
If you stick to documented interfaces as suggested above, you're fine. The only issue is with third-party libraries whose implementation may be opaque to you.
There is a Mac app called AppScanner that scans from private API usage. I have no experience with it, though.
You will get more information on Apple approval process from
App Store Review Guidelines for iOS apps (You must be a registered iOS developer for accessing this data).
iOS Human Interface Guidlines.
get the private API list.
use class-dump to process the Mach-O file, and get the processed string.
use regex to get the interface, class, or method in the string.
match the API to private API list.
then GOT it~
I opened a porject to do this, but because the reason of my company, canceled. very sorry for this.

Get droplet path without making app document based

I have a fairly straightforward question about using droplets for my mac application. My app is not a document based app.
Is there any way to get the path of the item that was dropped? How would I go about implementing this if that was the case? I have looked into this, and it doesn't look like I can do droplets at all without making my app document based, which I really don't want to do.
Thanks ahead of time!
You don't have to use NSDocument at all to make a droplet. Just include CFBundleDocumentTypes in your Info.plist (see Storing Document Types Information in the Application's Property List for details) and implement application:openFile: in your app delegate (there are variants of this method for multiple files etc.).

Gain root acces in iOS and launch Daemon

I am an iPhone Developer, now I am making an App that need to run commands (like "launchctl")
The only way I can launcht is with root privileges, but i dont know how to get root privileges.
I want to call it with System("launchctl....") or there is other way?
Thanks in advance ;)
You cannot get root privileges if your going to distribute this in the App Store. However, you can get root access if you're developing this for jailbroken devices.
I built a jailbreak app once that was trying to do something similar. I wasn't using launchctl, but I was issuing a call using system().
What I found was that even if I let my app run as user root, which requires more than what edc1591 outlined in his comment above, system calls would still run whatever command you passed it (e.g. launchctl) with user mobile privileges. (Aside: I think the reason might be related to this issue).
If you want to do that, I found a rather convoluted way of doing so. See that answer here.
First of all, using system(); is a C method and is not very reliable at all for executing commands like that, (I know from experience).
What you would want to do, is copy the NSTask.h file from the foundation.framework into your project window and use it. the way to find it is by opening a new project for the mac and clicking show in finder on the foundation.framework and then copy it. (Make sure to remove the lines near the top that check if you have Mac OS 10.6 or greater)
Then try running it. If it still doesn't have the right privileges, try looking into setuid(); but other than that, i don't know how it's done.
Maybe you can contact the developer of iFile, he would know how...
Unfortunately, there is no Apple sanctioned way to do this. In other words, apps that require root access will not be approved for use in the App Store. It is possible that Apple will grant an exception, but that's is seriously, extremely, unlikely.