objective-c

Xcode/GDB: How to get information about an exception that was just thrown?

OK, so imagine that my breakpoint in objc_exception_throw has just triggered. I'm sitting at the debugger prompt, and I want to get some more information about the exception object. Where do I find it? ...

cocoa file association question

I've associated a file type with my application via application properties and by implementind the necessary NSApplication delegate methods. Everything seems to work, but ... this confuses the system. How do i make sure that the files are only associated to the copy of the app that is in Applications folder and not the developement versi...

cocoa open multiple files with associated app

Hello, I have an array of filenames that i would like to pass to an external application for opening. I'd like to do one of the following: a) Somehow instruct OSX to open all these files with an associated application, but it must invoke the target app's openFiles NSApplication delegate method b) Specify the application to open these f...

Save Image on iPhone idle time

Hi all, I want to save the loaded image from server in idle time.I use the following to to save image in iPhone memory. - (void)saveImage:(UIImage *)image withName:(NSString *)name { NSData *data1 = UIImageJPEGRepresentation(image, 1.0); NSFileManager *fileManager = [NSFileManager defaultManager]; NSArray *paths = NSSearc...

removeObserver with NSNotification... what am I doing wrong?

Basically, I have a view1 which at some point, calls view2 (via presentModalViewController:animated:). When a certain button in view2 is pressed, view2 is calls a notification method in view1 and immediately afterward is dismissed. The notification method pops up an alert. The notification method works fine and is called appropriately. ...

Do I need to Subclass from NSObject?

I'm starting Objective-C Development and I'm trying to wrap my head around how some things work. I'm creating a Twitter Client and have a class "Tweet". This is just a DTO - a class that has some variables. Should this just be a class or should it inherit from NSObject? Why? Or why not? ...

Global NSMutable array of a project

Hi, I want to know how i can declare and use a global NSMutable array of an Objective C project. I mean i need to update the here in one class and need to use in another class.... can anyone give me any kind of idea?? Thanks Rony ...

minimum effective schedule interval ( iphone objective c )

I think there is a minimum time span that we can assign as interval to schedule a task in iPhone SDK. But I haven't found that minimum interval/time span yet. Would you let me know please! It will be very helpful to me. EDIT Any detail reference is more appreciative. Thanks in advance ...

New NSString substringWithRange: Error Message

I'm getting an interesting new error with iOS 4: -[NSCFString substringWithRange:]: Invalid range {11, 4294967295}; this will become an exception for apps linked on SnowLeopard. Warning shown once per app execution. The error is caused by a snippet of code I got from a blog post that helps Title Case a string, and it's not going to be ...

Immutable Object in Objective-C: Big init method?

I want to have an Object with immutable fields in Objective-C. In C#, I would use Properties with private setters and a big constructor. What would I use in Objective-C? Using @property doesn't seem to allow me to declare the setter as private. Using initWithData: (NSString*) something createDate: (NSDate*) date userID: (long) ui...

XML parser for iphone

what's the best XML parser for parsing RSS feed type documents on the iPhone? Ive found a few samples on the internet but kept running into memory leak problems. any suggestions? ...

Make a function to connect in objective c

This is my code: NSError *error; NSURLResponse *response; NSData *dataReply; NSString *stringReply; NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL: [NSURL URLWithString: URLGOESHERE]]; [request setHTTPMethod: @"GET"]; dataReply = [NSURLConnection sendSynchronousRequest:request returningResponse:&response error:...

UITextField turn places with UILabel in the UITableView during scrolling

I have a strange problem with UITableView and UITextField inside the cell (as subview). In the window view (UITableView, grouped, scrollable) there are two sections. First section has got 5 rows: 1.1 - cell with UITextField 1.2 - cell with UILabel 1.3 - cell 1.4 - cell with UITextField 1.5 - cell with UISwitchButton and the second ...

How do I know if I need to alloc and if I need to release?

Completely new to Objective-C, trying to find out when I need to alloc and release objects. For example, I want to fetch some data from the Web. I found an article at Apple which has this code: NSURLRequest *theRequest=[NSURLRequest requestWithURL: [NSURL URLWithString:@"http://www.apple.com/"] cac...

Trying to create a rectangle filled with blue UIImage object.

Hi, I want to create a blue rectangle image and see it in my view, but this code doesn't seem to work: CGRect imageRect = CGRectMake(50, 50, 64, 40); UIGraphicsBeginImageContext(imageRect.size); [[UIColor blueColor] set]; UIRectFill(imageRect); UIImage *aImage = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndIma...

Objective-C "private" protocols?

I got a view controller class (MyViewController) that deals with a UIView subclass (MyView). I don't want to let any class except the view controller class know about the UIView subclass, so I cannot import MyView.h in MyViewController.h. So, in MyViewController.m, I put #import "MyViewController.h" #import "MyView.h" @interface MyVie...

perform:@selector using a method with parameters

I have a method hideButton -(void) hideButton:(UIButton) *button { [button setHidden:YES]; } and I get a "can not use an object as parameter to a method" error. I want to be able to give the button as a parameter to the method when calling this [self performSelector:@selector(hideButton:smallestMonster1) withObject:nil afterDelay:1...

Creating a framework within an application?

I have a cocoa application which has certain subroutines / methods. So if I have a method like this: - (void) dummyMethod:(NSObject*)dummy { //code } Can I call it from an outside application providing I have the correct headers? I mean linking an application with another application. That method is an instance method by the way. S...

Programmatically determine if a Cocoa object loaded from nib/xib is available

The setting is the following: I have a cocoa object in a nib file that is loaded when the NSWindow and view is loaded The window can be closed I also access the object programmatically Now what happens in some situations is that I get a crash, when I try to send a message to the object, but it has been deallocated before (because the...

load second view from the first view

I am currently develop iphone app. the type of the app is Tab Bar. so i heave 4 tabs that in each tab i have different view. (each view have controller for itself) now in the first view i am loading data from the net and when it finished i want automaticly to jump to the second tab controller(to show the result). but u cant find the wa...