ios - How to set a NSData object to PFObject? -
i added column location
of object
type in _user
class. i'm assuming means nsdata
type in ios. not sure what's correct way of doing this. i'm getting error when assigning nsdata self.location. appreciated.
error domain=parse code=111 "invalid type key location, expected map, got bytes" userinfo=0x1740f9a00 {code=111, originalerror=error domain=nsurlerrordomain code=-1011 "the operation couldn’t completed. (nsurlerrordomain error -1011.)", temporary=0, error=invalid type key location, expected map, got bytes, nslocalizeddescription=invalid type key location, expected map, got bytes}
byfuser.h
#import <parse/parse.h> @interface byfuser : pfuser <pfsubclassing> @property (nonatomic, strong) nsdata *location; @property (nonatomic, strong) cllocation *cllocation; @end
byfuser.m
@implementation byfuser @dynamic location; + (void)load { [byfuser registersubclass]; } - (void)setcllocation:(cllocation *)cllocation { if ([cllocation iskindofclass:[cllocation class]]) { self.location = [nskeyedarchiver archiveddatawithrootobject:cllocation]; } } - (cllocation *)cllocation { if ([self.location iskindofclass:[nsdata class]]) { return [nskeyedunarchiver unarchiveobjectwithdata:self.location]; } return nil; } @end
make column geopoint type , access ios using pfgeopoint class. pfgeopoint can instantiated cllocation.
Comments
Post a Comment