Einzelnen Beitrag anzeigen

philipp.hofmann

Registriert seit: 21. Mär 2012
Ort: Hannover
862 Beiträge
 
Delphi 10.4 Sydney
 
#5

AW: iOS: Dateien in iCloud Drive speichern

  Alt 10. Sep 2020, 17:23
Ich habe mal alles deinstalliert und gelöscht und von vorne begonnen und den Code gerade gezogen.
Leider bleibt es noch dabei, in der iCloud sind die Daten, aber nicht in iCloud Drive.
Da werde ich noch ein wenig Jugend forscht betreiben müssen:

Delphi-Quellcode:
class function TFileUtils.getAppSharedDownloadsPath():String;
{$IFDEF IOS}
  var
    nsFile: NSFileManager;
    URL: NSURL;
{$ENDIF}
begin
  {$IFDEF IOS}
    nsFile := TNSFileManager.Wrap(TNSFileManager.OCClass.defaultManager);

    URL:=nsFile.URLForUbiquityContainerIdentifier(nil);
    if (URL <> nil) then
    begin
      URL:=URL.URLByAppendingPathComponent(StrToNSStr('Documents'));
      Result := UTF8ToString(URL.path.UTF8String);
      if (not nsFile.fileExistsAtPath(URL.path,nil)) then
      begin
        mlog.info('create new iCloud directory: '+result);
        if (nsFile.createDirectoryAtURL(URL,true,nil,nil)) then
          mlog.info('Created new iCloud directory '+result)
        else
          mlog.info('Can´t creat new iCloud directory '+result);
      end else
        mlog.info('iCloud directory exists yet '+result);
    end else
      Result := '';
  {$ELSE}
    {$IFDEF MSWINDOWS}
      result:=GetEnvironmentVariable('USERPROFILE')+'\Downloads';
    {$ENDIF}
    {$IFDEF MACOS}
      result:=System.IOUtils.TPath.getDownloadsPath();
    {$ENDIF}
    {$IFDEF ANDROID}
      result:=System.IOUtils.TPath.getSharedDownloadsPath();
    {$ENDIF}
  {$ENDIF}
end;
und das neue Zertifikat ist für die iCloud an sich schon notwendig. Das sollte eigentlich alles passen.

Geändert von philipp.hofmann (10. Sep 2020 um 17:30 Uhr)
  Mit Zitat antworten Zitat