cocoa

How to develop a safari plugin(input managers) use SIMBL?

Now I want to develop a safari plugin use SIMBL , but I searched a lot of webpage not found some sourcecode or simple sample , someone can give me or point to a location ? Thank you very much!!! ...

NSAutorelease memory leak

Hi all, I am getting this error message in the console: *** _NSAutoreleaseNoPool(): Object 0x10d2e0 of class NSPathStore2 autoreleased with no pool in place - just leaking I can't figure out what is the error? Thanks. ...

Cocoa-Touch. What Exactly is the Difference Between These NSMutableData Methods?

One thing I'm a bit unclear on is the difference between these NSMutableArray Methods: // Class Method Style NSMutableData *myMutableDataInstance = [NSMutableData dataWithLength:WholeLottaData]; and // Instance Method Style NSMutableData *myMutableDataInstance = nil; myMutableDataInstance = [[[NSMutableData alloc] initWithLength:...

How to create an Array of Strings in Objective c for iphone

I'm trying to create an array of strings that can be randomized and limited to a certain x number of strings. If the array could be randomized I could pick the first x strings and that would work fine. I'm trying to use code like this currently NSString *statements[9]; statements[0] = @"hello"; This seems to work but the array seems...

How to monitor global modifier key state (in any application)?

I'm using some Carbon code in my Cocoa project for handling global key events (shortcuts) from other applications. Currently I have setup a kEventHotKeyReleased event handler and I can successfully obtain hot keys when my application is not active. That triggers some operation in my application. The problem I have with the behavior of k...

What would you do instead of using NSViewController to be compatible with 10.4?

All I need to do is load and swap some nibs in a NSView of a window. I know how to do it with NSViewController and have it working perfectly with 10.5-10.6, but I don't know what to do for 10.4. Tutorial links very welcome, I have trouble finding legacy stuff. (Yes, I really do need to support 10.4.) ...

NSScroller graphical glitches/lag

Hi, I have the following NSScroller subclass that creates a scroll bar with a rounded white knob and no arrows/slot (background): @implementation IGScrollerVertical - (void)drawKnob { NSRect knobRect = [self rectForPart:NSScrollerKnob]; NSRect newRect = NSMakeRect(knobRect.origin.x, knobRect.origin.y, knobRect.size.width - 4, ...

ScrollOffset in UIWebView?

Hello, I'm having a really hard time understanding delegates and object inheritance (if I may use this word) and I think I need a simple (or so I think) thing: catch scrollViewDidScroll event in UIWebView and get offset (basically, just to know if scroll is not on top/bottom, so I could hide navigation and tab bars). Is there any way I...

What is the meaning of NSXMLParserErrorDomain error 5.?

Ok, I am back on this task. I have my XML properly download from my webserver with a URL pointing to the server's file, however, when I detect the network is 'unreachable' I simply point the URL to my application's local XML and I get the following error (N.B. the file is a direct copy of the one on the server). I cannot find detail desc...

Storing identical data efficiently in a Core Data data model

I have a data model that contains several entities, each with several different attributes that store image data. These will all be small images and I need to store them in the persistent store rather than as external files. While I can just store the image data in a Binary or Transformable attribute, it's quite likely that the user wil...

Bluetooth Example Code for Cocoa (Objective-C)

I'm looking for example code for setting up a connection to a bluetooth device using the Bluetooth API in Cocoa. Apple used to include this type of example code in the XCode tools package under the /Developer/Examples/Bluetooth folder, but upon downloading the latest version of XCode (3.2.1), these bluetooth examples have been removed f...

Sort NSArray by NSDate, today

Hi, I have loaded item from core data in an NSMutableArray. Each item, when created, is given a due date, that the user choices. How do I sort, so only the item that is due today is displayed? Here is what I got so far: NSPredicate *predicate = [NSPredicate predicateWithFormat: @"dueDate == %@", [NSDate date]]; [allObjectsArray ...

One code base for Snow Leopard and Leopard

Background I'm a developer who's in the throes of building an application for the Mac. I'm about to get my hands on Snow Leopard. Until now I've been building on Leopard. I've only been doing Cocoa development for about a year not very intensely. I've read a lot about Snow Leopard and Grand Central Dispatch in particular. I'm aware tha...

KVO on an NSCountedSet?

I'd like to monitor an NSCountedSet to see if its contents changes. Setting up KVO seems to compile but it's not being triggered. First question: can you observe a set? If so then is there something wrong with this message? [subViewA addObserver:subViewB forKeyPath:@"countedSet" options:0 context:NULL]; I'm really just trying to m...

Does anyone know if there is a performance benefit to fullscreen opengl vs windowed opengl in OSX?

The client for the MMO I work on uses two contexts, one for a window view and one fullscreen. I'm wondering if I just use a window sized to the display I can simply resize it if the user wants a smaller window so they can access their desktop. Is their a performance penalty for running opengl in a window vs fullscreen assuming the same ...

What does "Context" mean in Cocoa/Objective-c?

Recently I've been seeing the word "context" used in method names in Cocoa, but I don't understand the meaning. I've seen it in places like Core Data (NSManagedObjectContext) and in Core Graphics (CGBitmapContextCreate) but it seems to be used all over (NSSet, NSArray, NSObject). I'm assuming that it comes from the c world. What is this...

Core Data Deletion rules and many-to-many relationships

Say you have departments and employees and each department has several employees, but each employee can also be part of several departments. So there is a many-to-many relationship between employees and departments. When deleting a department I would like to delete all employees that are only part of that department and nullify the rela...

Xcode 3.1.3 problems unit-testing a plug-in

Following Chris Hanson's blogs and Apple's Automated Unit Testing with Xcode 3 and Objective-C I have started implementing unit tests for my projects. However, I use a lot of plug-ins (loadable bundles) and I can't quite figure out how to test them. I figured I would use the approach Chris Hanson described for testing frameworks. I star...

Image Recognition

Hi I want to write an application in cocoa that recognize an image, for example a square. example: I take a photo and the application try to find a black square into it Is there any library or reference to start with for cocoa? ...

Unexplained leaks using CFDictionaryRef and ABMutableMultiValueRef

The following code is creating a number of leaks which I do not understand as I release all objects created with Create or Copy. I have not worked with CF objects extensively so I may have a misunderstanding of the retention cycle. Any help would be appreciated please: ABMutableMultiValueRef webServices = ABRecordCopyValue(aRecord, kABP...