Start a new topic

Delphi XE8 iOS push notification token error

I am develop Android and iOS application with Delphi XE8 using kinvey push notification

everything is fine with Android but not with iOS.

I got error while registering device on push server. I am able to register new user on kinvey but got this error when i try to register the device for push notification


Error

DeviceToken request failed : {NSLocalizedDescription = "no valid 'aps-environment' entitlement string found for application";}.



the error raised in iOS while doing the code below :


var

  loggedinUser:TBackendEntityValue;

  LoggedinUserJSONdata:TJSONArray;

begin


        PushEvents1.AutoActivate:=true; 

        PushEvents1.Active:=true;

        BackendUsers1.Users.LoginUser(username,password,loggedinUser,LoggedinUserJSONdata); 


        if loggedinUser.ObjectID <> '' then

        begin

          KinveyProvider1.UserName:=username;

          KinveyProvider1.Password:=password;

          PushEvents1.RegisterDevice;

          showmessage(loggedinUser.UserName +' '+loggedinUser.ObjectID);

          showmessage('Device registered on push server');

          Result := 1;

        end

        else

        begin

          showmessage('Unable to register on push server');

          Result := 0;

        end;




I think your missing something here, in rad studio there are two main bits you must consider when auto active and auto register are set to false in the object editor which is expected if all of your objects are on one form:.

You MUST first set:

1 : 

PushEvents.Active := True;

 

 this will retrieve the Device Token but Asyc so you must do the next part in the event: 


   

Form.PushEventsOnDeviceTokenRecieved(...)
begin

  PushEvents.RegisterDevice;

end;

  to check if the device is registered use the event:


 

Form.PushEventsOnDeviceRegistered(...)
begin

  //Do Something

end;

  

To keep autoactive and autoregister set to active and all the above simplified, I found the following works a charm (and logically speaking makes perfect sense too):

Have your KinveyProvider and BackendUsers object on your login screen, and then upon successful login, create the Form/DataModule containing the PushEvents which "uses" the Login form in the Implementation section, this will allow you to point the PushEvents.Provider property to the <YourLoginForm>.KinveyProvider object and you are good to go

Good afternoon Kliklabs,


Unfortunately we do not offer support for Delphi as it's not an SDK that we produced.   You would probably be able to get support for this and other issues from the vendor distributing this SDK.


Thanks,

Login or Signup to post a comment