cocoa

PackageManager 3.0.2 - Adding Plugins

Hi, I've programed a plugin for an installer package I am planning to use.I've used Apple's Package manager 2.4 (Tiger) before where I could right click packages (*pkg), navigate through the contents folder, create a plugins directory and paste my plugin plus the installersections.plist file. However in version 3.0 (Snow Leopard), I can...

How to make an NSMenu recent list

I'm working on a small URL shortening application for someone, and I need to have a list, similar to that of Droplr's, that has all of the recently shortened URLs. The list should be a submenu of the main menu, which is attached to an NSStatusItem. I need to have that list add an item each time a URL is shortened, and I'd like to have a...

NSPredicate as a constraint solver?

I'm working on a project which includes some slightly more complex dynamic layout of interface elements than what I'm used to. I always feel stupid writing complex code that checks if so-and-so is close to such-and-such and in that case move it x% in some direction, etc. That's just not how programming should be done. Programming should ...

Count method of subclass of NSMutableArray crashes app

This seems to be a common problem, but I can't figure out anything from the answers I've seen so far. I have an iPhone app that uses a subclass of NSMutableArray to store objects, plus some additional properties. The subclass is skhCustomArray. The subclass initializes fine, with no objects in the skhCustomArray, and I assign it to th...

CoreData updated sqlite database

Hey there, I'm working on my first application using coredata. Everything works perfectly. When I debug the app on my device (without it already being installed on the device), then quit the app, manually modify the sqlite dbase then debug the app again, it appears to be using the old version of the database. If the two sqlite files h...

Getting Error while attaching an AppleScript file to a button.

Hi. I hav created a xcode project using cocoa application. Also I hav add a .applescript file to that project. I hav attached dat file to a button. When I build the project, got the following error . Can anybody help me out this? [Session started at 2010-03-02 13:02:03 +0530.] GNU gdb 6.3.50-20050815 (Apple version gdb-966) (Tue Mar 1...

[iphone] Is there a class teardown counterpart to +initialize?

I'm sure it is wishful thinking, but is there a counterpart to +initialize that will automatically get called when all instances of a class have been dealloc'ed? I allocate a singleton object in +initialize, which is called before my first class instance gets alloc'ed. I would love to be able to release the object once my class insta...

How can I tell the compiler that my class resolves methods dynamically?

I have a class which uses resolveInstanceMethod to dynamically implement methods. When I call the dynamically implemented methods from other parts of the code, the compiler emits a warning that the object may not respond to the selector. I would like the compiler to not emit such warnings for this class, but I don't want to suppress war...

Companion sample Xcode project for "Apple Help Programming Guide"?

Does anyone know of a sample Xcode project that demonstrates how to provide user help and which closely follows the guidelines of the "Apple Help Programming Guide"? The guide's revision history shows that one of the more recent new guidelines is to organize help books in a bundle. I'm experiencing some trouble following this guideline....

How to identify not responding process programatically

Hello guys, I'm looking to find a way how to identify a non responding (not zombie) process programatically. I find some information to check TH_STATE_UNINTERRUPTIBLE status but there was some discussion that it's not the right way. Any ideas? ...

NSStatusItem not shown after sleep.

Hello, I've got a small Cocoa problem. I have a StatusBar application that has an NSStatusItem in the Menu Bar. It is drawn by a custom View as shown here. When the Main view of the app is hidden (most of the time), the computer goes to sleep and awakens again, I lose the icon and a blue rectangle is shown. Has anyone of you got any idea...

Inconsistent crash due to "message sent to deallocated instance" in iPhone App

Hi There, Originally, my application was crashing do to BAD_EXEC_ACCESS. I turned on NSZombieEnabled, that output is below. The crashing is extremely inconsistent, If it crashes, it always crashes in one of three places, but it doesn't always crash when passing over those lines of code. I.e. sometimes it crashes at one of those places w...

How do I create an 8-bit PNG with transparency from an NSBitmapImageRep?

I have a 32-bit NSBitmapImageRep which has an alpha channel with essentially 1-bit values (the pixels are either on or off). I want to save this bitmap to an 8-bit PNG file with transparency. If I use the -representationUsingType:properties: method of NSBitmapImageRep and pass in NSPNGFileType, a 32-bit PNG is created, which is not what...

How to auto resize table column when double clicking on Cocoa ?

I want to auto resize table column to its content width when double clicking its header (resize cursor is showing), like on iTunes. Anyone know how to do it ? Thanks in advance ...

getting corresponding value of an attribute from an NSXMLElement

Hi, How can i get the corresponding value of an attribute of an NSXMlelement object from a self constructed NSXMLNode. ...

Why do I get two redirectResponses when receiving one 302 response?

I use the following code: - (NSURLRequest *)connection:(NSURLConnection *)connection willSendRequest:(NSURLRequest *)request redirectResponse:(NSHTTPURLResponse *)response { NSLog(@"Received redirect Response: %@ %@", [response allHeaderFields], [NSHTTPURLResponse localizedStringForStatusCode:[response statusCode]]); return request; } ...

Bulding a new "Core Data" AtomicStore, the missing pieces

I am in the process to implement an AtomicStore subclass to save data in a MySQL DB. The system already works pretty well besides the implementation of fetch-requests. The fetches should include the cached nodes but also fire a "select" on the underlaying SQL db. I have currently only worked on SubClasses for NSAtomicStore and NSAtomicS...

How to write application for simulating content form submission using cocoa?

Would like to ask for recommendation for ways that I can build application in cocoa to simulate user submission. For example, filling in registering form or even simulate a click in the web form. Not sure what exactly is the term for this. Tried to google around, but didn't find any result. Closest I get is webkit, but not sure how to a...

NSString : number of a word.

Possible Duplicate: Number of occurrences of a substring in an NSString? I would like to know if there's a method which returns the occurrence of a given word. NSString *string = @"ok no ok no no no ok"; // How to return 4 for the word no ? Thanks for your help ! ...

Why do you use an underscore for an instance variable, but not its corresponding property?

I am new to iphone development.I am doing research on voice recording in iphone .I have downloaded the "speak here" sample program from Apple.It consist of LevelMeter.h file, in which @interface LevelMeter : UIView { CGFloat _level, _peakLevel; } The property are set as @property CGFlo...