objective-c

Tidying up after exit on error?

I wonder if anyone could help me with a design/layout question. If you come to a point in your code where you want to stop execution and return an error how do you approach cleaning up? do you simply duplicate that code as I have done here, or is there another way? if(fileContents == nil) { NSLog(@"ReadError: %@", [fileError...

How to read the gsm modem messages in objective c?

Hello, I need the the cell-id information to display in my iphone app, the app sends AT commands to the modem but...I do not know how to read the modem messages. Please help me. ...

const vs static NSStrings in Objective-C

These lines are both in the implementation file above the @implementation declaration. NSString * const aVar = @"aVarStringValue"; static NSString *aVar = @"aVarStringValue"; As far as I understand, the second static is allocated once only within the lifetime of the application and this fact contributes to performance. But does this...

more detailed information about the exception in xcode

So I am trying to troubleshoot why adding an item to my dictionary causes an exception. It turns out that I used a NSDictionary instead of NSMutableDictionary. However the exception I saw... setobject format exception was no help at all. Where do you look in xCode to get detailed exception information? Or is this all that is given? ...

Objective-C/Cocoa threads and messaging conundrum

Hello, I have a problem that has been plaguing me for awhile now, I have come up with a solution which I will detail below, and although it seems to be working well I'm not super enthusiastic about it from a design point of view and I'm curious if anyone would have any recommendations about a better way to do this. Basically, I have a s...

Copying JSON response dictionary to plist

I have a dictionary containing a JSON response and a plist file. I want to update the values in my plist file with the JSON response values. How would I do this? ...

Downloading multiple items in package

I need to allows users to download multiple images in a single download. This download will include an sql file and images. Once the download completes, the sql will execute, inserting text into an sqlite database. This text will include references to the download images. The text and images are rendered in a UIWebView. What is the ...

Comparing dates in Cocoa

hi i want to know how to get current date? i want to compare current date with a date i m fetching from a plist files using following code. NSDate *expDate = [licenseDictionary objectForKey:@"Expires"]; for comparison i m using the following code if([curDate compare:expDate] == NSOrderedAscending ) but its not working. can anybo...

Vibrate when UialertviewAppears iphone sdk?

Currently i am playing a simple beep.mp3 file when alertview appears i am using avaudioplayer and set an indefinite loop to play beep until alert dismisses.Now i want to vibrate continuously when alertview appears with beep until user dismisses alert.how do i do this? ...

What is the range for the DATE type in Core Data?

I'm putting together an application that will require the recording of dates as far back as the BC range; can Core Data's date type handle this, or do I need to define another entity to properly record and format dates? ...

How can I get the timezone of given gps coordinates on iPhone?

My question is simple. I have the GPS coordinates of a place and I need to know, in what time zone (and daylight saving settings) is on that place. Is any easy solution for this problem in objective c? ...

want to fetch the friends list of facebook thorough fbconnect in iphone using objective-c ?

how to fetch the friends list of facebook in iphone through fbconnect in objective-c? I am using this code (void)getUserName { NSString *fql = [NSString localizedStringWithFormat: @"SELECT uid FROM user WHERE is_app_user = 1 AND uid IN (SELECT uid2 FROM friend WHERE uid1 = %lld)",[FBSession session].uid]; NSDictionary* params = ...

How to set the cell.imageview frame

I have table view in which I want my Image view to reset the frame I used the following code: [[cell imageView] setFrame:CGRectMake(0,0,32,32)]; But nothing is working Please let me know how to resize the default imageView section Thanks ...

Displaying fixed and editable items in a Source List

Background I am creating a Source List for my application and I want it structured in a way similar to that of iTunes, with two types of items: "Fixed" items – these do not change and can't be moved around – at the top Editable items underneath, which can be changed by the user – moved around, renamed etc (in the iTunes example, like ...

Having problem in copying a dictionary to a specified location

I am trying to copy my root dictionary to an already set path by using the following statement: [rootObj writeToFile:writableDBPath atomically:TRUE]; But the problem is that it is not able to copy rootObj at the specified location. rootObj is a mutable dictionary of capacity 4 with 3 key-value pairs. writableDBPath also has a set val...

List of iPhone Applications that support openURL:

Is there a definitive (or otherwise) list of schemes that iPhone Apps support via: - (BOOL)openURL:(NSURL *)url ...

Functions in Objective-C

I am trying to write a function which returns a string created from two input strings; but when I try the function declaration NSString Do_Something(NSString str1, NSString str2) { } the compiler gets sick. (Worked fine for a different function with int arguments.) If I change the input arguments to pointers to strings, i...

UIView Does Not Rotate

I have the following code in a UIViewController Notepad *notepad = [[Notepad alloc] initForNewTopLevelTask:0 andDAO:self.dao]; [self.navigationController pushViewController:notepad animated:YES]; [notepad release]; The initForNewTopLevelTask:andDAO: method is: - (id) initForNewTopLevelTask:(int) theTableSize andDAO:(DAO*) aDAO { ...

How to determine image coordinates for a large cropped image within a UIImageView?

With regards to the iPhone SDK: I have a 512 x 512 pixel .png image, and I want to display it within a 200 x 200 pixel UIImageView WITH cropping (at native resolution, without zooming, fitting, or rotation). Is there a way to determine the image's coordinates that are visible inside the UIImageView? For example, if the image in the e...

NSXML replacing "<" with "%lt;"

I see there are other questions related to this, but none using NSXML. So, I'm constructing an XML document from scratch using NSXML and when I create a NSXMLNode with a string value, all the "<" characters in that string are replaced with "& lt;" when I output the node, or save it to a file. Example: NSXMLNode *description = [NSXMLN...