AMQP Cocoa Client

Or how to connect with Objective-C to a RabbitMQ broker…
More...

Tracking NSBrowser selection

Before 10.6, it was not easy to do, subclassing the browser cell was one way to do it, but since 10.6 it's easier, here is how to…
More...

CGFunctionCreate's callbacks and 64 bits compilation

Before you get bitten by this one, better to know how to correct most code examples found on the net...
More...

Is there any alternatives to Apple's crash reporter ?

Not being able to send the crash report directlty to the developer, no way to add specific information…
they are a number of limitation with Apple's solution…
Any other solutions ?
More...

How to prevent an application to become active when clicking in a window ?

How to prevent a click in a window of a background app to make that window and the application its belogns to, to become active ?
More...

Emulating modifiers keys ?

We handle an external UI input device and want some controls on this device to emulate standard modifiers keys of the keyboard, how to ?
More...

[NSURL path] returning nil ?

When percent escaping some accentued characters in string constants passed to the URLWithString method, the path method returns nil… what's happening here ?
More...

try/catch/throw/finally example?

Can someone provide an example of the use of @try, @catch, @throw, @finally, in Objective-C ?
More...

catch_exception_raise not called ?

catch_exception_raise is never called…
But when I use ligsigsegv as a library, it works !?
Any idea why ?

When implementing my own exception handling code in a Cocoa application using Mach-O low level calls to set my own excpetion handling thread, my
More...

NSBorderlessWindowMask and key events

When a window is created with NSBorderlessWindowMask, it doesn't receive key events anymore.
How to solve that ?
More...

How to retrieve currencies list and associated information ?

Is it possible and how, to to retrieve the currencies list available in the International Preference pane ?
More...

Why NSLog of [someObject class] may generate crashes ?

Why NSLog(@"%@",[someObject class]) may crash an application ?
More...

How to embed an image in application's source code ?

If you don't want the image to be accessible in the application bundle or if the image has to be in a command line tool (without bundle): how do you embed an image in the source code - kind of static NSData ?
More...

How to save a bitmap as a 8-bit gray scale PNG file with Cocoa ?

When creating a 8-bits gray scale off-screen image by manually drawing in it,
it always turn out to be a 24-bits one when saved to disk using:
- (NSData *)representationUsingType:(NSBitmapImageFileType)storageType properties:(NSDictionary *)properties.

Any clue ?
More...

Detecting frontmost application changes…

How to detect frontmost application changes ?
More...

Disabling screen saver

How to simulate user activity so that screen saver or energy saver doen't stop a length background task without user activity ?
More...

I would like to have colorised metal looking windows…

Is it possible to have windows with a colorized metal background on both Panther and Tiger ?
More...

How to change NSTableView column title programmatically ?

How to change the title of column and reflect the change without the need to reload the data ?
More...

How to get the Finder label color of a file ?

How to read that information from the file system ?
More...

NSTask and wildcard problem ?

Why launching a NSTask with parameters including some wildcards doesnt' work, while the same command in Terminal.app works perfectly ?
More...

Redirecting NSLog ?

How to redirect NSLog output to any of my file (or elsewhere) ?
More...

How to disable automatic sync to beam in Quartz ?

Quartz Debug resets the mode to "automatic" when it quits.
More...

How to handle com.apple.carbon.core.DirectoryNotification when there is no API to convert voldIDs into something useful ?

Distributed notifications describe file events with a path /.vols/volumeID/dirID/name but how to use the volumeID ?
More...

NSTextView and tab key navigation

How to make a NSTextView participates in the keyboard navigation as a normal text field for the tab key but not for the return key ?
Pressing tab should navigate as usual for a text field,
pressing option-tab should insert a tab character in the text,
pressing newline/return - without any modifiers consideration - should insert a newline character in the text,
More...

How to code a NSString with UTF-8 ?

The Xcode editor lets you define a file encoding as UTF8. You can then type in a line like:
NSString *foo = @"blah blah";
where blah blah have Unicode characters in them with encoded as UTF8.
But, when I ask this string for its characters I get garbage back, and length is not correct.
More...

Redirect NSLog()

Does anyone know how to redirect NSLog() output? So far, the output goes into XCode's run log window. I would like to redirect it to a text file…
More...

How to add my application to StartupItems from inside the application itself ?

I want to offer to the user the possibility to add my application to the StartupItems folder as an option in the installation procedure and later in the Preferences: how to do that in a save and portable way ?
More...

