cocoa

NSDatePicker in NSStatusBar NSSMenuItem not receiving input

家住魔仙堡 提交于 2021-02-08 13:11:38
问题 A while back I wrote a simple calendar menu bar widget called Day-O. The calendar uses the stock NSDatePicker nested inside an NSView inside an NSMenuItem in an NSMenu added to an NSStatusItem. The app has an activationPolicy of .accessory (originally set via the plist's "Application is agent" bool). At some point (maybe with the El Capitan update?) the calendar stopped responding to input. When the app first launches you can click the status bar item to expand the menu and interact with the

NSDatePicker in NSStatusBar NSSMenuItem not receiving input

余生长醉 提交于 2021-02-08 13:10:54
问题 A while back I wrote a simple calendar menu bar widget called Day-O. The calendar uses the stock NSDatePicker nested inside an NSView inside an NSMenuItem in an NSMenu added to an NSStatusItem. The app has an activationPolicy of .accessory (originally set via the plist's "Application is agent" bool). At some point (maybe with the El Capitan update?) the calendar stopped responding to input. When the app first launches you can click the status bar item to expand the menu and interact with the

NSDatePicker in NSStatusBar NSSMenuItem not receiving input

ⅰ亾dé卋堺 提交于 2021-02-08 13:09:01
问题 A while back I wrote a simple calendar menu bar widget called Day-O. The calendar uses the stock NSDatePicker nested inside an NSView inside an NSMenuItem in an NSMenu added to an NSStatusItem. The app has an activationPolicy of .accessory (originally set via the plist's "Application is agent" bool). At some point (maybe with the El Capitan update?) the calendar stopped responding to input. When the app first launches you can click the status bar item to expand the menu and interact with the

The file “xxx” couldn’t be opened because there is no such file [duplicate]

心已入冬 提交于 2021-02-08 13:04:24
问题 This question already has answers here : UIImage(contentsOfFile:) returning nil despite file existing in caches directory [duplicate] (1 answer) NSFileManager.defaultManager().fileExistsAtPath returns false instead of true (2 answers) Closed 3 years ago . I would like to open a .txt file and save the content as a String. I tried this: let path = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask)[0].appendingPathComponent("xxx.txt") var contentString = try String

The file “xxx” couldn’t be opened because there is no such file [duplicate]

狂风中的少年 提交于 2021-02-08 13:03:52
问题 This question already has answers here : UIImage(contentsOfFile:) returning nil despite file existing in caches directory [duplicate] (1 answer) NSFileManager.defaultManager().fileExistsAtPath returns false instead of true (2 answers) Closed 3 years ago . I would like to open a .txt file and save the content as a String. I tried this: let path = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask)[0].appendingPathComponent("xxx.txt") var contentString = try String

Swift Calendar class returning wrong date for weekday

夙愿已清 提交于 2021-02-08 10:40:58
问题 I have a question regarding the Calendar class in Swift 3: Basically, I wanted to get the Date of the next Sunday. However, the following code gives me the wrong output: let cal = Calendar.current //gregorian let today = Date(timeIntervalSinceNow: 0) let date_c = DateComponents(calendar: cal, weekday: 1) let today_weekday = cal.component(Calendar.Component.weekday, from: today) let next_sunday = cal.nextDate(after: today, matching: date_c, matchingPolicy: Calendar.MatchingPolicy.nextTime)!

Handling “Open Document” (odoc) events in Snow Leopard

China☆狼群 提交于 2021-02-08 07:58:53
问题 I have code in my application that response to "Open Document" (odoc) events. In Mac OS X Tiger and Leopard, this code works fine: - (void) handleOpenDocumentEvent: (NSAppleEventDescriptor*)event withReplyEvent:(NSAppleEventDescriptor*)replyEvent { NSAppleEventDescriptor const *const dirObj = [event descriptorForKeyword:keyDirectObject]; DescType const dirObjType = [dirObj descriptorType]; if ( dirObjType == 'alis' ) { // // Open a single file. // NSData const *const data = [dirObj data];

How to prevent circular reference when Swift bridging header imports a file that imports Hopscotch-Swift.h itself

自古美人都是妖i 提交于 2021-02-08 07:46:36
问题 I am integrating Swift into a large existing Objective C project and have run into what I think is a circular reference. The classes in question are as follows: Objective C Controller #import "Hopscotch-Swift.h" @interface MyController : UIViewController<MyProtocol> ... @end Swift Protocol @objc protocol MyProtocol: NSObjectProtocol { ... } Bridging Header #import "MyController.h" This code fails to compile because the Hopscotch-Swift.h file will not generate. I think this is due to a

ANY possible way to run the clang compiler from a Sandboxed app?

邮差的信 提交于 2021-02-08 06:31:24
问题 OK, the question is fairly straightforward. I have a sandboxed OSX app. I want the user to be able to compile some C code (whatever he inputs). But whenever I'm attempting a call to: /usr/bin/env clang /the/path/to/the/source.c I'm getting the following error in the logs: xcrun: error: cannot be used within an App Sandbox. Is there any way to circumvent this? P.S. I've successfully done pretty much the same thing with Ruby, Python and PHP. 回答1: If you want to keep your app sandboxed you could

Writing files to an iOS device from a MacOS app

情到浓时终转凉″ 提交于 2021-02-08 05:49:35
问题 I'd like to be able to transfer files from a MacOS app to a connected iOS devices, so a related iOS app can open them - effectively replicating iTunes music functionality, but not for musc. Is this possible? I know you can set an iOS app to have file sharing enables so you can drop files into it with iTunes, but I'd prefer to do it in my own app. 回答1: This library came up in another question on SO recently: https://bitbucket.org/tristero/mobiledeviceaccess/ - I don't know anything about it