objective-c

How does it know which method to call?

This is a follow-on from a previous question, in the implementation, I have two methods, one which gets called when a particular service is found and the other when it vanishes. This might be a dumb question, but apart from the NSLog lines they are identical, what dictates which gets called? // INTERFACE @interface ITunesFinder : NSObje...

Searching Through a TextFile - Cocoa

How would I type up a code that searches through a text file from a given directory. I want the search word to be "password123" and if it contains that, then it will proceed onto the next step, if not it will give an error message. ...

objective-c primitive arrays

I wanna have a mutable array with primitives in obj-c (selectors). What's the recommended way to do this? NSArray and those can only hold objects. ...

Calling a Java Program from a Cocoa Application

Hello, I can't find a decent Cocoa Charting Library so I would like to use JFreechart. Is there any way to call a Java program from a Cocoa Application? I was thinking in writing a java application that returns an image of the chart and I would display it inside my Cocoa app. Thank you, ...

Event Handler with Parameters

I have problem with handler event. I need create handler with one NSString parameter. I try, but it doesn't work. Sample code: @interface Example : NSObject { id target; SEL action; } - (id)initWithTarget:(id)targetObject action:(SEL)runAction; - (void)activate; @end @implementation Example - (id)initWithTarget:(id)targetObjec...

NSArray throws exception stating that is (UIAnimator *)

I have tried to run the following code, as a proof of concept, and I get the following error: *** -[UIAnimator count]: unrecognized selector sent to instance 0x3832610 2009-10-09 00:33:22.355 Concept1[680:207] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[UIAnimator count]: unrecognized...

How to resolve an internally-declared XML entity reference using NSXMLParser

I have an XML file that uses internally-declared entities. For example: <?xml version="1.0" encoding="UTF-8"?> ... <!ENTITY my_symbol "my symbol value"> ... <my_element> <my_next_element>foo&my_symbol;bar</my_next_element> </my_element> ... Using the NSXMLParser class, how am I able to resolve the my_symbol entity reference? ...

UITableViewCell & iPhone OS 2.2.1

How can I add on a Cell few UILabels and UIButton? My limit it's app should support OS start from 2.2.1. ...

UIButton.layer.cornerRadius doesn't exist?

Hi, I'm implementing a custom UIButton with minimal functionality. The .h file: #import <Foundation/Foundation.h> @interface CustomButton : UIButton { } @end I'm encountering a compilation error at line (A) in the .m file: - (id)initWithCoder:(NSCoder *)coder { if(self = [super initWithCoder:coder]) { CALayer *layer = [sel...

Debug build works beautifully, ad hoc build crashes hard

I'm working with the EXIF library at http://code.google.com/p/iphone-exif/ and I have come across a real head scratcher of a bug. When I implement the library in a debug build everything works beautifully, but when I compile for ad hoc beta testing the app crashes hard. I'm getting the following error: Exception Type: EXC_BAD_ACCES...

How to ensure no memory leak for Objective-C class that is called by many other class.

I have the following controller class which will do different tasks based on combination of the flag and param property. The value of these two properties will be set by many other classes having a reference to this controller. The question is how does each of the calling class assign value and when should they release it so that there w...

Problems with Programatically Adding UIImageView on iPhone

I'm trying to programatically add dots to a radar screen. The code runs without complaint, but I can't seem to get the dots to show up on screen. I do have a background UIImageView that covers the entire screen, but based on the documentation I expect my new UIImageView to be added to the front (not to mention I've tried bringSubViewToF...

NSSound undeclared on iPhone?

sound = [[NSSound alloc] initWithContentsOfFile:@"staticbeam09.wav" byReference:YES]; Code referenced from Apple docs. Getting an error when I put this in viewDidLoad. If I put NSSound *sound; in the header file, I get the specifier-qualifier error at the top of my implementation file. What do I have to do to make this work? I was j...

How to connect the .net page for access database from iphone objective c ?

I need to access a URL with GET values from an iPhone using Objective-C? (temp url) http://ws.library.com/svc-public/iPhoneAuthenticate.aspx?u=usertest&amp;p=usertest1 iPhoneAuthenticate.aspx is .net page and u-username,p-password are the GET variables for the server. Now, how do I access and get values from this URL? And how do I p...

Cocoa-Touch: UIPickerView viewForRow is changing row orders

I have a UIPickerView. I'm customizing it's rows via it's delegate's viewForRow as follows: - (UIView *)pickerView:(UIPickerView *)pickerView viewForRow:(NSInteger)row forComponent:(NSInteger)component reusingView:(UIView *)view { if (view) { return view; } else { NSString *s = [datePickerValues objectAtIndex:row...

how do I detect whether I have iPhone 2G,3G,3GS

I want to detect my current device name. How do I detect it through iPhone SDK? Also how do I detect if the iPhone doesn't have a SIM inserted? ...

OCUnit on Snow Leopard VS Leopard

I am working on a iPhone project that just added a second developer. The new developer got a new shiny macbookpro with snow leopard and Xcode 3.2. I am still on leopard and using Xcode 3.1. He is getting errors trying to run the unit tests (OCUnit and OCMock are being used). The shell script as the last step of the Test Target fails ...

iPhone's UILabel with URL detection

I'm looking for an iPhone control that can simply display some text and detect URL's (http, email, tel) inside that text. UILabel doesn't support URL detection. UITextView can do that, but it's too heavy for use in chat application that I'm developing. Any suggestions will be appreciated. ...

how to show UIalertview while application is running but iphone is locked ?

i want to show a alert when my app is running but phone is locked..we can say in power save mode. is there a way to show alertview without Push-Notification service when phone is idle and app is running. ...

Custom Mac Installer Overwrite /Library/Application Support File

My installer places a file into /Library/Application Support/AppName. As a final step of the install process in a custom installer plugin (Objective-C code) I check for a more recent version of that file. If it exists, I download it and then attempt to overwrite the one created by the installer. The issue is that I apparently don't have ...