nsobject

Class type Objective C

I am sorry if this has been asked before, I have looked throughout stackoverflow and haven't found an answer to this question. In the NSObject protocol, it defines a method that is similar to this: -(Class) class What type of object is the Class object? Or is it even an object? What can I do with the object? Can I get the base class ...

Releasing custom made NSObject class in iPhone App

Hi, I have a Class which I have created as an NSObject. This class has a number of properties of different types and methods etc. When I instantiate this class in my App (say in the main View Controller) I immediately send it a release call when I am finished using it. ie: MyObject *myObject = [[MyObject alloc] initWithParameters:pa...

Strange behavior with NSObject Properties...

I have an NSObject that I am using to store/hold properties of an object, one of them being a "Name" property cast as an NSString. I am also pulling data from a SQLite DB for said object using the following: - (void) getDataToDisplay:(NSString *)dbPath { if (sqlite3_open([dbPath UTF8String], &database) == SQLITE_OK) { NSSt...

How to subclass the NSObject while getting rid of -(id)init?

I want a class that take a REQUIRED argument like the UITableViewController that does not have init. Currently I just throw an exception when invoking init. Is there a way to deactivate it completely? ...

Can't access an object's properties in objective-c

I have just jumped into Objective-C and I got stuck pretty early on. I will post code with my question but to keep it readable i'll get rid of some of the crap, let me know if you want more code posted! I have created a new object called 'Phrase' (subclassed from NSObject), and am reading items from JSON into these 'Phrase' objects and...

Is there a reverse "setValuesForKeysWithDictionary" - a makeDictionaryWithObjectProperties?

Hi I parse some JSON from a web service, this gives me an NSDictionary, I use this dictionary to populated properties on a valueEntity of type NSObject by [myObject setValuesForKeysWithDictionary:JSONDict]; (myObject has the same property names and types as the dictionary from the JSON parser) name = name count = count startDate = ...

NSView subviews and types

I have a couple of custom NSBox subclasses called OuterBox and InnerBox. I've set up my view in a XIB and arranged the hierarchy like this: OuterBox : NSBox NSButton NSBox InnerBox : NSBox ...and some other views The idea is that when the NSButton gets pressed, in an IBAction method, I want to get the superview of the ...

NSObject's 'description' method giving parentheses as output?

So, I'm debugging an app I'm building and using the description method to help me find the problem. But instead of giving me the app as a string it is printing out parentheses instead. Please help! Here's the code: - (void)viewDidLoad { [super viewDidLoad]; reminders = [[NSMutableArray alloc] init]; currentTitle = [[NSMutableString al...

How to make a copy of a custom object

I made a custom object that inherits from NSObject. Let's say I have an array of these objects. Then I want to make another object, that is a copy of one of the objects in the array. I do not want to simply point to an existing object in the array I want a copy. Is there an easy way to do this? ...

how to initialize an object(NSObject subclass) at a specific address

Hi I need to initialize an NSObject at a particular location that I specify(through a void* pointer, for example). For a little bit of context, I am writing a sqlite3 aggregate function. To keep temporary results from this function, I have to call a sqlite3_aggregate_context function, which allocates a block of memory for me. I want to s...

reloading a tableview source when data is called from appDelegate

I have a table based app that stores data on a mysql server, it gets updated and writes the data to nsdictionary for persistance. When you make a change to the data, the table need to update. However if I put a [self tableview reloadData] the app crashes when selecting a row. Does anyone have an Idea on how to make the table refresh happ...

Low memory warning for NSObject

I have a subclass of NSObject, it is a singleton which loads a list of images into memory, either from hard drive or downloads them from the internet. I want to release the images stored in memory if the app recieves a low memory message, like in a UIViewController. (it then gets the images from hard drive when it next needs them). ...

How do I store an NSRange in a NSMutableArray or other container?

Here's what I want to do: NSRange r = NSMakeRange(0,5); id a = [NSMutableArray a]; [a addObject: r]; // but NSRange is not a NSObject * With a boolean, I'd use code like this: [a addObject: [NSNumber numberWithBool: YES]]; or with an integer: [a addObject: [NSNumber numberWithInteger: 3]]; So what's the equivalent with a NSRange...

Core Data: storing web content before saving

I am currently developing an app that relies heavily on retrieving web content. I have a series of NSObject classes that represent the content that I retrieve in JSON format. I also have NSManagedObject classes that represent my Core Data model that are almost identical. Here is an example of an NSObject class that I use to hold my web ...

Calling dealloc in init?

I am writing a framework and I have an object with a custom init method: @implementation OSDatabase @synthesize database; // MEM - (void)dealloc { sqlite3_close(database); [super dealloc]; } // INIT - (id)initWithDatabasePath:(NSString *)path error:(NSError **)error { if (self = [super init]) { if (!sqlite3_open_v2([path UT...