cocoa

Cocoa - NSNetserviceErrorCode = -72003

Hiyee...Now I'm having this error " NSNetServicesErrorCode = -72003; NSNetServicesErrorDomain = 10; " when I was trying to connect to a domain. My Code for connection: -(IBAction)connect:(id)sender { NSNetService *remoteService = servicesController.selectedObjects.lastObject; remoteService.delegate = self; [remoteService resolveWithT...

Core Data / Cocoa : @distinctUnionOfObjects not returning a usable NSArray*

Hi there, I have an application that uses Core Data that has a relationship that I would like to group by. I have NSManagedObject classes that were generated by my .xcdatamodel file, and everything seems to be working OK for the most part. Given a parent / child relationship, I would like to do the following: A parent has a collection ...

How to find caret position in an NSTextView?

Hi all, I've an NSTextView with with several semi-colon separated strings. I need to find on which of those strings the caret has been placed. How could I do that? ...

How to use NSCoder

I am developing iphone application. I use NSCoder. MyApplication.h #define ITEMS_KEY @"items" #define CATEGORIES_KEY @"categories" #import <UIKit/UIKit.h> @interface MyApplicationData : NSObject <NSCoding, NSCopying> { NSMutableArray* items; NSMutableArray* categories; } @property (nonatomic ,retain) NSMutableArray* items...

NSMutableArray values becoming "invalid"

Hi all, I'm trying to show a database information in a tableview and then the datailed information in a view my problem is as follow: I created a NSMutable array: NSMutableArray *myArray = [[NSMutableArray alloc]init]; Then I populated it form a database MyObj *obj = [[MyObj alloc]initWithName:idObj]; When I show the values in the ta...

In Cocoa, how could you create an NSImage from a view? (Very similar to Top Sites in Safari 4.)

Actually, almost exactly the same thing. A matrix of small views that would expand out when you click on them. I don't know if it makes more sense to take a snapshot of the view as an image and work with that, or if there is a way to keep the views "live". Thoughts on either approach are welcome! ...

Is it possible to make four (and more) part Uniform Type Identifiers?

I'm trying to register my custom UTI for document-based app. It seems ok, because a get correct type in -initWithType:error: method and in -dataOfType:error:. BUT my app fails to open the newly created files. The UTI is similar to this, notice the four components used: ru.mycompany.myapp.myformat I thought it is possible to create fo...

NSStatusItem (cocoa) location on screen

I am trying to get the on screen location of an NSStatusItem so that I can perform a click on that area via code like below. I am doing this so that my users can press a hotkey to see the menu. event = CGEventCreateMouseEvent(NULL, kCGEventLeftMouseDown, newLocation, kCGMouseButtonLeft); CGEventPost(kCGHIDEventTap, event); CFRelease(eve...

What is the right choice between NSDecimal, NSDecimalNumber, CFNumber ?

I've read a lot about NSDecimal, NSNumber, NSNumberDecimal, CFNumber... and it begins to be a kind of jungle to me. Basically, I'm trying to create a simple model class that will handle simple computations, like this one: #import <Foundation/Foundation.h> @interface Test : NSObject { float rate; float amount; int duration...

Cocoa Button that will light up with mouse over

Is there a flag that can be set that will cause a Cocoa button to be highlighted when it is moused over. I need to this programatically with objective C on OSX. ...

Unrecognized selector sent to instance - on setter method

Every time try to set the value of any variable in my model object, I receive 'Unrecognized selector sent to instance' error, and the app crashes. The ivars have been synthesized and they are not readonly. I have checked to see the values set are of the right type. I am not sure if it has to do with some connection in IB, which I have c...

How to know what all software are there in system in os x using objective c

Is there a way to find out what all softwares are installed / present in OS x, programmatically using objective C. any help will be appreciated. Thanks in advance ...

Core Data: Generate Unique ID Number

Hi all, I have a window that looks like so: Everytime a record is added, I want the repair ID to be set to a unique number that hasn't been used in the table yet. e.g. if there is ID numbers 1,2,3, then when I press +, the ID field should be set to '4'. Also, if one of the records in the table is deleted, so that the ID numbers are: ...

NSURL path doesn't understand a plus sign in a URL

Hi As you know a plus sign in a URL translates to a space character. [NSURL path] returns a path replacing all %xx with corresponding characters. But it doesnt translate '+' to a space! It leaves it as a plus sign. Is it a bug or what? How can I use NSURL to work with URLs which contain spaces encoded as pluses? thanks ...

View swap using push animation

I want to swap out one view with another by pushing the old view aside to slide in a new view (the kCATransitionPush type). To use CoreAnimation I need to work with CALayers with my views. The problem is that attaching a backing layer to my window content view through setWantsLayer distorts everything in the view. I'm not sure if this h...

Where register an object as Notification listener? - Maximize performance!

Hello, there is a better place where an object can be registered to a Notification Center? In other words, for a matter of performance, it's a good practice to register an object as Notification listener in the init(), awakeFromNib() or other event handler? Thanks! ...

How can I get rid of this conflict type warning?

Objective-C Conflict types for '-(NSInteger)amountYear:(NSInteger)searchYear Month:(NSInteger)searchMonth' How can I get rid of this warning? .m #import "MyAppDataController.h" #import "MyApplicationData.h" @implementation MyAppDataController @synthesize appdata; static id _instance = nil; + (id)instance { @synchronized(self) ...

Setting nested objects?

I am just trying to make sure I am getting things right as I move forward with Objective-C, two quick questions if I may: (1) Am I accessing the Position object correctly from within Rectangle? am I right to access the Position object contained within by the pointer I set in the init, or is there a better way? (2) In [setPosX: andPosY:...

Objective-C and Windows

I am currently in a class that is developing applications in Objective-C and Cocoa. I was wondering if there was any way to build and compile Objective-C applications on Windows Vista. During class, we are able to use the Mac machines provided to us, but I was hoping to do some work outside of class, and I only have a Windows Vista machi...

Primary Key behaviour in Core Data iPhone

I am making an app that parses feeds from xml and stores them using Core Data. The issue I am dealing with at the moment is duplicate entries. Every feed I am parsing contains a unique id, something that I get in my model as an int. Now what I need is to tell Core Data not to store that entity if another with the same id already exists. ...