cocoa

%d doesn't show integer properly

As I try to write NSLog(@"%d", myObject.myId); where myId is int, console gives some hight number like 70614496. And when I use @"%@", I get exception -[CFNumber respondsToSelector:]: message sent to deallocated instance 0x466c910. Why is it so? Here's definition of myObject: @interface myObject : NSObject { int myId; NSString *titl...

Getting Strange video warning from my IKPictureTaker App

I have a simple little osx app that just starts up an IKPictureTaker and then saves the resulting picture as a .tiff file. It all seems to work fine but everytime I take the picture I get this error repeatedly: 2009-11-10 12:25:38.890 Take A Picture[855:9c23] *** QTCaptureSession warning: Session received the following error while de...

Qutting a cocoa app after closing a window

I have a small osx cocoa app that brings up an IKPictureTaker at start up, I would like for my application to quit after this picture taker is closed. I read that I need to add this code to my NSWindowController class but I have no idea how to access this class (it shows up no where in my class list in XCode):` -(BOOL) applicationShoul...

Forcing a Cocoa app called from java to take focus

I have an OSX cocoa app that is called from my java like so: String cmd = "/Users/mike/ASJPictureTaker.app/Contents/MacOS/ASJPictureTaker"; Runtime run = Runtime.getRuntime(); Process pr; pr = run.exec(cmd); pr.waitFor(); The ASJPictureTaker app loads and works fine but when the exec is called it does not take focu...

Getting a CGIImageRef from an NSImage in Cocoa on Mac OS X

I need to get a CGIImageRef from an NSImage. Is there an easy way to do this in Cocoa for Mac OS X? ...

Client-to-client messaging in cocoa?

Hi, erm, now I trying to do a messaging between both client instead of client to server. So if I'm not wrong we can't startup service individually but how to see whether is setting up individually or both connect to same service? My Code for startup the service: -(void)startService { // Start listening socket NSError *error; ...

NSComboBox - Obtaining selected information and NSComboBoxDataSource

For the life of me, I am being continually stumped with NSComboBox. I created an object that conforms the NSComboBoxDataSource protocol, and implemented: - (NSInteger)numberOfItemsInComboBox:(NSComboBox *)aComboBox; - (id)comboBox:(NSComboBox *)aComboBox objectValueForItemAtIndex:(NSInteger)index; I set the instance of my NSComboBox...

Cocoa Core Data newbie how-tos

Hi everyone, I am one of the great unwashed masses of .NET developers keen to try their hands at Mac OS X development. At the moment I am trying to figure out the various elements of Cocoa and getting a bit stuck on Core Data. I noticed most of the documentation and resources available on the Web involve a broad end-to-end tutorial, be...

Howto draw a rect on screen. NSOpenGLContext vs transparent NSWindow + custom NSView

I'm reading pixels from an area of the main screen via NSOpenGLContext. Now I would like to draw a rect around that area to indicate where it actually is. How would I do this? My first thought was the "Cocoa way": create a transparent fullscreen NSWindow and a custom NSView to draw the rectangle path. But that feels a bit too complicated...

Deleting comments from a string using NSScanner?

Hi, I've a string that may or may not include C++ comments on it (multi-lin and single line) and I need to strip those comments out before being able to use that string. My current idea is to use an NSScanner to do that - find the position of opening and closing multi-line comments and delete that portion of the string and find the posi...

decodeHexString obj-c implementation, Should I support odd lengthed hexstrings, and if so, how?

I may be missing something in the standard libs, but I don't think so. I have this current implementation: int char2hex(unsigned char c) { switch (c) { case '0' ... '9': return c - '0'; case 'a' ... 'f': return c - 'a' + 10; case 'A' ... 'F': return c - 'A' + 10; default: WARNING(@"pa...

Adding an edittable field in an NSBrowser?

I have an NSBrowser with data being properly inserted. I would like to append each row to enable the user to easily add another row into that data set. Any ideas on how to accomplish this? ...

Sending NSMutableArray on AsycSocket

Any one knows how to write and read NSMutableArray or Dictionary data using AsycSocket Library ? Clarification: I want a way to archive NSMuatbleArray and write this on the stream. seemed pretty forward but running in simulator I get this wierd error [NSKeyedUnarchiver initForReadingWithData:]: incomprehensible archive ...

Property & Private & extended class combination confusion of interface

I have downloaded a sample code of AA-Plot Chart. One of the .h files: @interface MainViewController : UIViewController <APYahooDataPullerDelegate, CPPlotDataSource> { CPLayerHostingView *layerHost; @private APYahooDataPuller *datapuller; CPXYGraph *graph; } @property (nonatomic, retain) IBOutlet CPLayerHostingView *la...

What are your most useful Xcode templates?

Xcode comes with a few templates (file templates, project template, etc.). If you don't know what I'm talking about, take a look. After searching on Google for some time I couldn't find any other useful templates. So here it is: What are your most useful Xcode templates? I'll start with a pretty boring Objcetive-C category file temple....

Is there a way to use the OSX cocoa NSApplication method activateIgnoringOtherApps: to activate an app that is already loading

This may be a dumb question but it seems like activateIgnoringOtherApps: may be the only way to activate an app using Cocoa. I have a java app that loads up a Cocoa app and I want the Cocoa app to be activated when this happens. The problem is I do not want to have to launch an intermediate app (some sort of controller) and use this ap...

NSXMLParser chokes on ampersand &

I'm parsing some HTML with NSXMLParser and it hits a parser error anytime it encounters an ampersand. I could filter out ampersands before I parse it, but I'd rather parse everything that's there. It's giving me error 68, NSXMLParserNAMERequiredError: Name is required. My best guess is that it's a character set issue. I'm a little fuz...

Cocoa shell command permission

Hi I'm developing my first Mac App have some issues with shell commands... I'm trying to find out how to get the permission windows that the user can enter his password. I want to copy a picture in a system folder, and change the name of another picture too. I try to change the Login window background. Command 1: "sudo mv DefaultDes...

applicationShouldTerminateAfterLastWindowClosed: does not seem to work when the red x is used to close my Cocoa app

I have a small OSX Cocoa app that just bring up an IKPicutreTaker and saves the picture to a file if one is set. I use applicationShouldTerminateAfterLastWindowClosed: to close the application when the pictureTaker is closed. This all works fine when I either set(this is done when you have picked the picture you want) or when you hit c...

Cocoa Pop-up Window Similar to iCal

I want to open an overlay window (pop up window) when a user selects a cell in my NSTableView similar to selecting an event in iCal. Selecting the event in iCal shows a Window to edit the event, but does so by smoothly animating the window open and adding an arrow pointing to the even in the underlying calendar. Does anyone know what is ...