cocoa

Trash files inside user-selected folder inside iCloud Drive

混江龙づ霸主 提交于 2020-12-09 04:24:11
问题 My app works with user txt-files (create, change, delete) inside any user-selected folder. I just internally store the bookmark to get access to that user-selected folder and files. Now, with macOS Catalina when the source folder is inside iCloud Drive, system still allows me to create and edit files. But doesn't allow to trash one. When I try to do it via [[NSFileManager defaultManager] trashItemAtURL: ... ] I get the following error: Error Domain=NSCocoaErrorDomain Code=3328 "<filename>

Trash files inside user-selected folder inside iCloud Drive

坚强是说给别人听的谎言 提交于 2020-12-09 04:23:57
问题 My app works with user txt-files (create, change, delete) inside any user-selected folder. I just internally store the bookmark to get access to that user-selected folder and files. Now, with macOS Catalina when the source folder is inside iCloud Drive, system still allows me to create and edit files. But doesn't allow to trash one. When I try to do it via [[NSFileManager defaultManager] trashItemAtURL: ... ] I get the following error: Error Domain=NSCocoaErrorDomain Code=3328 "<filename>

validateMenuItem or menuWillOpen not called for NSMenu

早过忘川 提交于 2020-12-06 07:27:47
问题 My Mac app has an NSMenu whose delegate functions validateMenuItem and menuWillOpen are never called. So far none of the solutions online have helped. It seems like I'm doing everything right: The menu item's selectors are in the same class. The class managing it inherits from NSMenuDelegate I suppose the best way to describe my problem is to post the relevant code. Any help would be appreciated. import Cocoa class UIManager: NSObject, NSMenuDelegate { var statusBarItem = NSStatusBar.system()

NSToolbar created programmatically starts empty and won't save

∥☆過路亽.° 提交于 2020-12-06 04:45:29
问题 I'm currently trying to write a Mac application. In doing so, I'm having some peculiar problems when trying to setup an NSToolbar. Although I have setup all the components as per the API documentation, when the application loads, the toolbar always starts empty. When I open the customisation pane, the toolbar items are there, and I can drag them into the toolbar, but when I quit the application and restart the changes are gone. Note: I am aware that many of you will be of the opinion that the

Prompt for root access in cocoa application

偶尔善良 提交于 2020-12-03 18:09:24
问题 I want my program to begin with a prompt/alert that asks for root access. The user must enter their password, and then the application follows. I've been looking around, but I'm not exactly sure how to do this. You help is greatly appreciated. Thanks! 回答1: This is Apple's documentation on the matter, and here is a good example of it. 回答2: Use BLAuthentication. Its much easier to launch authorization as root and you can enter bash commands to run as root. http://jim.roepcke.com/blog/archives

Prompt for root access in cocoa application

笑着哭i 提交于 2020-12-03 18:08:29
问题 I want my program to begin with a prompt/alert that asks for root access. The user must enter their password, and then the application follows. I've been looking around, but I'm not exactly sure how to do this. You help is greatly appreciated. Thanks! 回答1: This is Apple's documentation on the matter, and here is a good example of it. 回答2: Use BLAuthentication. Its much easier to launch authorization as root and you can enter bash commands to run as root. http://jim.roepcke.com/blog/archives

macOS 开发

天涯浪子 提交于 2020-12-02 07:05:50
文章目录 一、引言 二、招聘信息 三、相关书籍推荐 1、《macOS应用开发基础教程》 2、《Cocoa入门:使用Objective-C》 3、非虫:《macOS软件安全与逆向分析》 4、官方开发文档 5、深入解析Mac OS X & iOS操作系统 6、OS X与iOS内核编程 7、Mac OS X For Unix Geeks 8、OS X系统管理和部署 四、视频教程 五、实用Demo 六、优秀MacOS 开发博客 七、一些不错的Mac论坛 Mac 使用&软件下载 八、一些好用的工具 png 转 icns icons 生成 九、我的开发笔记(CSDN 博客目录) 1、基础UI控件 2、Dock、Window、状态栏、目录栏 3、文件管理等 4、视图效果 5、综合 6、网络&数据库 7、证书&打包 8、命令行 9、Mac 小技巧 10、Mac 系统知识 十、QQ群 一、引言 用了三年Mac,非常迷恋这个系统。想尝试写些自己的OS X App , 无奈资质较浅,网上资料并不多。 尝试搜索 MacOS 开发相关qq群、贴吧,发现常常只有一两个人。 因此在这里记录下搜集到的一些文章和资料,方便后来的感兴趣的人快捷学习。 下面资料主要针对已有 OC 基础的开发者,没有 OC 基础的,建议学习基础语法和控件后开始阅读下述材料。 二、招聘信息 这里是 macOS 程序员的招聘信息 https

NSStatusItem Button Title to the Right of the Image

試著忘記壹切 提交于 2020-11-29 08:34:11
问题 I want an NSStatusItem ’s button’s title to appear to the right of its image. Here’s an example, this is the OS X VPN menubar app: If I set either the title or image for my NSStatusItem ’s button, they render correctly. However if I set both , they get superimposed and are horizontally center-aligned. Is there a way to achieve the side-by-side placement without creating a custom UIView ? 回答1: This has to do with a change in Yosemite, which deprecated setTitle: and setImage: on NSStatusItem .

Creating window application in pure c on mac osx

不想你离开。 提交于 2020-11-25 07:59:33
问题 I'm creating an application in pure C on Mac OSX. What I want is to create window in witch my app will be stored. Preferably I want it to be pure C solution, but if I have to use objective-c class to init window and then send context to my C code then it will be fine. I'm not using xcode, only simple text editor in with I tried to import cocoa but it just generated a lot of errors. So in summary my question is: How in simple pure C generate code that will display osx window? 回答1: You can use

Creating window application in pure c on mac osx

给你一囗甜甜゛ 提交于 2020-11-25 07:57:26
问题 I'm creating an application in pure C on Mac OSX. What I want is to create window in witch my app will be stored. Preferably I want it to be pure C solution, but if I have to use objective-c class to init window and then send context to my C code then it will be fine. I'm not using xcode, only simple text editor in with I tried to import cocoa but it just generated a lot of errors. So in summary my question is: How in simple pure C generate code that will display osx window? 回答1: You can use