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

Way to Prepopulate Core Data with Certain Data

Usually I populate my core data with data from internet. But say I want to prepopulate it with data without downloading it from internet. Say I want to store all cities, or all tags first. What would be the standard way to do so? Should I store the cities on plist? Should I hardcode inserting […]

Objective C wait until an asynch task has been processed

In my code, I am running a local server (CocoaHTTPServer). When the server receives a request, it creates a thread and passes control to a certain method ( – (NSObject<HTTPResponse> *)httpResponseForMethod:(NSString *)method URI:(NSString *)path, perhaps irrelevant here). I need to read a list of local assets and return the result. The API call ( [assetsLibrary […]

Why my NSDate Formatter can't convert correctly and returns null on device?

I have an NSDate Formatter that should create an NSDate from string and should return it formated. The problem is that the result of converting from String to NSDate is wrong, the bigger problem is that on iPhone OS 3.1.2 it returns null while in the simulator it returns a wrong date. //start formating date […]

Saving mapView.userLocation.location.coordinate.longitude into sqlite database

I want to insert the value returning from mapView.userLocation.location.coordinate.longitude into my sqlite3 database. I am not sure of its type. I cannot do it this way: sqlite3_bind_text(stmt, 1, [mapView.userLocation.location.coordinate.longitude floatValue], -1, nil); It gives “Cannot convert to a pointer type” error because longitude is not float, I guess. The type of field is FLOAT in […]

how to resign keyBoard as a firstResponder from a textView?

I want to resign the keyboard from the text view as a first responder.I want as soon as user hits the return key after editing in a textView the keyboard should resign.But I am not sure how should I do this???

Xcode “Application windows are expected to have a root view controller at the end of application launch” error

I am very new to this, and I am making my first app. When I try to run it, xcode says it was successful, but the simulator just gives me a black screen and I get this message. Here is my main.m code: @implementation ViewController @synthesize button; @synthesize text; – (IBAction)pushButton:(id)sender { CGRect webRect=CGRectMake(10, 10, […]

is epoll (epoll_wait, etc.) available for iOS?

I’m just embarking on porting some existing POSIX compliant code to iOS. From what I gather pthreads are available (good), but the compiler is not finding . Is epoll available for iOS?

ASIHTTPRequest build / link error

– (void)getFacebookProfile { NSString *urlString = [NSString stringWithFormat:@”https://graph.facebook.com/me?access_token=%@”, [_accessToken stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]]; NSURL *url = [NSURL URLWithString:urlString]; ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:url]; [request setDidFinishSelector:@selector(getFacebookProfileFinished:)]; [request setDelegate:self]; [request startAsynchronous]; } The above method (from www.raywenderlich.com) fails with the following error: Undefined symbols: “_OBJC_CLASS_$_ASIHTTPRequest”, referenced from: objc-class-ref-to-ASIHTTPRequest in FBFunViewController.o ld: symbol(s) not found collect2: ld returned 1 exit status […]

Circular UIView with multiple coloured border working like a pie chart

I am trying to set a circular avatar of a player of a game with a piechart representation on the avatar’s circular border. Player 1 – Wins 25% Lost 70% Drawn 5% cell.selectedPhoto.frame = CGRectMake(cell.selectedPhoto.frame.origin.x, cell.selectedPhoto.frame.origin.y, 75, 75); cell.selectedPhoto.clipsToBounds = YES; cell.selectedPhoto.layer.cornerRadius = 75/2.0f; cell.selectedPhoto.layer.borderColor=[UIColor orangeColor].CGColor; cell.selectedPhoto.layer.borderWidth=2.5f; cell.selectedBadge.layer.cornerRadius = 15; I have the UIImageView as […]

Compare 2 strings in objective-C

I wrote the following code: if (depSelectedIndice > -1 && comSelectedIndice> -1) { NSLog(@”depart elemet : %d “,depSelectedIndice); NSLog(@”depart elemet : %d “,comSelectedIndice); NSLog(@”ok1″); NSString *choosedDate =[NSString stringWithFormat:@”%@%@”,[deparatureDates objectAtIndex:depSelecif (depSelectedIndice > -1 && comSelectedIndice> -1) { NSLog(@”depart elemet : %d “,depSelectedIndice); NSLog(@”depart elemet : %d “,comSelectedIndice); NSLog(@”ok1″); NSString *choosedDate =[NSString stringWithFormat:@”%@%@”,[deparatureDates objectAtIndex:depSelectedIndice], [goingBackDates objectAtIndex:comSelectedIndice]]; NSLog(@”0000000000001″); […]