Latest 0.0.3
Homepage https://github.com/guaranatech/GRNPFObject
License MIT
Platforms ios 8.0, requires ARC
Dependencies Parse
Authors

This library has been created by www.guarana.io

This is a library to solve all the crashes due to Parse’s (arguably) poor handling of nils.
It wraps PFObject & co. to always check for nil, before passing them over to Parse.

Installation

Cocoapods

pod 'GRNPFObject', '~> 0.0.1'

Click here more information about cocoapods and how to install it

Manual

Drag the folder GRNPFObject into your project.

Usage

PFQuery cannot do a comparison query for type: (null)

Problem

Consider, for example, the following query:

PFQuery *query = [PFComment query];
[query whereKey:@"post" equalTo:post];
[query findInBackground];

If post == nil, the call to findInBackground would crash, due to a NSInvalidArgumentException.

Solution

When subclassing your PFObject, sublass GRNPFObject instead.

@interface PFComment : GRNPFObject <PFSubclassing>

Don’t forget to import the headers.

If you don’t like subclassing PFObject (I hear you, my friend), then this library will work as long as you use PFSafeQuery:

PFQuery *query = [PFSafeQuery queryWithClassName:@"Comment"];

NSInvalidArgumentException: Can’t use nil for keys or values on PFObject. Use NSNull for values.

Problem

You will get this crash when you are trying to insert a nil into one of your PFObject. This can happen, for example, when you are expecting a facebook_id, but you don’t get one.

Solution

No need to do anything. Your nil will be converted into [NSNull null]. This will show up as undefined in your Parse table.

Latest podspec

{
    "name": "GRNPFObject",
    "version": "0.0.3",
    "summary": "This is a drop-in library to solve all the crashes due to Parse's (arguably) poor handling of `nil`s.",
    "description": "This is a library to solve all the crashes due to Parse's (arguably) poor handling of `nil`s.nIt wraps `PFObject` & co. to always check for `nil`, before passing them over to Parse.",
    "homepage": "https://github.com/guaranatech/GRNPFObject",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "Guaranu00e1 Technologies": "[email protected]"
    },
    "social_media_url": "http://twitter.com/GuaranaTech",
    "platforms": {
        "ios": "8.0"
    },
    "source": {
        "git": "https://github.com/guaranatech/GRNPFObject.git",
        "tag": "0.0.3"
    },
    "source_files": [
        "GRNPFObject",
        "GRNPFObject/**/*.{h,m}"
    ],
    "requires_arc": true,
    "dependencies": {
        "Parse": []
    }
}

Pin It on Pinterest

Share This