Tag: cocoa

Objective-C partial implementation of classes in separate files

I am using core data and am generating classes from my data model. I implement custom methods in these classes, however when i regenerate i generate over the top so i end up copying and pasting a bit. What i would like to do is split my implementation files (‘.m’) so i can have one […]

Using custom subclass of NSURLConnection, how does it “find” the additional data in the class later?

This blog offers a nice solution for handling multiple NSURLConnections: make a custom “CustomURLConnection” class that has an additional tag property. http://blog.emmerinc.be/index.php/2009/03/02/custom-nsurlconnection-class-with-tag/ http://blog.emmerinc.be/index.php/2009/03/15/multiple-async-nsurlconnections-example/ Basically, he has simply added a tag property to the exsisting NSURLConnection: CustomURLConnection.m – (id)initWithRequest:(NSURLRequest *)request delegate:(id)delegate startImmediately:(BOOL)startImmediately tag:(NSString*)tag { self = [super initWithRequest:request delegate:delegate startImmediately:startImmediately]; if (self) { self.tag = tag; […]

How do I use SPACE instead of TAB in NSTextView

I just know how to modify the tab width in NSTextView NSMutableParagraphStyle *paragraphStyle = [[self defaultParagraphStyle] mutableCopy]; [paragraphStyle setTabStops:[NSArray array]]; [paragraphStyle setDefaultTabInterval: tabWidth]; But, is there any way to use 4 SPACES instead of TAB in NSTextView?

Objective-C Plugin Architecture Security (Mac, not iPhone)

I’m possibly writing a plugin system for a Cocoa application (Mac, not iPhone). A common approach is the make each plugin a bundle, then inject the bundle into the main application. I’m concerned with the security implications of doing this, as the bundle will have complete access to the Objective-C runtime. I am especially concerned […]

Separating NSString into NSArray, but allowing quotes to group words

I have a search string, where people can use quotes to group phrases together, and mix this with individual keywords. For example, a string like this: “Something amazing” rooster I’d like to separate that into an NSArray, so that it would have Something amazing (without quotes) as one element, and rooster as the other. Neither […]

Using NSTask and NSPipe causes 100% CPU usage

I’m trying to run a simple bash script using NSTask and direct the output to a text view. Once the task is executed, the CPU usage of my app is 100%, even though it’s a simple echo (for now). I created a completely fresh project to isolate the issue: @interface AppDelegate () @property (nonatomic) NSTask […]

Can not restart an interrupted audio input queue in background mode on iOS

I’m writing an iOS App using an AudioQueue for recording. I create an input queue configured to get linear PCM, stated this queue and everything works as expected. To manage interruptions, I implemented the delegate methods of AVAudioSession to catch the begin and the end of an interruption. The method endInterruption looks like the following: […]

Set date modified of files in Cocoa

How can I set the date modified attribute of a file in Cocoa? Thanks

Accessing NSArray's items with subscript

Is it possible to access NSArray’s objects using [idx]? I have a standard library that uses [] style indexing and I don’t want to rewrite the whole library to suit ObjC’s objectAtIndex: method. As in, NSArray *obj = [NSArray …]; id item = obj[0];

Cocoa/Cocoa.h Not Found (Error)

I have done alot of research on this and only find people complaining about this error when there building a cocoa app on the iPhone. I recently Grabbed the source for Colloquy for Mac and did everything it asked and (‘Cocoa/Cocoa.h’ File not found) Here is the chunk of code that #import’s everything. #define ENABLE(FEATURE) […]