objective-c

How do I add an activity indicator in navigation bar?

Hi all, I'm using activity indicator view in my app. When I click on a button, I want the activity indicator to display in the navigation bar for 10 seconds then automatically hide. I'm using the following code in view did load: CGRect frame = CGRectMake(0.0, 0.0, 25.0, 25.0); self.activity = [[UIActivityIndicatorView alloc] ...

Retaining rootViewController?

I wonder if someone can help me out with regards to the memory management in the code below. I am particularly interested in rootController, does it get retained when I do initWithRootViewController or does it instead (which is my guess) get retained with window addSubView: I am just curious what is happening ... - (BOOL)application:(UI...

Objective-C block not being released for background-only applications

I have an application that runs in the background only (by specifying LSBackgroundOnly in the info.plist file). The problem is, that all blocks that I run on parallel queues are not being released. The (simplified) code looks like below. Blubber is just some dummy class that holds an NSDate for testing. Also, it overwrites retain, rele...

2 NSDateComponents - is it same week?

Hi i have got a function with BOOL return value and 2 input (NSDateComponents *) parameters. My trouble is I have two NSDateComponents values and I want to know if the two date fall within the same calendar week. i tried the simplest solutions to solve problem, my idea was the following: - (BOOL)isFunctionName:(NSDateComponents *)com...

Registering for a NSFileHandleReadToEndOfFileCompletionNotification

Hello kind ladies and gentlemen :) I'm trying to figure out how to make this piece of code from a previous question work, but I'm stuck on the part on how to 'register' a NSFileHandleReadToEndOfFileCompletionNotification. This is my code: NSTask *topTask = [NSTask new]; [topTask setLaunchPath:@"/usr/bin/top"]; [topTask setArguments:[N...

Setting the nib file results to the simulator work, but the iPhone device not load.

I set the Target > info > property > main nib file as MainWindow, in the simulator, it works, but in the device, the screen black, and no "viewDidLoad" is called. What's wrong with that? Thank you. ...

Saving data to a plist file

Hi All, I am having a little trouble saving to a plist file, when i am reading the data i am using: - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { return amounts.count; } - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { //Cr...

NSInvalidArgumentException error in simple email application for iPad

I am trying to prepare a simple application to send an e-mail. I was using this example: http://blancer.com/tutorials/i-phone/76884/mail-send-from-ipad/ but, I am getting an error running the application on the iPad device. It works perfectly fine on the iPad simulator. The line of code it is crashing: [self presentModalViewControlle...

comparing the date in iphone

Hey gays , I have the date function.And I have to compare the previous date with current data in iphone For current date I have code:- NSDate* date = [NSDate date]; //Create the dateformatter object NSDateFormatter* formatter = [[[NSDateFormatter alloc] init] autorelease]; //Set the required date format [formatter setDateFormat:@"...

How do I save user preferences for my iPhone app?

The question title pretty much gives it away - I'd like my app to remember a few things. It's some sort of calculator, so it should save the last used values and some user selectable settings. Basically I'd like to save a handful of floats and BOOLs and load them again the next time the app loads. What's the best and easiest way to do ...

passing argument 1 of strlen from incompatible pointer type

I am taking values from array and saving it in linked list as follows: NSString *formataddr=[RestaurantList objectAtIndex:0]; node1->formattedAddress = (char*)malloc(strlen(formataddr)*sizeof(char)+1); where formattedaddress is char array. But I'm getting error passing argument 1 of strlen from incompatible pointer type Can anyo...

Retrieving the Apple Id (or some kind of account id) in Objective C

Hello I am writing a paid app for the store which gives you a 1 year subscription to some content. This means I need to store on my web service db, when the user first launches the application some kind of unique user id (Apple ID?), along with the date. I can then do validation to check if the subscription is still valid. I can see ...

return from incompatible pointer types

The below code generates the incompatible pointer type error: char *PLURAL(int objects, NSString *singluar, NSString *pluralised) { return objects ==1 ? singluar:pluralised;} I am new to objective-C and programming in general so can some one help me with this error? ...

Simple http post example in xcode?

Hi, I have a php webpage that requires a login (userid & password). I have the user enter the information into the app just fine.. but I need an example on how to do a POST command to a website. The apple example on the support site is rather complicated showing a picture upload.. mine should be simpler.. I just want to post 2 lines of ...

Overlaying a view overtop of a UITableView

Hello stackoverflow, So I am trying to create a search that returns a bunch of results to a UITableView. When the user selects one of the cells, I want to overlay a detail view of that result in a nice, concise window. This view needs to have some text, buttons and a photo. I was looking into hacking an alertview but read that that i...

iPhone/iPad/iOS: tricky use of tab bar controller

Hello, Trying to implement the following behavior on an iPad. I have a map-centric application which uses a tab-bar interface. The tabs at the bottom allow the user to choose between looking at the various different types of points that are marked on the map (e.g, think of the tab-bar items "food", "lodging" and "gas", where the "food...

Custom control in NSCollectionViewItem

I want to put a custom control inside the view for my NSCollectionViewItem. Lets say I have a custom NSView called BoxesView.BoxesView is just a view that draws a predetermined number of boxes in its view. That number of boxes is set in the init method. Lets say I set it to 8. When I load up the collection view, all the other controls ...

Webkit Memory Swapping in Objective-C

I have an instant messaging (gtalk, aim, etc.) client that uses webkit to render the view of messages similar to Adium. Several users who appear to be very active IM users say that the app starts using 200+ MB of ram after several hours of use. Is there anyway to swap the memory to disk for windows that are not active as to save the over...

Incompatible Objective-C types initializing 'struct NSNumber *', expected 'struct NSDecimalNumber *'

Hello, I have the below method in my project, and I get a compiler warning: Incompatible Objective-C types initializing 'struct NSNumber *', expected 'struct NSDecimalNumber * on the first line: - (IBAction)sliderValueChanged:(id)sender { // HERE IS WHERE THE WARNING OCCURS: NSDecimalNumber *tempNumber = [NSDecimalNumber number...

Pantomime = outdated. Sending and receiving mail framework

As I found out, Pantomime framework is outdated. I believe the newest realize came out in 2007. I'm getting a lot of compiling errors because of this. From the top of my head, I got about 1000 errors. So it's probably going to take a while to convert it to a newer version. What is another sending/receiving mail framework that is up to d...