objective-c

use c++ template class from objective c file

Hello, I would like to use a C++ class in an objective c application. How to achieve this? Thanks for your helps :) ...

creating a plist file programatically

this question is regarding xcode objective c and iphone development: So i want to store an array in a new plist file and I know how to retrieve the file path and write the data into the file (at least i think i do) and all that jazz once the plist is created, but how do I actually create the plist file the first time the app is run or t...

Objective-C Properties and Memory Management

Given the following property definition: @property (nonatomic,retain) MyObject* foo; does the following code cause a memory leak: self.foo = [[MyObject alloc] init]; ? It looks like the alloc call increments the retain count on the object to 1, then the retain inside the property setter increases it to 1. But since the initial co...

Changing values based on compile settings

Is there a way to create an if statement based on compile settings? I have an App that accesses a web-based API and when compiling in debug mode I want it to use the private beta version but when I compile for release I want it to use the public live version of the API. At the moment I just have a NSString holding the url address. ...

How to obtain the list the current instantiated objects for a given class in Objective-C?

Since class_poseAs(..) is deprecated in Objective-C 2.0, I need to find another way to change the class of an object at runtime. I've found I can change an object's class using object_setClass(..). My problem now is finding all the current instances of a given class in order to update them. A solution would be to maintain a global dicti...

UIButton currentTitle displaying different information that expected

I have the following piece of code - (IBAction)buttonPressed: (id) sender { UIButton *button = (UIButton*) sender; NSLog(@"Clicked button is: %d", button.currentTitle); } The output is: Clicked button is: 26317696 Why is not displaying the title of the button which is "A"? ...

objective c reassign point

I cant wrap my head around this for some reason... I have a class (Model) with an ivar (value). I want to pass the value to a method and change the value ivar to point to something else. This changes the aValue to point to newString. So, how do I get the model.value to point to newString with out saying model.value = newString? (void)a...

Core Data - Associate a Quantity to a Relationship

I have a Core Data entity called "Item" and it represents an item in a store so it has a name, price, and a few other attributes. I would like to be able to create lists of these items and I am having some trouble figuring out how to do it. The problem is that I need to be able to associate a quantity for each item in the list AND I n...

Is this the definitive ref counted Objective C singleton implementation??

Here is what I have concocted, after poring over the singleton literature. Have I forgotten anything? @implementation MySingleton static MySingleton *mySharedInstance = nil; //called by atexit on exit, to ensure all resources are freed properly (not just memory) static void singleton_remover() { //free resources here } + (MySin...

Checking for equality in Objective-C

Hello, How do i check the key in dictionary is same as the string in method parameter? i.e in below code , dictobj is NSMutableDictionary's object , and for each key in dictobj i need to compare with string. How to achieve this ? Should i typecase key to NSString?? -(void)CheckKeyWithString:(NSString *)string { //foreach key in NSMu...

URL not loading in UIWebView

I am trying to get this Outlook Web Access demo account to load in an iPhone's UIWebView, and it does absolutely nothing... I don't even get an error code with the UIWebViewDelegate didfailLoadwithError method... here's the details: URL: https://webmail.123Together.com/exchange/ Username: [email protected] Password: test I would like ...

iPhone Keyboard hiding fields in UIWebView

Hi, I am a beginner at iPhone development and am hoping someone can help me with my question. I have a UIWebView displaying a web page. If the user taps inside a textbox on the web page then the keyboard pops up. This is great, but it hides the field that the user tapped on. I have looked around and found code samples to deal with this...

NSTextView doesn't initialize when I call readFromData:(NSData *)data ofType:(NSString*)string

I have a refreshDisplay: method that calls the setString: method of an NSTextView. I can save, and load, but when I load even though my program loads the data, it does not display it on the NSTextView as it should. I did a check and that NSTextView seems to be nil when I load, which is why the setString: method does not do anything to it...

How to call a method with parameters using @selector

Hi, I have two methods with same name but different parameters say: -(void)methodA:(NSString*)string -(void)methodA:(NSNotification*)notification Now i need to call those methods using @selector with the parameters. How to do it ? ...

Organization of many bundles (like System Preferences.app)

I'm working on a project which organizes many separate bundles onto a System Preferences-like screen, in categories. First, how does System Preferences organize its pref panes into categories? A quick glance in the pref panes' bundles reveals no obvious category info. Second, how should I organize my bundles into categories? Right now,...

Showing asian unicode string in UILabel

Hi, How can we show asian unicode values in UILabel \U2013\U00ee\U2013\U00e6\U2013\U2202\U2013\U220f\U2013\U03c0 \U2013\U00ee\U2013\U220f\U2013\U03c0\U2013\U00aa\U2013\U221e\U2014\U00c5 Thanks ...

Launching help page in Help Viewer in 10.6

I launch help file in 10.4 and 10.5 using AHGotoPage which work great. When I try launching in 10.6 I get error "hVURLHandlerErrorDomain error 1003" but no idea why. Note: The error is only on Release version not in Debug. I even tried with AHLookupAnchor, even this gives the error. Am I missing some thing in solution? Is there any ot...

How to access a method by inheritance of @protocols in Objective-C?

Hi, I have a program where inheritance of protocols are there say: @protocol A -(void)methodA @end The protocol which inherits: @protocol B<A> -(void)methodB @end The class which implements @protocolA method is @interface classB<B> @end @implementation classB -(void)methodA { //somecode } @end Now i wanted the methodA to be...

How to create a UITableView with editable components?

Hi I was wondering how to create a UITableView with editable components. If you look at the network settings in the iphone, where you can enter the static ip address, etc. How to do this ? Thanks ...

warning: check_safe_call: could not restore current frame

What does the error warning: check_safe_call: could not restore current frame usually indicate? I've read in other places that it's a memory issue. Is it always a memory problem? I'm getting this error on the device (not the simulator). NSZombieEnabled shows nothing. If I Build and Debug, my debugger window shows nothing. The peak memor...