How to embed PostgreSQL in my application ?

We develop an application requiring a database and want to use PostgreSQL for technical reason, but we want to make the life of our users as easy as possible when installing our product. We would like to embed the PostgreSQL server in your application bundle, is that possible ?
More...

When adding a column to a NSTableView the alternate background color is not displayed in the added column ?

Is there any workaround ?
More...

How to refresh a progress indicator in a lengthy monolithic task ?

We need a visual feedback during a very long computing task but when we change value of a progress bar using setDoubleValue nothing happens until the computing task is done ?
More...

How to show invisible files and folders in NSOpenPanel list

Are there any way to show invisible files/folders in NSOpenPanel list?
More...

Converting file paths from absolute to relative and rev. ?

Is there any NSString methods to convert file paths to relative to absolute and absolute to relative ?
More...

What are the "Viewer" and "Editor" roles in Info.plist for?

In the Info.plist file, you can set up a CFBundleTypeRole for each document type, which can be either "Viewer" or "Editor". This entry describes how you can use these in Cocoa to allow importing/exporting various kinds of files, as well as implement template files ("stationeries") without having to write much code.
More...

Determining the OS version at runtime

I want to skip some specific calls if the OS is not a defined version. How to ?
More...

How to upload FILE via FTP ?

Is there a Cocoa API to upload file to a web site ?
More...

initWithFrame" of sub-class of a NSOpenGLView is not called ?

I have subclassed NSOpenGLView and placed my view in IB, but initWithFrame is not called, what is wrong ?
More...

How to handle interactivity with a command line tool from a Cocoa program ?

I am trying to communicate with a command line tool launched as a NSTask from my Cocoa application but I run into various difficulties to get the prompts and other outputs of the tool and to supply user input correctly.
Is there a solution ?
More...

How to tell if executing on the main thread ?

How can I tell if the currently executing code is on the main thread or a secondary thread?
More...

Is it necessary to create a new NSAutoreleasePool in detached threads ?

How to use correctly NSAutoreleasePool in NSThread ?
What is the best strategy ?
More...

How to colorize some user interface images...

I would like to change the Aqua tint of user interface elements such as buttons (without affecting the grays)...
More...

On multi-screen machine, how to know on which screen is the cursor and how to move a window to a specified screen ?

For a specific problem - little bit like the screen control panel - I need to know on which screen is the cursor and to be able to move a window to a specified screen...
More...

How to be alerted when user presses a modifier key ?

If the user presses only modifiers key (shift, alt, command, …) the keyDown/keyUp methods of the first responder are not called. What to do if I need to be notified of these events ?
More...

NSTableView and Java

I'm writing a Cocoa application in java that uses the JDBC to hook up to a postgresql database. I want to display results from database queries in an NSTableView, however I can't seem to find any NSTableView Java examples. Can somebody give me some tips!? Thanks in advance.
More...

NSConditionLock and the producer/consummer problem with multiples buffers, how to ?

Is there a beginner example how to use NSConditionLock in a producer/consummer situation with multiple buffers and showing how to handle speed differences between both thread ?
More...

How to draw text in a non-flipped view ?

To draw text in a NSView view of my own, the view has to return YES from its isFlipped method. But if I really need to draw text in a non-flipped view, how ?
(If you don't see what we refer to, open the Sketch example in your Developer folder and comment out the
isFlipped method of the SKGraphicView...).
More...

I need a small database for my cocoa project...

I need something light, if possible free (freeware, LGPL, BSD, ... licensing), fast and with trouble-free installation from my users point of view… any idea ?
More...

I got errors when passing strings I got from Cocoa to UNIX or BSD calls…

I got some file names from NSOpenPanel methods and I pass these to UNIX calls like open, but sometimes it fails, I don't understand why...
More...

How to make screenshot programmaticaly ?

How to make a screenshot from my own program code without using an external tool ?
More...

How can I accept directory drops to my app icon?

I would like to accept directories with arbitrary names dropped onto my application icon, in the Dock and elsewhere.
More...

How to turn off line wrap in NSTextView ?

Is there a way - API or other - to turn off line wrap in NSTextView ?
More...

How to know the size of a dash pattern in a NSBezierPath ?

When using - (void)getLineDash:(float *)pattern count:(int *)count phase:(float *)phase how do I know the size of the pattern buffer to pass since I don't know yet the value of count ?
More...

