cocoa

Cocoa tutorial suggestions

I am learning Cocoa programming for Mac apps. Where can I find a good video tutorial or class online? ...

XCode Error, unable to see a difference

Alright, I'm reading the Aaron Hillegass book for Cocoa Programming, on the drag and drop chapter. I was following along with one of the lessons, and I typically change variable names as I find it keeps me a little more engaged and gives me a better understanding. I started getting this error, though: 2010-10-04 00:38:06.699 TypingTutor...

NSURLConnection: gzip encoded SOAP response gets corrupted

I'm having trouble writing a IPhone/IOS Obj-C SOAP client that talks to an application with a SOAP WS interface. The application uses a NuSOAP php webserver and encodes any payload above a certain size using gzip/deflate, whichever is enabled by the client. I understand that NSURLConnection transparently decompresses any gzip encoded re...

Create a Custom View with transparent background for a NSStatusItem

Good Morning, I've created a Status Bar Application for Mac: when I click on the icon in menu bar, a NSCustomView appears with some elements. My NSCustomView is too simple, so I want to create something like this: (Snippet.app) http://i.imgur.com/aweP7.png I've searched in Apple Documentation, but I didn't find nothing usefull. Maybe...

PicHandle to CGImageRef

This project is a generic C++ plugin with core-graphics support. I am unable to convert a PicHandle to CGImageRef successfully. Saving off image from CFDataRef results in a bad image. if(pic) { Handle thePictureFileHandle; thePictureFileHandle = NewHandleClear(512); HandAndHand((Handle)pic,thePictureFileHandle); d...

BAD_ACCESS on very low number of users during getaddrinfo

Okay, I am completely at a loss here. A small percentage of users seem to have BAD_ACCESS errors in my hostname translation. The complete crash below: Exception Type: EXC_BAD_ACCESS (SIGSEGV) Exception Codes: 0x000000000000000d, 0x0000000000000000 Crashed Thread: 21 Thread 21 Crashed: 0 libSystem.B.dylib 0x00007fff84...

NSNotification to detect other program's crashes

I was planning on writing a small daemon that detected whether another app crashed, thinking all the while that the system would send an NSWorkspaceDidTerminateApplicationNotification, but this is not the case. Assuming that I do not want to create a launchd process to simply re-launch the crashed application, can I detect the crash an...

NSBundle pathForResource failing in shell tool

I've noticed some weird behavior with NSBundle when using it in a command-line program. If, in my program, I take an existing bundle and make a copy of it and then try to use pathForResource to look up something in the Resources folder, nil is always returned unless the bundle I'm looking up existed before my program started. I creat...

How do I automatically activate an item in the OS X Services Menu

I need to have a service I created enabled by default in the services menu. I've created a service for my OS X app (running on Snow Leopard). I've configured the Info.plist like so: <key>NSServices</key> <array> <dict> <key>NSSendTypes</key> <array> <string>NSStringPboardType</string> </array> ...

WebKit Crashes trying to play _any_ flash content.

Hi, I have a curious problem with WebKit and WebView. All my other URLs seem to work fine, but when I try to load a site with a lot of flash content, the whole app crashes. The app again functions fine if I customize webview to prevent plugins from running. What's more curious is my dev machine seems to be the exception with all the co...

Display System Keyboard Mac application?

Hi, I need to display the system keyboard if any text entry fields are selected with in my app. I can't seem to find any resources on how to do this. Any tips? Edit: I'm asking this question because I'm making a full screen application and need to show/hide based on user selection. Thanks, Teja ...

How to pass userInfo in NSNotification?

Hi, I am trying to send some data using NSNotification but get stuck. Here is my code: // Posting Notification NSDictionary *orientationData; if(iFromInterfaceOrientation == UIInterfaceOrientationLandscapeRight) { orientationData = [NSDictionary dictionaryWithObject:@"Right" forKey:@...

Re-encoding a NSString returns null

So I have this piece of code : if ([receivedPage hasPrefix:[NSString stringWithUTF8String:"\xC3\xAF\xC2\xBB\xC2\xBF"]]) // UTF-8 BOM 'EF BB BF' as UTF-16 chars { //DebugLog(@"converting calls list to UTF8"); receivedPage = [[[NSString alloc] initWithData:[receivedPage dataUsingEncoding:NSISOLatin1StringEncoding] enco...

Unable to play a .mp3 file directly using QTMovie

Hi all, I am trying to play a .mp3 file on click of a button using this code: NSString *audioFilePath=[[audioInputTextField stringValue] stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]; NSURL *audioUrl = [[NSURL alloc] initWithString:audioFilePath]; QTMovie* soundToPlay = [[QTMovie alloc] initWithURL:audioUrl error:nil]...

Walking the responder chain to pass custom events. Is this wrong?

According to the iOS documentation, the responder chain is used to pass touch events "up the chain". It's also used for actions generated by controls. Fine. What I really would like to do is send a custom event "up the chain". The first responder to pick up on the event will handle it. This seems like a pretty common pattern, but I can'...

Hide Core Data sqlite file when iTunes File Sharing is Enabled

Hello, I am using iTunes file sharing in my app, and need to put Core Data's sqlite database elsewhere so that users don't fiddle with it. I have read a previous SO post regarding the best way to hide the sqlite file that Core Data uses. There seems to be conflicting opinions regarding whether to put the database in Library/Preferen...

NSFileManager contentsEqualAtPath:andPath: compare checksum data

Does the NSFileManager method contentsEqualAtPath:andPath: create a dynamic checksum to compare two files, does it open the file header and compare file header details or does it use some other method for comparing? I have a list of 200,000 or so files to compare where the local files are to be compared with the files on a remote server...

How to keep an array sorted

I'm refactoring a project that involves passing around a lot of arrays. Currently, each method that returns an array sorts it right before returning it. This isn't ideal for a couple reasons -- there's lots of duplicated code, it's inefficient to sort an array two or three times, and it's too easy to write a new function but to forget ...

Links in NSTableView NSCell

I have been reading and experimenting with allowing links in a custom drawn NSCell for the last few days and have basically got nothing usable, there's always issues with each approach. Does anyone know of a way of doing this that works? I am custom drawing the NSCell using - (void)drawInteriorWithFrame:(NSRect)theCellFrame inView:(NSV...

NSRegularExpression Help

Hi to all, I want parse, with iPhone's NSRegularExpression class, this text: <td class="rowhead">Uploaded</td><td align="left">652.81 GB</td> for extract Uploaded and 652.81 text. Thanks in advanced boys! ...