iOS Development is easy with XCode, Swift3, UITableView, cocatouch, let's build iPhone, iPad and Macbook Applications.

Under what conditions is @synthesize automatic in Objective-c?

Under what conditions is @synthesize automatic in Objective-c? Perhaps when using LLVM 3.0 and up? From reading around the net it seems like @synthesize is unnecessary starting with Xcode 4. However I’m using Xcode 4 and receiving warnings when I don’t @synthesize a property. Some of the responses to Why don't properties get automatically synthesized […]

How do I set up a NSPredicate to look for objects that have a nil attribute

I have a ManagedObject class, and one of the members of the class is a NSDate. I would like to display all objects of the class for which the date is NOT set. I tried using a predicate like this: NSPredicate *predicate = [NSPredicate predicateWithFormat: @”(date = NIL)”]; But I still get objects where the […]

How can I 'cut' a transparent hole in a UIImage?

I’m trying to cut an transparent square in a UIImage, however I honestly have to idea where/how to start. Any help would be greatly appreciated. Thanks!

MKPolygon area calculation

I’m trying to make an area calculation category for MKPolygon. I found some JS code with a link to the algorithm: It says: Here is my code, which gave a wrong result (thousands times more than actual): #define kEarthRadius 6378137 @implementation MKPolygon (AreaCalculation) – (double) area { double area = 0; NSArray *coords […]

Bad URL when requesting with NSURL

I’m trying to request this kind of URL in iPhone 4.0 SDK (access token slightly modified because you don’t really need to see it):|8cb9e8408d2685cef853cd80.9-747882379|UGu5NvcAHiXuGEGzkq&format=json&limit=40&until=1286619821 But I got this message: Failed with error: Error Domain=NSURLErrorDomain Code=-1000 “bad URL” UserInfo=0x9e657a0 {NSUnderlyingError=0x9e656a0 “bad URL”, NSLocalizedDescription=bad URL} When I copied and pasted in Safari or Chrome, it works. […]

NSTask not picking up $PATH from the user's environment

I don’t know why this method returns a blank string: – (NSString *)installedGitLocation { NSString *launchPath = @”/usr/bin/which”; // Set up the task NSTask *task = [[NSTask alloc] init]; [task setLaunchPath:launchPath]; NSArray *args = [NSArray arrayWithObject:@”git”]; [task setArguments:args]; // Set the output pipe. NSPipe *outPipe = [[NSPipe alloc] init]; [task setStandardOutput:outPipe]; [task launch]; NSData *data […]


I set up an Entity using the Xcode .xcdatamodel file editor. I created an entity called Person, added a few attributes, then generated a .m file to represent it. That all works fine. Now when I go to write a line of code like: Person * person = (Person*)[NSEntityDescription insertNewObjectForEntityForName:@”Person” inManagedObjectContext:managedObjectContext]; And I get: Terminating […]

Checking for equality in Objective-C

How do i check the key in dictionary is same as the string in method parameter? i.e in below code , dictobj is NSMutableDictionary’s object , and for each key in dictobj i need to compare with string. How to achieve this ? Should i typecase key to NSString?? -(void)CheckKeyWithString:(NSString *)string { //foreach key in […]

Semicolon after the method name in Objective-C implementation file

– (void) designImageViewNow; { //some code here } Is it correct to write semicolon ; just after the method name before body brackets in the implementation file objective-c. Would this work? As I am working on an iPhone app, I put the semicolon after the method name in one of my custom class by mistakenly. […]

Iphone : How to Display Document Directory images in Image View?

In a App images stored in Document Directory Folder, I wanted Particular image display in Image view, How that image Display in Image View from the Document Directory ?