Problem using sheets (selector not recognized)

I'm trying to implement sheets into my app except every time the method is called to begin the sheet i get this warning in the console: 2004-01-07 01:57:08.026 PP[672] *** -[NSApplication beginSheet:modalForWindow:modalForDelegate:didEndSelector:contextInfo:]: selector not recognized 2004-01-07 01:57:08.030 PP[672] *** -[NSApplication beginSheet:modalForWindow:modalForDelegate:didEndSelector:contextInfo:]: selector not recognized
More...

How to change the image used for a drag in a NSTableView

I want to let users change ordering of items in a table view on a colum-by-column basis, but the image generated by the default drag operation represents the whole line. How to make it represents only the column's item being dragged ?
More...

How to capture stdout/stderr ?

We're trying to make a console in my application and would like to capture any data written to STD streams... how to ?
More...

How to handle dragging of subviews ?

I want the use to be able to drag subviews of my main drawing views, but I have problem to find out the right pattern of routines to overwrite, when the user drag the subview, the whole window is moving. What is the correct solution to this ?
More...

How to detect string encoding ?

Is it possible to auto-detect string encoding in a Cocoa program ?
More...

How to convert NSTextView into HTML ?

Is there a way ?
More...

I am using a socket library found on the net, but it sometimes crashes due to signal 13...

Why ? What is signal 13 ?

More...

How to call Java class from a jar I added to my project ?

I have a jar containing some usefull class I need to call from my Objective-C project...

More...

How to make an NSImage from a PixMapHandle ?

I have some Carbon code of my own returning PixMapHandle, I want to use it in my new Cocoa app…

More...

Does somebody know about a flood fill function for Cocoa ?

I need to implement an efficient flood fill for NSImage...
More...

How to change file permissions from Cocoa ?

Is there a Cocoa call to access and modify file permissions ?
More...

How to add line numbers in a NSTextView ?

I need to display line numbers in NSTextView of my own...
More...

I have a Cocoa appl with some Java code, when i try to debug it, it launches JavaBug instead of gdb...

What am I missing here, it was working as expected in PB...
More...

How to create NSMenuExtra

How to create NSMenuExtra - this cool-looking menus at the right.
More...

I want to write a command line tool to render HTML in PDF file...

using WebKit and dataWithPDFInsideRect but it doesn't work: the page is empty, what am I doing wrong ?
More...

Changing file types in NSOpenPanel while it's open

I'm wondering if it is possible to change the file types in an NSOpenPanel while the panel is open...
More...

How do I get an Objective-C application to terminate when the users presses the window's close button?

I want my application to quit when the user closes its unique window...
More...

How the obtain an NSImage with the content of a view ?

I need an NSImage filled with a NSView content at some point in my code…
More...

Can NSURL setup a POST method ?

If no, how to do this ?
More...

My Animated GIF is not (animated) ?

I want to display an animated GIF but only the first frame is displayed…
More...

How to get system version ?

How is it possible to get system version at runtime ?
More...

How to send actions across nibs ?

I have a document-based app and I want certain menu items (in MainMenu.nib) to send actions to the front document (and likewise be disabled when there is no document to send actions to)…
More...

How to get the names of Net applications ?

I need to access the names of applications defined by the user for Internet services in System Prefs…
More...

How to produce bar codes from a Cocoa App ?

I need to produce bar codes : do you know of any bar code library available for Cocoa ?
More...

Accessing NSView in Nib file inside a framework

I have a framework with a Nib file containing an NSView. How can I access the NSView from within the framework?
More...

I want to use some C++ classes in a Cocoa project but I get link errors...

I have added the C++ classes to the project and created an ObjC++ file (with extension .mm) to serve as interface, but it doesn't not link…
More...

Why NSTask doesn't work as Terminal.app ?

Regular arguments work just fine but when I have an argument with a parameter, I get errors…
More...

How do I create a "filter" search text field on a table view like iTunes has it?

iTunes has a "Search" text field into which you can enter some text to have the items in the NSTableView below it filtered "live", i.e. items that don't match the search term are removed from the list. It is very easy to implement this behavior in your application using a second array.
More...

How to change dynamically the format of a column in a table view ?

I want the formatter of a column view to change according to the column view size…
More...

Sample code for writing/updating multi-valued properties to the address book?

I can't find examples of code showing how to manipulate these AB properties…
More...

My Java tool doesn't work anymore when used with the Java bridge…

