ALL BUSINESS
COMIDA
DIRECTORIES
EDUCATIONAL
ENTERTAINMENT
FASHION TIPS
FINER THINGS
FREE CREATOR TOOLS
HEALTH
MARKETPLACE
MEMBER's ONLY
MONEY MATTER$
MOTIVATIONAL
NEWS & WEATHER
TECHNOLOGIA
TELEVISION NETWORKS
USA VOTES 2024
VIDEOS
INVESTOR RELATIONS
IN DEVELOPMENT
Posted by - Latinos MediaSyndication -
on - September 10, 2023 -
Filed in - Technology -
-
400 Views - 0 Comments - 0 Likes - 0 Reviews
I try to open A file with my app. The File is transferred via a Web service and saved in a local Database, BASE64 encoded. When I show the File in my App, I want to use the default Application for that file type. Or at least I want to show an application picker dialog and let the user choose the application to open the File with. What I have so far is this:
procedure Base64StringToFileAndOpen(const base64String: string; Filename: string); var decodedBytes: TBytes; filePath: string; fileStream: TFileStream; interactionController: UIDocumentInteractionController; NSU: NSURL; begin // Decode BASE64 string into bytes decodedBytes := TNetEncoding.Base64.DecodeStringToBytes(base64String); // Determine the file path // NSStrToStr(TNSString.Wrap(NSTemporaryDirectory)); filePath := System.IOUtils.TPath.Combine(System.IOUtils.TPath.GetTempPath, Filename); // Save decoded bytes into a file fileStream := TFileStream.Create(filePath, fmCreate); try fileStream.WriteBuffer(decodedBytes[0], length(decodedBytes)); finally fileStream.Free; end; NSU := TNSURL.Wrap(TNSURL.OCClass.URLWithString(StrToNSStr(PChar(filePath)))); interactionController := TUIDocumentInteractionController.Wrap(TUIDocumentInteractionController.alloc.init); interactionController.setURL(NSU); interactionController.setUTI(StrToNSStr('public.data')); interactionController.presentOpenInMenuFromRect(CGRectFromRect(TRectF.Empty), SharedApplication.keyWindow.rootViewController.view, true); end;
When I run that Code on the iPhone, a Box like you would normally expect to show up is shown on the end of the Screen. But nothing is in that Screen. No Apps, no Text, nothing. I would expect Apps to appear here that let me open that File. Where is my mistake? I looked for Kastri framework if something useful is implemented there, but there is only a Share Component, but I do not want to share my File I only want to display it in another app.
Can anyone help me out?