Issue with Stackmob and CoreData iOS

49 views
Skip to first unread message

Jan Wilhelm

unread,
May 3, 2013, 9:06:47 AM5/3/13
to stac...@googlegroups.com

Hi,


I use stackmob for iOS. I create a user with Facebook using 


[[[self appDelegate] client] createUserWithFacebookToken:[NSString stringWithFormat:@"%@",FBSession.activeSession.accessToken] onSuccess:^(NSDictionary *result) {

...

}


When I try to update something on SM. With


#pragma mark - Manage Geo Tags

- (void) createGeoTagWithTopic:(NSString*)topic withText:(NSString*)text andWithImage:(UIImage*)_image{

    

    // Grab the context

   NSManagedObjectContext *context = [[[self appDelegate] coreDataStore] contextForCurrentThread];

    

    /*

     Get the current longitude and latitude.

     */

    [SMGeoPoint getGeoPointForCurrentLocationOnSuccess:^(SMGeoPoint *geoPoint) {

        

        Geotag *geoTag = [NSEntityDescription insertNewObjectForEntityForName:@"Geotag" inManagedObjectContext:context];

        geoTag.location = [NSKeyedArchiver archivedDataWithRootObject:geoPoint];

        geoTag.geotagId = [geoTag assignObjectId]; //

        geoTag.topic = topic;

        geoTag.text = text;

        

        // Create the NSData representation of the UIImage object sent as an argument.

        NSData *imageData = UIImageJPEGRepresentation(_image, 0.7);

        

        // Convert the binary data to string to save on Amazon S3

        NSString *picData = [SMBinaryDataConversion stringForBinaryData:imageData name:@"someImage.jpg" contentType:@"image/jpg"];

        

        geoTag.image = picData;

        

        //asynchronous save

        [context saveOnSuccess:^{

            NSLog(@"Successful GeoTag save action ");

        } onFailure:^(NSError *error) {

            NSLog(@"Unsuccessful GeoTag save action with error %@", error);

        }];

        

    }onFailure:^(NSError *error) {

        NSLog(@"Error getting SMGeoPoint: %@", error);

    }];

    

    // [[[SMLocationManager sharedInstance] locationManager] stopUpdatingLocation];

}


The following exception is thrown... Any Idea what I'm doing wrong?


CoreData: error: Serious application error.  Exception was caught during Core Data change processing.  This is usually a bug within an observer of NSManagedObjectContextObjectsDidChangeNotification.  *** -copyWithZone: only defined for abstract class.  Define -[SMPredicate copyWithZone:]! with userInfo (null)

2013-05-03 14:56:47.866 XXXXX[3011:c07] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -copyWithZone: only defined for abstract class.  Define -[SMPredicate copyWithZone:]!'

*** First throw call stack:

(0x2193012 0x1fb8e7e 0x2192deb 0x1a82665 0x1ad92bc 0x1fccae9 0x2cb764 0x35cbad 0x1a794f9 0x21ed0c5 0x2147efa 0x19adbb2 0x26f163 0x308d2f 0x26a596 0x269869 0x23de38 0x215bafe 0x215ba3d 0x21397c2 0x2138f44 0x2138e1b 0x2d737e3 0x2d73668 0xefcffc 0x920d 0x22f5)

libc++abi.dylib: terminate called throwing an exception


Thanks for your support,

Jan
Reply all
Reply to author
Forward
0 new messages