I have an utility that's working correctly when used from the command line, I have included it in my Cocoa application and I call it from the Java bridge but it hangs !
More...

How do I make PB stop when an exception is thrown?

Ever had to find out who is throwing the exception that causes your app to fail, and what it is? Here's how you can set a breakpoint that's triggered whenever an exception is thrown.
More...

When to call poseAsClass ?

I have written a NSWindow subclass: when to "poseAsClass" it ?
More...

My image is drawn upside down...

What are the good parameters to use to avoid this ?
More...

How to get the list of all running applications ?

I need a list of running apps from inside my code…
More...

How to make toolbar items with a on/off state ?

I need "old style" toolbar items that keep a "pressed" state…
More...

How to retrieve the full paths of the "Applications", "Home", "Pictures", etc, folders in Cocoa ?

Is there a way ?
More...

How do you convert from a NSFileHandle to a FILE* structure?

I have a NSFileHandle but I want to use fprintf routine that need a FILE*. How to ?
More...

How to make a genie effect when a window is created/closed ?

I have a toolbar where, when some buttons are clicked, a window is opened. I would like to do this with an animation like the genie effect of the Finder: is it possible ?
More...

How to save a NSColor in a NSDictionary ?

I have tried saving an NSColor using NSDictionary and a NSUserDefaults but none of them worked.
More...

Responding to mouse click to an NSImageView...

I'm trying to respond to the user clicking in different parts of an image: NSImageView only sends the action message to my target when I drag and drop an image in to it…
More...

POSIX path to HFS ?

I have a file path from NSOpenPanel, I would like to convert it to HFS format…
More...

How to localize a Cocoa project ?

I try to copy - at the Finder level - the original English.lproj to a new one, but it doesn't work: I got errors when launching the app… ?

More...

I need my NSTextFields be able to evaluate formulas...

It would be very nice for my customers to enter math formulas in text fields, how to achieve this in Cocoa ?
More...

I want to be able to access NSDictionary objects using a key path syntax...

How to access (set and get) dictionary objects using a key path syntax like @"a.b.c." ?
More...

How to draw unaliased lines in Cocoa ?

I need unaliased hairline paths…
More...

How to prevent the opening of an Untitled document at launch ?

Is it possible to avoid the automatic opening of a new document at application startup ?
More...

How to save a NSDictionary ?

dataRepresentationOfType and loadDataRepresentation which are taing NSData arguments ?
I want to use the plist format for my application's document: how to implement
More...

How to save a NSDictionary ?

dataRepresentationOfType and loadDataRepresentation which are taing NSData arguments ?
I want to use the plist format for my application's document: how to implement
More...

I got error messages "cannot connect to target of class"

I have a document-based application. In the document window I have connected buttons to actions in the window controller, but when starting the application the AppKit seems to try to connect my buttons to my document class instead of my window controller class, what's wrong ?
More...

I got error messages "cannot connect to target of class"

I have a document-based application. In the document window I have connected buttons to actions in the window controller, but when starting the application the AppKit seems to try to connect my buttons to my document class instead of my window controller class, what's wrong ?
More...

How to get more items in "Open Recent" menu ?

I have seen applications with more then 10 items in their "Open Recent" menu, how do they do that ?
More...

I got a "file not found error"...

My program worked fine when run from PB and now I get this error…
More...

How to change the style of a NSMenuItem ?

I don't any Cocoa's metod to change the style (bold, italic, etc.) of a menu item ?
More...

Proper retain/release etiquette

please, some advice about good retain/release strategy…
More...

How to access the RGB value of a pixel in a NSImage ?

i need to read the color of a pixel in a NSImage…
More...

How to put an URL in a NSTextView ?

I need an URL in a text view like an href in an HTML page…
More...

How to add my custom struct to a NSArray ?

I try to [myArray addObject:&myStruct] and it doesn't work…
More...

How to get the name of the current print operation ?

I need the name of the print operation as displayed in the print spooler…

PMGetJobNameCFString and PMSetJobNameCFString are the two API to get and set print job name. See Apple Documentation.
 
More...

How do I enable a menu item ?

I don't understant the Cocoa way to enable/disable menu items…
More...

My Cocoa app doesn't want to run on another computer...

I give my new app to test to a friend and it doesn't work on its Mac…
More...

How to save a NSTextView in a PDF file ?

I want the user of my be able to save a text view as a PDF on disk…
More...

