Receiving iOS Push Notifications on Delphi 10 Seattle
Asked Answered
S

0

6

The main goal here is to generate and receive Push Notifications for iOS using Delphi 10 Seattle.

I'm trying to follow this video but so far I've been able only to successfully send push notifications.

There's this incredible tutorial that helped me to understand better about App ID's, Provisioning Profiles, Certificates, PEM files, SSL connections and so on. This is basically how I see it now (yes, thats a real board):

enter image description here

But the funny thing is about the Provisioning Profile that I need to link at Delphi. It must be the same reverse domain name as the APNS certificate.

I'm able to visualize the Provisioning Profile with Push Support I created at Apple's Member Center at Delphi's Tools > Options > Provisioning.

enter image description here

But I'm not able to see any Provisioning Profiles that doesn't belong to a iOS Team Provisioning Profile at Project > Options > Provisioning, even though the provided CFBundleIdentifier at Version Info matches the same Bundle Identifier (App ID) from Xcode.

enter image description here

I can only run the application if I include the Team Prefix on the Bundle ID, but I feel like I must be doing something wrong.

The notifications will only work if the application has the correct certificates linked to it.

And this is how I'm getting the application token:

procedure TFormPush.Button1Click(Sender: TObject);

var

    FormPush          : TFormPush;
    APushService      : TPushService;
    AServiceConnection: TPushServiceConnection;

    ADeviceID   : string;
    AdeviceToken: string;

begin

    APushService := TPushServiceManager.Instance.GetServiceByName(TPushService.TServiceNames.APS);

    AServiceConnection        := TPushServiceConnection.Create(APushService);
    AServiceConnection.Active := True;

    ADeviceID    := APushService.DeviceIDValue[TPushService.TDeviceIDNames.DeviceID];
    AdeviceToken := APushService.DeviceTokenValue[TPushService.TDeviceTokenNames.DeviceToken];

    ShowMessage(AdeviceToken);

end;

It took me a lot of effort to get here, but I'm still failing to receive the push notifications.

What are the possible mistakes I must be doing?

Skylar answered 4/12, 2015 at 11:35 Comment(1)
In my experience this can happen if your provisioning profile has expired or if you have multiple provisioning profiles (some of which have expired) in the keychain.Saiz

© 2022 - 2024 — McMap. All rights reserved.