objective-c

How to fix sleep on objective C sdk 4.0?

I have a warning on objective c for iphone it says "implicit declaration of function 'sleep'" All I have is a sleep(1); for the splash in the applicationDidFinishLaunching I didn't have this problem in prior versions of the sdk I know is just a warning, but I had problems before with apple for not having 100% success Thanks for every...

Cannot get to NSErrors from unit tests

Hello, I am setting up unit tests to run methods that should generate an NSError. For some reason, I can't get to the NSError from the unit tests. I created a sample method to test this, and it still doesn't work. What am I doing wrong? Implementation file: - (BOOL)createAnError:(NSError **)error { NSMutableDictionary *errorDet...

setting dynamic x coordinate of second lable in xcode objective c

Hi Guyz, i have a problem that i have two lables, 1) will contain a long text 2) this will be just More button (link) so i want that when the first text ends then the second label starts right from where it end. but the problem is that the text is variable so i could not find any way to make it dynamic. example text of first row "t...

Change the toolbar title in UIImagePicker

Hello, I created an iPhone application which can take photo and allow the user to edit them (moving and scaling), by setting the property "allowsEditing" to YES. My problem is that while editing, the bar at the bottom has a too long title (in french). http://uppix.net/d/8/8/12ee1d66af14d3f99ea65d7b6091b.png So do you have any idea o...

ASIHTTPRequest dealloc and EXC_BAD_ACCESS problem

Hi, I'm using an array of ASIHTTPRequest wrappers (AsyncImageLoader) to download images for cells in a UITableView. I'm having problems handling ASIHTTPRequests lifetime. If I release them, I end up having a EXC_BAD_ACCESS if I keep scrolling up and down while they try to load images. Here's what my wrapper looks like. self.request ha...

Race Condition (?) In iPhone Temp File Writing

Hello there, I'm creating some temporary files in the iPad simulator. To test my file creation, I create the file and then read it back. Here's some code to show this: -(NSString *) writeToTempFile:(UIImage*) image{ NSString *path = [self createTemporaryFile]; NSLog(@"path: %@", path); NSData *data = UIImageJPEGRepresentation(image, 1)...

Object serialization in XML format using Obj-C / iPhone SDK

Hi folks, I have an iPhone App that uses a relatively small amount of data. I'd like to save the data in the XML format and be able to load this in memory to Objective-C objects. I'd like to use iPhone SDK facilities like NSPropertyListSerialization or writeToFile:atomically: classes and methods. The NSPropertyListSerialization documen...

NSPredicate to filter array of words to array of letters

I am trying to make "weighted" list of letters as words are created. I have a massive list of words in an NSArray. For example I am trying to acquire a new NSArray filled with just the 3rd letters of all the words based off the first two letters entered. So far I have... NSArray *filteredArray; if (currentWordSize == 0) { filteredA...

Exclude files from application backup

Is there a way to exclude some of the files in your application bundle from being backed up to the user's computer? I have a photo browsing application that allows you to store photos/videos locally, when a user goes sync their device and the application is backed up its taking a really long time since its backing up all the locally sto...

Problem with a countdown in the background in iOS

Here's my code (simplified a bit). I have an NSTimer firing every second which subtracts one from the countervariable. When the app goes in the background, I'm stopping the counter and saving the time the counter would reach zero into an NSDefault value. However, when restoring the app from background, when I subtract the current time ...

unrecognized selector AGAIN

There are LOTS of iphone-related questions of this type. I know; I read them until I wasn't learning anything new, all in an effort to avoid (a) posting and (b) looking mighty green. @interface CommonCostingClass : NSObject { } -(void) theCCC; @end That's the whole thing. As minimal as I could make it. I've even resorted to UIView...

Iphone Drag'n'Drop MapKit generates "unrecognized selector sent to instance" exception

Hello everybody. Recently downloaded "MapKitDragAndDrop 3" package (http://github.com/digdog/MapKitDragAndDrop) to use in my app. The demo project runs smoothly. Both DDAnnotation.h+m and DDAnnotationView.h+m files were imported as they are. The method of calling the class was also copied/pasted. DDAnnotation *annotation = [[[DDAnnota...

Audio only with MPMoviePlayerController on iO4

When I play a video doing this: NSString *videoFilepath = [[NSBundle mainBundle] pathForResource:@"bacon" ofType:@"mov"]; NSURL *videoURL = [NSURL fileURLWithPath:videoFilepath]; MPMoviePlayerController *movie; movie = [[MPMoviePlayerController alloc] initWithContentURL:videoURL]; [movie play]; on 3.2, it works pef...

How to perform equivalent of AppleScript "copy" command from Scripting Bridge?

Is there a way to do a remote copy within a container from Scripting Bridge? In AppleScript, this looks like "copy [element] of [container] to [location in container]". For example, in the context of a tell to a TextEdit document, you can "copy first paragraph of its text to end of its text" to copy the first paragraph to the end of th...

go back 1 view in UINavigationController?

Is there a method to go back 1 view in the stack on a UINavigationController? Or to a view with a specific title? ...

Detecting if an NSString contains...?

How can I detect if a string contains a certain word? For example, I have a string below which reads: @"Here is my string." I'd like to know if I can detect a word in the string, such as, "is" for example. THank you in advance ...

UIImagePickerController: how to take >1 photo?

I've been trying to build a UI that's as similar as possible to the built in iPhone 'camera' app as possible. Necessarily I've been using the UIImagePickerController class. It imposes on me two constraints that I wish to overcome... I'd like to be able to take more than one photo (currently mine takes one then comes to a sudden stop. ...

New Core Data entity identical to existing one: separate entity or other solution?

Overview: I'm designing a restaurant management application, and I have an entity called Order which has Items. Since a restaurant can operate for many years, with many thousands of completed 'orders', and in the interest of making the networking side of my application easier and keeping the database fast, I want to introduce the concept...

Navigation Controller pushing my view twice?

I have a UITableViewController that is pushing some views when clicking on a cell: switch(indexPath.row) { case kFollowerSectionUpdatesCountRow: stockTwitsView.reloadUpdates = TRUE; stockTwitsView.showHomeButton = TRUE; //** reversed, true means hide the button ...

NSUserDefaults not working on iPhone 4.0 device?

Hello all i am using NSUserDefaults to save data from the app and when the user leaves the app and then come back to it all the values are restored. the thing is that it does save the values while the app is running in background mode. but when i close the app from multitasking and re-open it the app comes back as new with no values sa...