Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Cross-Platform-Entwicklung (https://www.delphipraxis.net/91-cross-platform-entwicklung/)
-   -   [UILocalNotification] Wie auf Inhalt zugreifen ? (https://www.delphipraxis.net/177148-%5Builocalnotification%5D-wie-auf-inhalt-zugreifen.html)

RWarnecke 19. Okt 2013 22:19

[UILocalNotification] Wie auf Inhalt zugreifen ?
 
Hallo zusammen,

wie kann ich auf den Inhalt einer Variable vom Typ UILocalNotification zugreifen ?

himitsu 19. Okt 2013 22:44

AW: [UILocalNotification] Wie auf Inhalt zugreifen ?
 
Hat diese Klasse/Interface denn keine Property/Methoden?

https://developer.apple.com/library/...Reference.html

RWarnecke 19. Okt 2013 23:02

AW: [UILocalNotification] Wie auf Inhalt zugreifen ?
 
Zitat:

Zitat von himitsu (Beitrag 1232534)
Hat diese Klasse/Interface denn keine Property/Methoden?

Doch hat Sie, aber alle Versuche die ich bis jetzt unternommen habe, brachten mir nur Access Violations. Deshalb meine allgemeine Frage, wie ich auf den Inhalt von UILocalNotification zugreife.

daywalker9 19. Okt 2013 23:12

AW: [UILocalNotification] Wie auf Inhalt zugreifen ?
 
Zeig doch mal deinen Code.

RWarnecke 19. Okt 2013 23:17

AW: [UILocalNotification] Wie auf Inhalt zugreifen ?
 
Delphi-Quellcode:
  if Assigned(FNotification) then
  begin
    TUILocalNotification.Init(FNotification, tmpNotificationP);
    tmpDictionary := TUILocalNotification.Wrap(tmpNotificationP).userInfo; // Access Violation
  end;
Delphi-Quellcode:
var
  tmpKeyArray: NSArray;
  tmpNotificationP: Pointer;
begin
  M_1.Lines.Add(RemoteNotifications.DeviceToken);
  if Assigned(FNotification) then
  begin
    TUILocalNotification.Init(FNotification, tmpNotificationP);
    M_1.Lines.Add('OnLaunchNotification : ' + #13#10 + TUILocalNotification.Wrap(tmpNotificationP).userInfo.description.UTF8String);  // Access Violation
  end;
end;
Die Variable FNotification ist vom Typ UILocalNotification.

Edit 1:
Selbst eine einfache Zeile wie diese hier bringt eine Access Violation :
Delphi-Quellcode:
var
  UserInfo: NSDictionary;
begin
  if Assigned(FNotification) then
  begin
    UserInfo := FNotification.userInfo;
  end;
end;

daywalker9 19. Okt 2013 23:32

AW: [UILocalNotification] Wie auf Inhalt zugreifen ?
 
Wenn deine Variable vom Typ UILocalNotification ist, brauchst Du nicht per Init/Wrap deine Variable erneut auf diesen Typen casten.
Du kannst einfach von FNotification die Felder abgreifen

RWarnecke 19. Okt 2013 23:33

AW: [UILocalNotification] Wie auf Inhalt zugreifen ?
 
Zitat:

Zitat von daywalker9 (Beitrag 1232538)
Wenn deine Variable vom Typ UILocalNotification ist, brauchst Du nicht per Init/Wrap deine Variable erneut auf diesen Typen casten.
Du kannst einfach von FNotification die Felder abgreifen

Siehe mein Edit 1, selbst das funktioniert nicht.

daywalker9 19. Okt 2013 23:50

AW: [UILocalNotification] Wie auf Inhalt zugreifen ?
 
Dann ist bei dir was anderes im argen. Wie sieht denn den andere Code aus? Wann wird FNotification gesetzt?

RWarnecke 20. Okt 2013 01:03

AW: [UILocalNotification] Wie auf Inhalt zugreifen ?
 
FNotification wird wie in diesem Beispiel(der 2. Beitrag) gesetzt.

RWarnecke 21. Okt 2013 04:26

AW: [UILocalNotification] Wie auf Inhalt zugreifen ?
 
Hat niemand eine Idee, warum ich nicht auf den Inhalt von FNotification zugreifen kann ?

himitsu 21. Okt 2013 08:33

AW: [UILocalNotification] Wie auf Inhalt zugreifen ?
 
Das Beispiel selber läuft aber?

Mangels fehlenden iProduktes und dank überteuerter MobileVersion kann ich's schlecht ausprobieren.

RWarnecke 21. Okt 2013 18:00

AW: [UILocalNotification] Wie auf Inhalt zugreifen ?
 
Das Beispiel funktioniert soweit einwandfrei, aber in dem Beispiel wird nicht auf FNotification zugegriffen. Soweit ich den Quelltext verstehe, ist in FNotification meine Push Nachricht drin, wenn die Anwendung über eine eingehende Push Notification gestartet wird. Läuft die Anwendung im Hintergund, kann ich auf den Inhalt der Push Notification über das Event OnReceive zugreifen.


Alle Zeitangaben in WEZ +1. Es ist jetzt 18:21 Uhr.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz