objective-c

Is there an automatic release with setTitle (UIButton class) ?

Hello, As everyone knows, setTitle automatically retains the string passed as a parameter. When the button caption needs to be changed, I guess that it is necesary to release the current (old) string before setting the new one. I wonder what is the most elegant way to dot it. See my code sample (here, getPlayerHandFromGame method produ...

'If' conditional works with NSLog but not without? Objective-C

Hello. I hope this question is some what self explanatory. This works, returns YES and NO: note the NSLog()'s - (BOOL)dateTestCourse:(NSDictionary *)listing { BOOL result = ([self exammpleTest] == 0) ? YES : NO; if (result) { NSLog(@"Passes Test"); return YES; } NSLog(@"Failed Test"); return NO; } ...

How to make an NSURLRequest login NOT in plain text

Whats the best way to make this a more secure and less obvious security risk? NSString *loginIdentification = [NSString stringWithFormat:@"user=%@&pass=%@&", userNameLogin, passWordLogin]; addressVariable = [NSString stringWithFormat:@"%@/%@", url, loginIdentification]; addressVariable = [addressVariable stringByAddingPercentE...

How I update a scroll view?

I, sorry for my english I'm not very good, I code in objective-c, I try to set text in a uiscrollview and update the content of the scrollview right after. I have a loop and I set the text with the method [uiscrollview setText:] in that loop, but the text is only displayed in the scrollview at the end of the loop... thanks Alex ...

How to use va_args to pass arguments on (variadic parameters, elipsis)

I can't get my head around the syntax for multiple arguments in Objective-C. I have seen this question, but the answer hasn't helped me (yet). Here is my code (actually I will want to eventually pass to NSString stringWithFormat, but getting an NSLog to work would be good enough for now): - (void)applicationDidFinishLaunching:(NSNotifi...

Objective-c mingw in windows

What tutorials cover how to use Objective-C in Windows? I heard about mingw, but I couldn't configure it. I would like to only create command-line programs because I heard that there is no iPhone/iPad simulator for Windows and I would like to learn Objective-C. ...

How are these ObjC declarations different: ie what is this really doing?

I'm trying to understand what this is doing in each case. Can someone explain what the first case is doing in detail and how it differs from the second? Thanks // :) //declare in first case NSManagedObjectModel *mom(); NSManagedObjectModel *mom() { static NSManagedObjectModel *mom = nil; //implementation goes here... return mom; } ...

Making sure that objects in nibs are initialized before applicationDidFinishLaunching

Hello, and thanks for taking a look at my problem. i have two view controllers in my app and each has its own nib file. an instance of controller1 is stored in MainWindow.xib and an instance of controller 2 is in Controller1.xib. is there a way to make sure that controller 2 is initialized before the app delegate is sent applicationD...

EXC_BAD_ACCESS when using SQLite (FMDB) and threads on iOS 4.0

Hello, I am using FMDB to deal with my database which works fine. The app uses a background thread which is doing some work and needs to access the database. At the same time the main thread needs to run some quieries on the same database. FMDB itself has a little locking system, however, I added another to my classes. Every query is o...

Where can I find older versions of the iPhone sample code

I'm trying to find some of the old iphone sample code, becuase it seems like apple will only let you download the most recent versions (compatable with iphone 3.2 +). Is there an archive of these someplace, is there a reason that they remove the older versions of there samepl code? ...

NSUserDefaults won't save NSDictionary

I'm writing an application which uses NSUserDefaults as the data storage mechanism, and am hitting a problem when trying to save data (that conforms to the Property List protocols): + (BOOL)storeAlbum:(Album *)album { NSUserDefaults *prefs = [NSUserDefaults standardUserDefaults]; NSMutableDictionary *albums = (NSMutableDictionar...

Trouble with OCUnit - Instantiating custom data type

Hi, I have successfully set up unit testing for an XCode version 3.2.2 project with the iPhone SDK version 3.1.2. I have created a class, "Callout" which I am attempting to instantiate within the context of a unit test. The class has a method, -(id) initWithDictionary:(NSDictionary*)calloutDict includesSong:(BOOL)hasSong lastUpdate:(N...

objective-c : iphone programming error (SIGABRT)

this is the error show in console : objc[1589]: Class Account is implemented in both /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.0.sdk/System/Library/PrivateFrameworks/Message.framework/Message and /Users/hugohnery-garon/Library/Application Support/iPhone Simulator/4.0/Applications/E6874214-2DFA-4446-...

Help with an iPad iBookstore-like Interface

I am building an iPad application that needs to list books in a manner similar to the way Apple does it in their iBookstore application and how Marvel does it in their iPad application. I'm not talking about the main featured rotating images but rather the book listing below that. My question is looking at the book list, how are they b...

Sorting nil-valued rows always to bottom in nstableview column

Hi there, I have an nstableview in my application containing several columns. When I click on one column header in order to have it sorted ascending, rows with a nil-value in that column are being sorted on top followed by non-nil-valued rows in ascending order. If I reclick on the same column, first the non-nil-valued rows are being sh...

iPhone Application Delegate variable is not being retained

I am having a very odd issue retrieving/retaining a variable in my iPhone application delegate (AppDelegate). Initially, I can step through and see that my values are passed to logfile (the NSString variable in question), but when logfile is retrieved from another class (see the code below), it faults. Here is my AppDelegate.h file: ...

UIView setBounds UIScrollView hell!!

I have a bunch of 'rowviews' that I want to put in a vertical scroll view. I have created this rowView view as a separate nib in IB. They are sized at 1024/200 (ipad). Now I want to put them one by one in my parent UIScrollView. I tried a simple [vScroll addSubview:rowView] but this puts them overtop of eachother (I made the rowview tran...

Relaunching a cocoa app

I have an application that checks its command line parameters and stores values in persistent stores. One of those is a password that I don't want sticking around for people to see with 'ps' and friends. The approach I'm currently looking at is to, after I've stored the values I need, relaunch the process without the command line param...

How to post NSNotificationCenter if orienation is landscape?

Hello, I would my view controller to post a notification used NSNotificationCenter if the orientation is landscape. I'm currently doing this: - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { return YES; if (interfaceOrientation == UIInterfaceOrientationLandscapeLeft || interfaceOrien...

How to release an instance variable which will be returned to the caller?

-(NSMutableArray *)processResult:(NSArray*)matchArray removeString:(NSString *)removeStr{ NSString *newLink; NSMutableArray *result = [[NSMutableArray alloc] initWithCapacity:[matchArray count]]; //doing sth to result return result; } In this scenario, as the result variable will be returned to the call...