Hocam ne yazık ki ne yaptıysam netice alamadım. Hatta önce den butonla local bildirim yapıyorum ancak şu an onu da yapamıyorum.
Platform: Delphi Tokyo
Mac: Sierra 10.12.5
Platform Assistant Server Version 10.0.1.30 (PaServer 19)
Test Cihazı: iPad - iOS 10.3.2
XCode: Version 8.3.3 (8E3004b)
Yaptığım işlemleri sırasıyla yazıyorum.
1- Mac Anahtar Zinciri Erişimi uygulaması üzerinden Sertifika Yardımcısı>Sertifika Otoritesinden Sertifika İste.. adımı ile apple developer hesabına ait eposta adresi ile certSigningRequest uzantılı bir sertifika alıyorum. (Sertifika alırken sadece Kullanıcı e-posta adresini giriyorum. Diğer alanlara bir şey yazmıyorum)
2-https://developer.apple.com/ adresinde Certificates alanında iOS Development ve iOS Distribution için iki adet sertifika oluşturuyorum.
3-Devices alanına cihazımı kaydediyorum.
4-Identifiers alanında com.dfdsf.cxcd gibi bir App IDs oluşturuyorum ve burada ek olarak Push Notifications alanını işaretliyorum.
5-Daha sonra oluşturduğum App IDs seçerek Edit tıklayıp Development SSL Certificate ve Production SSL Certificate alanlarının her ikisi için 1. adımdaki sertifikaları yükleyip Apple Push Services ve APNs Development iOS sertifikalarını oluşturuyorum.
6-Provisioning Profiles alanında Develepor için, AdHoc için ve AppStore için üç tane sertifika oluşturuyorum.
7-Akabinde Xcode üzerinde ilgili menüleri kullanmak suretiyle developer hesabımı açıyorum ve sertifikaları dahil ediyorum.
8- Akabinde
https://developer.apple.com/ adresindeki tüm sertifikalarımı indirerek Anahtar Zinciri Erişimi uygulamasını açıp Dosya>Öğeleri içe aktar seçeneği ile içeri aktarıyorum.
Anahtar Zinciri Erişimi uygulamasını kontrol ediyorum ve herhangi bir çift sertifika yok. Zaten bu işlemden önce ilgili tüm sertifikaları siliyorum
9-PaServer aracılığyla sorunsuz bir şekilde bağlanıp Mac, Similatör ve iOS'a ait tüm sertifikaları Delphi üzerine ekliyorum.
10- Delphi üzerinde hem standart PushEvents1 ve KinveyProvider1 uygulamaları aracılığıyla hemde aşağıdaki kod ile denediğimde netice alamıyorum. Şu an local bildirim bile çalışmıyor.
CFBundleIdentifier alanına ilgili com.. ile başlayan uzantıyı ekledim.
FMLocalNotificationPermission alanı true
UIBackgroundModes alanında da remote-notification alanını seçmeme rağmen ne yazık ki netice yok.
--------
procedure TForm_home.OnServiceConnectionChange(Sender: TObject;
PushChange: TPushService.TChanges);
begin
// Do something if the service connection change;
end;
- - - - - - - - - - - - - - - - - -
procedure TForm_home.OnReceiveNotificationEvent(Sender: TObject;
const ServiceNotification: TPushServiceNotification);
const
FCMSignature = 'gcm.notification.body';
GCMSignature = 'message';
APNsSignature = 'alert';
var
MessageText: String;
aObj: TJSONValue;
begin
{$IFDEF ANDROID}
aObj := ANotification.DataObject.GetValue(GCMSignature);
if aObj <> nil then
MessageText := aObj.Value;
else
MessageText := ServiceNotification.DataObject.GetValue(FCMSignature).Value;
{$ELSE}
aObj := ServiceNotification.DataObject.GetValue(APNsSignature);
if aObj <> nil then
MessageText := aObj.Value;
{$ENDIF}
ShowMessage(MessageText);
ShowAndroidNotification(MessageText, 0);
end;
- - - - - - - - - - - - - - - - - - - - -
procedure TForm_home.ShowAndroidNotification(MessageText: string;
NotificationNumber: integer);
var
NotificationCenter: TNotificationCenter;
Notification: TNotification;
begin
NotificationCenter := TNotificationCenter.Create(nil);
try
Notification := NotificationCenter.CreateNotification;
try
Notification.Name := MessageText;
Notification.AlertBody := MessageText;
Notification.Title := MessageText;
Notification.EnableSound := false;
Notification.Number := NotificationNumber;
NotificationCenter.ApplicationIconBadgeNumber := NotificationNumber;
NotificationCenter.PresentNotification(Notification);
finally
Notification.DisposeOf;
end;
finally
NotificationCenter.Free;
NotificationCenter.DisposeOf;
end;
end;