cocoa

How can I get notified of a system time change in my Cocoa application?

谁说我不能喝 提交于 2020-02-14 03:11:13
问题 I have a Cocoa application that records datestamps on events. I need to know when the system time is reset and by how much, but I can't seem to fine a notification anywhere that tells me such a thing has happened. This change could happen because NTP reset the clock or because the user reset (e.g. from System Preferences). It would be great if there was just a NSNotification I could register to receive, but I'm open to any suggestions. 回答1: Apple added in NSSystemClockDidChangeNotification,

Why might releasing a managed object crash in -[_PFManagedObjectReferenceQueue _queueForDealloc:]?

南楼画角 提交于 2020-02-13 02:11:11
问题 I am occasionally seeing crashes with a stack trace like this: 0 libobjc.A.dylib 0x97dc0edb objc_msgSend + 27 1 com.apple.CoreData 0x97edcdc2 -[_PFManagedObjectReferenceQueue _queueForDealloc:] + 162 2 com.apple.CoreData 0x97edccbe -[NSManagedObject release] + 94 3 com.apple.CoreFoundation 0x9318ef38 CFRelease + 152 4 com.apple.CoreFoundation 0x931a7460 __CFBasicHashStandardCallback + 384 5 com.apple.CoreFoundation 0x931a706e __CFBasicHashDrain + 478 6 com.apple.CoreFoundation 0x9318f101

How to call an Objective-C method from Javascript in a Cocoa/WebKit app?

巧了我就是萌 提交于 2020-02-10 02:50:06
问题 I have a Cocoa app that uses a WebView to display an HTML interface. How would I go about calling an Objective-C method from a Javascript function within the HTML interface? 回答1: This is documented at developer.apple.com. 回答2: If you wanna do it in iPhone apps, you would need to do a trick with the UIWebViewDelegate method shouldStartLoadWithRequest: This api http://code.google.com/p/jsbridge-to-cocoa/ does it for you. It is very lightweight. 回答3: Being rather green, Apple's documentation is

Setting variables in a different class in Cocoa

痞子三分冷 提交于 2020-02-08 04:17:52
问题 I'm trying to learn how to set variables for different classes using one main data class. Here's a diagram of of what I would like to do and the code from my project: ClassA #import <Foundation/Foundation.h> @interface ClassA : NSObject { NSString *stringA; NSString *stringB; } @property (nonatomic, copy) NSString *stringA; @property (nonatomic, copy) NSString *stringB; @property (weak) IBOutlet NSTextField *textA; @property (weak) IBOutlet NSTextField *textB; - (IBAction)displayStrings:(id

Setting variables in a different class in Cocoa

一笑奈何 提交于 2020-02-08 04:17:47
问题 I'm trying to learn how to set variables for different classes using one main data class. Here's a diagram of of what I would like to do and the code from my project: ClassA #import <Foundation/Foundation.h> @interface ClassA : NSObject { NSString *stringA; NSString *stringB; } @property (nonatomic, copy) NSString *stringA; @property (nonatomic, copy) NSString *stringB; @property (weak) IBOutlet NSTextField *textA; @property (weak) IBOutlet NSTextField *textB; - (IBAction)displayStrings:(id

Checking File sizes for changes

心不动则不痛 提交于 2020-02-07 07:08:07
问题 I have an app that watches a folder for incoming jobs and then processes them. A job consists of a Folder with several job files inside the folder. Jobs are usually copied over the internet so when a folder is added to my Watched Folder I'm having my app get the attributes for the files inside the job folder, wait 20 seconds, and compare the current attributes for NSFileSize to see if there have been any changes. When everything matches, and no changes are detected it can pass the job folder

Checking File sizes for changes

空扰寡人 提交于 2020-02-07 07:08:05
问题 I have an app that watches a folder for incoming jobs and then processes them. A job consists of a Folder with several job files inside the folder. Jobs are usually copied over the internet so when a folder is added to my Watched Folder I'm having my app get the attributes for the files inside the job folder, wait 20 seconds, and compare the current attributes for NSFileSize to see if there have been any changes. When everything matches, and no changes are detected it can pass the job folder

Array is empty after calling method

自闭症网瘾萝莉.ら 提交于 2020-02-06 09:21:45
问题 everytime I call the method -(void)setArrayCheckOut:(int)num in another class the array arrayCheckout is empty. Calling -(IBAction)reloadTable:(id)sender after -(void)setArrayCheckOut:(int)num "results in reload table - (null), 0". Any idea what goes wrong? so long @implementation CheckOut -(id)init { [super init]; tableCheckOut = [[NSTableView alloc]init]; if (!arrayCheckOut) { arrayCheckOut = [[NSMutableArray alloc]init]; [arrayCheckOut addObject:@"-"]; } return self; } -(void

Writing Cocoa applications in Python 3

自作多情 提交于 2020-02-06 05:26:24
问题 It looks like PyObjC is not ported to Python 3 yet. Meanwhile is there a way to write Cocoa applications using Python 3? I am intending to start a new MacOSX GUI application project and though5 would want to use Python 3.x instead of Python 2.x. 回答1: For full-blown Cocoa, I think PyObjC is pretty much the only game in town. If you are coming to Cocoa from a Python background rather than to Python from an Obj-C Cocoa background, surely the learning curve of the Cocoa APIs is much steeper than

Is there some sort of Priority operator on RxSwift?

别等时光非礼了梦想. 提交于 2020-02-05 02:30:12
问题 I have a textfield that has 2 rules for validation: minimum amount of chars and alphanumerical chars. I want to be able to represent to the user what he's doing wrong in an error label but the problem is that if I bind the textfield to both rules it can be creepy because once one rule gets approved the ui does a little flickering from the color of the separator for example changing from red to green to red because of the other validation failing. I'd like to know if there's a way to