How to change the document's window title ?

I want to change the title of my document's window to dynamically reflect settings…

See
Apple documentation regarding - (NSString *)windowTitleForDocumentDisplayName:(NSString *)displayName.
 
More...

NSSound doesn't work in a Unix tool...

I have a Cocoa Unix tool that needs to play sound but I hear nothing…
More...

How to produce good looking data report from my Cocoa app ?

I need to produce good report for my new accounting app, is there any available tool easy to integrate with Cocoa ?
More...

I want a popup menu in my table view's corner view...

How ?
More...

How to animate my dock icon ?

I want my app be able to dynamically change its dock's icon…
More...

How to copy a file from one location to another ?

What's the command to copy, move, delete, … files in Cocoa ?
More...

How to change the color of a button ?

I need an app like a Christmas tree, please help me…
More...

How to send a mail from an application ?

I need to send mail on the Net and on the local network…
More...

How to change text color of menu items ?

Is it possible to change the style and color of menu items from Cocoa ?
More...

How to insert an image in a text view ?

I need to display pictures in my text view…
More...

How to get the path to my executable ?

I need to access the system relatively to the current executable path: how ?
More...

How to make code running on different version of the OS ?

I want my app running on 10.1.x, 10.2.x, 10.3.x but there are new functions only available on some versions and not on earlier ones…
More...

What are good starter books for newbies ?

books and developer sites for newbies…
More...

How to add a perl/ruby/sh/... script to my application ?

I need to call an embedded script from my application…
More...

How to make lines of different color in my NSTableView ?

I want to make my NSTableView more user friendly by alternating or setting a specific background color for each line. How ?
More...

How to sort columns of my NSTableView ?

I want to sort some columns in my table view…
More...

I need a search field like the Apple Mail one...

If you need a text field with a small icon in it…

Look at this
Cocoa Widgets page.
More...

How to convert a number in a NSString ?

Various ways to convert a numerical value into a string using Cocoa classes…
More...

How to clip a string to a specific width ?

I need to know where (which character) a string will be clipped to a specific width…
More...

How to find an application by its OSType signature ?

NSWorkspace provides applicationForFile but this not what I a looking for…
More...

Is there a javadoc like tool for Objective-C?

I would like to generate documentation for my source files…
More...

I try to call a Unix tool from my app but don't get any output from it...

I call /usr/bin/grep from a NSTask but nothing comes out of it, even if it works from the command line…
More...

How do I add a separator item to an NSPopupButton?

[[aPopUpButton menu] addItem: [NSMenuItem separatorItem]];

That's all folks !
More...

I download a Web page with stringWithContentsOfURL but I get an older version of the page...

Why stringWithContentsOfURL does give me an old page ?

Because of Internet caches…
Use NSURLHandle class instead to download your page and call
flushCachedData in order to always get the latest updated version of the page.
More...

How to make private frameworks ?

I have some frameworks used by my app, but I don't want that the end-user install them in its Library/Framework folder…

To achieve this, you need to have access to the source and project files. Open the project in PB and set the install path to
@executable/../Frameworks, and build it.
In the project using the framework, add a Copy phase that will copy the framework into the Frameworks folder inside the application bundle.
More...

Problem declaring variables in the middle of methods

This feature stopped working. Is my PB environment corrupted ?
More...

Calling Java from Objective-C

Is it possible to call Java methods from my Cocoa application ?
More...

Warning: could not use precompiled header...

How can I fix these warnings ?

In a Terminal window enter:
sudo fixPrecomps -all
More...

How to make a Cocoa command line application ?

If you need a Cocoa application that acts mainly as a daemon but it some circumstances show up some GUI or need access to the AppKit framework…
More...

NSTimer doesn't fire in a Foundation tool

I want to use NSTimer in a Foundation tool but is doesn't work. What am I doing wrong ?
More...

Problem declaring variables in the middle of methods

This feature stopped working. is my PB environment corrupted ?
More...

I have problem with stringByTrimmingCharactersInSet...

stringByTrimmingCharactersInSet has a bug already reported in RADAR…
More...

Link error:illegal reference to symbol: _SSL_connect in indirectly referenced dynamic library /usr/lib/libssl.0.9.dylib

How to get around this ? What's the framework to include in my project ?
More...

I have problem with stringByTrimmingCharactersInSet...

stringByTrimmingCharactersInSet has a bug already reported in RADAR…
More...