How to overwrite a file with NSFileManager when copying?

I’m using this method to copy a file: [fileManager copyItemAtPath:sourcePath toPath:targetPath error:&error]; I want to overwrite a file when it exists already. The default behavior of this method is to throw an exception/error “File Exists.” when the file exists. There’s no option to specify that it should overwrite. So what would be the safest way … Read more

Difference between [NSMutableArray array] vs [[NSMutableArray alloc] init]

can someone tell me the difference in declare an mutable array with: NSMutableArray *array = [NSMutableArray array]; and NSMutableArray *array = [[NSMutableArray alloc] init]; Because in the beginning I was declaring all my arrays with alloc, and if in the end of a certain function I returned the array created with alloc, I had to … Read more

Lock-down iPhone/iPod/iPad so it can only run one app

We’d like to ‘lock-down’ an iPhone/iPod/iPad so that the user can only run one app (we’ve developed this app internally). I’m guessing we’d be looking at jailbreaking, and then replacing (?) the default Springboard app. Can we do this? If so, how? EDIT: iOS 7 now includes an ‘App Lock’ payload as part of the … Read more

Status bar and navigation bar issue in IOS7

I am migrating my application to iOS 7. For handing the status bar issue I have added this code if([[[UIDevice currentDevice] systemVersion] floatValue] >= 7.0f) { CGRect frame = self.navigationController.view.frame; if(UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone) { frame.origin.y = 20; } else { frame.origin.x = 20; } [self.navigationController.view setFrame:frame]; } This is working fine in normal case. If … Read more

Raising minimum iOS Deployment Target Version for App Update

Let’s say we have an application with a deployment target set to 3.0 and we want to raise the deployment target to 3.2. Normally, the App Store won’t let the App be installed on devices with an IOS version less then this, but what about devices which already had the App installed prior to the … Read more

List of known “Safari on iPad” differences over “Desktop Safari”

In recently testing a web application on Windows/Mac desktop browsers – and then on an iPad I noticed various differences in Safari that I wasn’t expecting. even though the version # is the same. I’d like to compose a list of those differences (for myself and others) to have as a developer reference. e.g. in … Read more

Getting a screenshot of a UIScrollView, including offscreen parts

I have a UIScrollView decendent that implements a takeScreenshot method that looks like this: -(void)takeScreenshot { CGRect contextRect = CGRectMake(0, 0, 768, 1004); UIGraphicsBeginImageContext(contextRect.size); [self.layer renderInContext:UIGraphicsGetCurrentContext()]; UIImage *viewImage = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext(); // do something with the viewImage here. } This basically moves to the top of the scroll view, and takes a screenshot of the … Read more