简体   繁体   中英

cocoa: Is there any way to do paste action in another app in sandbox

out app was rejected because we use System Events to call cmd+v in another app. I know that I can't do CGEventPostToPSN inside sandbox, too. Is there any way to do paste action (or call cmd+v in another app) and send app to mac app store? Have anyone faced this problem?

Apple will definitely reject the app which is trying to paste some data into another application textfields. But there may be some ways to accomplish your task:

  1. The application, you're trying to communicate with is application you're developing too. In this case you should use some kind of distributed notifications (it's like simple NSNotificationCenter, but for several applications communicating to). There're another technics, please look at this wonderful article from Mattt Thompson.
  2. The second application is a random one. In this case you may use NSSharingService or NSSharingServicePicker . This is some equivalent of UIActivityViewController from the cocoa-touch if you familiar. It will work if only the another application is set to work the service.

Good luck.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM