iOS Objective-C Push error message:SCHEDULED errorMessage: (null)

Hi guys,

I am now venturing into Backendless Push integration you will undoubtably be over joyed to hear ;-). As such I have the customary newbie issue… I am working through the ‘PushNotify’ iOS example project as well as following the docs for Push.

Ok, first here is my code and then some questions below:

AppDelegate (devices and Channel register perfectly, well they all show up in the DB GUI):

@interface AppDelegate () <IBEPushReceiver>

@end

@implementation AppDelegate

  • (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {

    [backendless initApp:APP_ID secret:SECRET_KEY version:VERSION_NUM];

    [backendless.messaging registerForRemoteNotifications];

    [backendless.userService setStayLoggedIn:YES];

    @try {

      [backendless initAppFault];
    
      
    
      BackendlessUser *user = backendless.userService.currentUser;
    
      NSLog(@"USER IS HERERERERERERE: %@", user);
    
      NSString *myChannel = user.objectId;
    
      NSString *info = [backendless.messagingService registerDevice:@[myChannel]];
    
      backendless.messagingService.pushReceiver = self;
    
      
    
      NSLog(@"viewDidLoad -> registerDevice: %@", info);
    

    }

    @catch (Fault *fault) {

      NSLog(@"didFinishLaunchingWithOptions: %@", fault);
    

    }

    return [[FBSDKApplicationDelegate sharedInstance] application:application didFinishLaunchingWithOptions:launchOptions];

}

  • (void)application:(UIApplication )app didRegisterForRemoteNotificationsWithDeviceToken:(NSData)deviceToken {

    [backendless.messaging didRegisterForRemoteNotificationsWithDeviceToken:deviceToken];

}

  • (void)application:(UIApplication *)app didFailToRegisterForRemoteNotificationsWithError:(NSError *)err {

    [backendless.messaging didFailToRegisterForRemoteNotificationsWithError:err];

}

  • (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo {

    [backendless.messaging didReceiveRemoteNotification:userInfo];

}

  • (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult result))handler {

    [backendless.messaging didReceiveRemoteNotification:userInfo];

    handler(UIBackgroundFetchResultNewData);

}

ViewController method (for now I am just trying to send a Push to myself hence sending on my own channel):

  • (IBAction)myBuyingItemNudgeButton:(id)sender {

    NSString *myChannel = backendless.userService.currentUser.objectId;

    NSLog(@“THIS IS THE CHANNEL: %@”,myChannel);

    PublishOptions *options = [PublishOptions new];

    options.headers = @{@“publisher_name”:@“Panda”, @“ios-badge”:@“1”, @“ios-sound”:@“Sound12.aif”, @“ios-content-available”:@“1”};

    [backendless.messagingService publish:myChannel message:@“Hello Test” publishOptions:options deliveryOptions:[DeliveryOptions deliveryOptionsForNotification:PUSH_ONLY] response:^(MessageStatus *res) {

      NSLog(@"showMessageStatus: %@", res);
    

    }

    error:^(Fault *fault) {

      NSLog(@"sendMessage: fault = %@", fault);
    

    }];

}

Questions:

  1. I get this error when sending the push message: showMessageStatus: <MessageStatus> messageId: B67FE4B1-428A-BFF9-FFB7-515859A54E00, status: SCHEDULED errorMessage: (null) is there something wrong with my code?

  2. I am creating a channel for each user so they can be notified individually, is this the right approach? Basically what user1 wants to notify user2 of something they will simply get User2’s objectID and send a message on their channel… In theory anyway…

  3. WHY IS THE WORLD SO STRANGE… sorry that was just one of my random thoughts.

Regards

Steve

Hi Steve,

  1. Your “showMessageStatus” shows the successful result: “status: SHEDULED, errorMessage (null)”, did you get your message on a publishing device?

  2. If you would like to exchange the messages from many users (maybe chat or conference) you should use some common channel name.

Regards,
Slava

No I didn’t get any notifications… Nor do I see anything in the GUI regarding messages sent or scheduled…

Did you set sertificate (sandbox or universal) and provisioning profile? Check all your settings, compare them with our Messaging doc.

Try to publish pushes from your app dashboard, maybe something wrong is with your app settings?

The docs aren’t that unto date with the latest Xcode processes but I have tried to follow it to the letter. I am still working at it though so I will let you know if I need more help. Thanks again.

Ok still no luck. I have created completely new certs, provisioning profiles you name it so its all as it should be but… No push… I actually don’t even see any attempted messages in the Backendless GUI which I find strange. Even when trying to send one manually it says message scheduled and then nothing… I would expect to see something, right?

Make sure to attend my webinar this coming Tuesday. I’ll be discussing nothing but push notifications.

I will be on it mate. I have now registered. I will leave Push until then and continue on other tasks…

As a side note and I think you alluded to it in another post that the Doc’s for Push iOS will be updated, is that still the case? The whole process with apple has now been changed regarding how and where you use Provisioning profiles. I know they change their processes like the weather but its quite a significant difference from the docs at the moment, just some feedback. Also the examples don’t work as the code terms aren’t supported anymore and I think your API doesn’t use some of the references either.

I followed the docs as I am preparing for the webinar and all the information is accurate. There are a lot of details which can be missed if you do not pay attention (thank Apple for it).

The changes in our docs will be for signatures and code samples. The process remains the same.

I will wait to comment more until I see your Webinar, actually I will have to watch the rerun as I have an appointment at my sons school. Looking forward to seeing it though as I still can’t get Push to work!