Wednesday, November 27, 2013

Map and HTTP Stuffs

I made a QONQR API app thing. First time using iOS map and HTTP APIs.

Here was a few gotcha's I ran into, in reverse order.

Setting the map pins is done with MKAnnotation protocol. A protocol is like, a set of methods that an object has to abide by in order to pose as some certain thing or another, I think. To get the map pins to show up I had to make a Map Pin class as described here.

Monday, November 4, 2013

Sunday, November 3, 2013

floating point comparisons in CoreData fetch requests

I had to use a predicate like this in order to compare a test value to another one in my predicate so that things were working good.

[NSPredicate predicateWithFormat:@"abs(value - %f) < 0.01", test];

Here was the question I asked:

http://stackoverflow.com/questions/19713261/how-would-you-make-a-predicate-in-coredata-to-search-for-a-float-within-a-tolera

I guess it turns out you can use SQLIte functions like abs() and cetera for more shit. Yay woo. I was led to this because the BETWEEN function doesn't work with floats, but crashes. You get the "unrecognized selector nsnumber" type error.

See also:

Predicate Programming Guide

Getting Stuck

Predicate Format String Syntax

Creating Predicates