objective-c

Saving the NSManagedObjectID from one entity as a property on a different Entity?

Hi I have a Core Data Entity that needs to hold onto the NSManagedObjectID of some other Entity. To do so I was considering converting the ObjectID to a string that is an approved type of an NSManagedObject attribute. I can read from the documentation that I can get a URI representation of the ID by: NSURL *uriID = [[myEntity objectID...

Using MCPKit framework in Cocoa app.

I'm trying to integrate the MCPKit MySQL framework available at http://mysql-cocoa.sourceforge.net/ into my cocoa application. I've added the framework and included the header file but when I try to define my first MCPConnection variable it says "MCPConnection undeclared". Is anyone successfully using MCPKit on leopard ? Or is there anot...

How do you calculate the day of the year for a specific date in Objective C

This is something I found myself spending hours to figure out and therefor wants to share with you. So the question was, How do i determine the day of the year for a specific date? e.g. January 15 is the 15'th day and December 31 is the 365'th day when it's not leap year. ...

Is there a stringgrid in objective-c cocoa framework as there is in Delphi

Is there a StringGrid in the Cocoa Framework or has anybody implemented one that would be like the one in Delphi? ...

How does NSViewController avoid bindings memory leak? [have sample app]

I'm trying to implement my own version of NSViewController (for backwards compatibility), and I've hit a problem with bindings: Since bindings retain their target, I have a retain circle whenever I bind through File's owner. So I thought I'd just explicitly remove my view from its superview and release the top level objects, and that wo...

How to dynamically adjust method names and calls with Objective-C

Hello. I am trying to condense my code for a method and was wondering how I would achieve the following: I have a bunch of variables that differ only in their number such as: int intVariable1 int intVariable2 UILabel Label1 UILabel Label2 BOOL bool1 BOOL bool2 etc. So I want to call a method and pass in an int. That int would dete...

NSManagedObject is there a way to import created subclass to xcdatamodel file...

I have a question. You can export an NSManagedObject subclass from xcode xcdatamodel file when you create an Entity. Is there a way to import NSManagedObject subclass to the xcdatamodel diagram??? Thanks ...

Iterating object manipulation or altering multiple objects at once

Is the best way of doing what i'm doing? goodThingX, badThingX and nothin are UILabels. NSString *todayNothing = [[todayArray objectAtIndex:0] objectForKey: @"nothing"]; if (todayNothing!=NULL) { goodThing1.hidden = YES; goodThing2.hidden = YES; goodThing3.hidden = YES; badThing1.hidden = YES; badThing2.hidden = YES;...

I can't fill the cells of my UITableView with a NSArray (Normally it always works, but not in the case)

Hello, I have a UITableView with Cells that are filled with the Objects of an NSArray. I´m using the MGTwitterEngine to get Tweets from users. I want to show this tweets in the TableView. Here is the method that is called when the MGTwitterEngine has received all tweets ("namen" and "nachricht" are NSArrays): - (void)statusesReceived:(N...

Data serialization

Dear folks, I've got an objective-c/cocoa based application that I'm working on. This app is client<->server. Currently, the communcation protocol is based upon some fairly simple XML. While XML works for this task, it is not ideal in any aspect. It's a pain to serialize data to XML, it's not particularly light-weight, and difficult to i...

Help deciphering an NSString "passing argument ... from distinct Objective-C type warning"

Hi all, I am having trouble deciphering a "passing argument ... from distinct Objective-C type warning". I have a constant string declared as: extern NSString * const URL_1; and defined as: NSString * const URL_1 = @"http://someurl"; If I, say, assign that constant to an NSString as follows: NSString *URL = nil; ... URL = [[NSSt...

Getting first and last days of current week [iPhone]

Reference to pre-answered question at: http://stackoverflow.com/questions/1625098/getting-first-and-last-days-of-current-week There are two answers in the above link. One of them is theoretical and the other is in a language called as PyObjC (Python-Objective C bridge language), and a quick google search confirms that PyObjC does not w...

Profile Image Update Twitter API

I am trying to upload a profile image to twitter using their API. I found some good examples on the web on how to format the URLRequest, however I just can't seem to get this to work. Any help would be appreciated. The URL that I am using from Twitter API is http://twitter.com/account/update_profile_image.json -(void)uploadImageForAccou...

Xode build warning and "method not found in protocol" when method signature does exist

When I try to invoke an instance of a class that implements a particular protocol, I get warnings about the method not being found in the protocol's signature. warning: '-requestCompleted:requestType:' not found in protocol(s) warning: 'NSObject' may not respond to '-requestCompleted:requestType:' I couldn't see the reason...

Significance of const keyword positioning in variable declarations

What is the significance of the positioning of the const keyword when declaring a variable in Objective-C, for example: extern const NSString * MY_CONSTANT; versus extern NSString * const MY_CONSTANT; Using the first version in assignments produces warnings about "qualifiers from pointer target type" being discarded so I'm assum...

enum string comparison.

Hi, I need to compare an enum as a whole to one string, so the whole contents of the enum is checked. Wanted something like: NSString *colString = [[NSString aloc] initWithString:@"threeSilver"]; typedef enum { oneGreen, twoBlue, threeSilver }numbersAndColours; if (colString == numbersAndColours) { //Do cool stuff } But obviousl...

How to use a UITableView to return a value

How would I use a tableView as a value selector? So I have a series of input fields and what I want is when you select a cetian field it opens a tableview of options that you can pick from as a value for that field. Upon selecting an option it returns to the previous View with the selected value filling that field. ...

How to control a NSView, located in a dedicated NSWindow, from the main NSWindow designed to support the GUI built under COCOA?

Hi, This is probably a simple problem for the high skilled Cocoa programmers, but I can't find how to control the graph in a separate window. I read carefully the Cocoa related books, go through many web notes,but I can't find a solution to my problem. The purpose is to use a dedicated window to draw the I=F(Vg) curves extracted by the ...

How do I model relative scores between entities in CoreData

I am new to CoreData and am struggling to work out the correct way to model a particular relationship. I have an entity called 'Friend' with a few attributes such as 'name', 'age', 'sex' etc. I would like to be able to model a score between two instances of Friend and am having trouble getting my head around the best way to do this. Fo...

Tell what day it is using NSDate

Hi, I have an NSDate and I want to tell if it occurs on a particular day of any year. How do I do that? For instance, I want to see if NSDate's day and month are 25 and 12. I want to go: NSDate *today = [NSDate date]; int day = [today day]; int month = [today month]; Is there a way of doing that? ...