Day-13 Flashcards
Parse GeoPoint
Parse is setup to allow you to easily incorporate locations into your data set
PFQuery
PFQuery has a restriction called whereKey:nearGeoPoint: that lets you query on a location based field
Using a nearGeoPoint constraint will limit results within 100 miles
PFSubclassing
subclassing PFObject makes it feel more like regular model objects and makes it so we can work with regular properties, instead of the subscripting
To use (.) notation instead of Strings @"unsafeString" and create PFObject
- Make a class that subclasses PFObject
- Make the class conform to the PFSubclassing protocol
- Implement the class method parseClassName on your class
- Import PFObject.h in your .m file
- Call [YourClass registerSubclass] in your app delegate before you call setApplicationID:clientKey:
Map Overlays
Overlays offer a way to layer content over an arbitrary region of the map
An overlay object, which is an instance of a class that conforms to the MKOverlay protocol. This object manages the data points of the overlay
An overlay renderer, which is a subclass of MKOverlayRenderer that does the actual drawing of the overlay onto the map
_ _ weak & _ _ strong
Make a controller weak then Strong in a block
Avoiding the retain cycle.
We only do this in a block that references self.
_ _weak typeof(self) bruce = self; (make the current controller weak because it has an strong reference originally)
//The block for completion that requires a strong reference to the self(controller) newReminderViewController.completion = ^(MKCircle *circle){ //make the controller strong again _ _strong typeof (bruce) hulk = bruce; };
Broadcast Pattern & Notification Center
The notification pattern is used to pass around information related to the occurrence of events
Each program, or app, has a default notification center you can access with [NSNotificationCenter defaultCenter]. Almost always you will be posting notifications to this center
A notification center delivers notifications synchronously. To send them asynchronously you will have to use a notification queue
1) addObserver:selector:name:object
deallocat it with:
2) removeObserver
Dangling pointer
Pointer to deallocated object that doesn’t live in the memory