Note that there are some explanatory texts on larger screens.

plurals
  1. POObjective-C Program Received Signal: "EXC_BAD_ACCESS" push notifications
    primarykey
    data
    text
    <p>I've been coding Objective-C for a whole 2 days. I have this problem:</p> <pre><code>//Notification methods - (void)application:(UIApplication *)app didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken { NSLog(@"didRegisterForRemoteNotificationsWithDeviceToken started with %@", deviceToken); const void *devTokenBytes = [deviceToken bytes]; self-&gt;registered = YES; //NSLog(@"didRegisterForRemoteNotificationsWithDeviceToken ended with %@", devTokenBytes); [self sendProviderDeviceToken:devTokenBytes]; } - (void) application:(UIApplication *)app didFailToRegisterForRemoteNotificationsWithError:(NSError *)error { NSLog(@"didFailToRegisterForRemoteNotificationsWithError started with %@", error); } - (BOOL)sendProviderDeviceToken:(void *)deviceToken { //NSLog(@"sendProviderDeviceToken started with %@", deviceToken); NSMutableURLRequest *request = [[NSMutableURLRequest alloc] initWithURL:[NSURL URLWithString:@"http://some_url//pushRegistration"]]; NSDictionary* dict = [NSDictionary dictionaryWithObjectsAndKeys:deviceToken, @"registrationId", @"06d746d0-e67e-11e0-911d-c42c0322474a", @"authenticationToken", @"apns", @"type", nil]; NSError *theError = NULL; NSData *theData = [[CJSONSerializer serializer] serializeObject:dict error:&amp;theError]; NSData *requestData = [NSData dataWithBytes:[theData bytes] length:[theData length]]; [request setHTTPMethod:@"POST"]; [request setValue:@"application/json" forHTTPHeaderField:@"Content-Type"]; [request setHTTPBody: requestData]; NSData *returnData = [NSURLConnection sendSynchronousRequest: request returningResponse: nil error: nil ]; NSString *returnString = [[NSString alloc] initWithData:returnData encoding: NSUTF8StringEncoding]; NSLog(@"returnData: %@", returnString); return YES; } </code></pre> <p>You probably recognize this example from Apple Dev Center. The problem is I get EXC_BAD_ACCESS signal when trying to reference deviceToken in sendProviderDeviceToken method.</p> <p>What am I doing wrong?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload