Jump to content

Search the Community

Showing results for tags 'ios'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Delphi Questions and Answers
    • Algorithms, Data Structures and Class Design
    • VCL
    • FMX
    • RTL and Delphi Object Pascal
    • Databases
    • Network, Cloud and Web
    • Windows API
    • Cross-platform
    • Delphi IDE and APIs
    • General Help
    • Delphi Third-Party
  • C++Builder Questions and Answers
    • General Help
  • General Discussions
    • Embarcadero Lounge
    • Tips / Blogs / Tutorials / Videos
    • Job Opportunities / Coder for Hire
    • I made this
  • Software Development
    • Project Planning and -Management
    • Software Testing and Quality Assurance
  • Community
    • Community Management

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Delphi-Version

Found 69 results

  1. Hi in delphi 12 show this error [DCC Error] E2597 ld: file not found: /usr/lib/swift/libswiftUIKit.dylib Which framework do I need to add? Delphi 12 , XCODE 13.4 Thanks
  2. My application, written for iOS, creates caf files and uploads them to the server. My other application, written for Android, would like to play these files, but cannot. Apparently different formats. Android application that creates caf files, successfully plays them The problem is not new: https://stackoverflow.com/questions/34546248/how-to-play-caf-audio-file-on-android-platform-firemonkey But 8 years have passed. I think there are solutions. I wish my Android app could play caf files from iOS.
  3. Tell me, is there an implementation of video selection for iOS? For example, like selecting images by ActionTakePhotoFromLibrary or TOpenDialog.
  4. I had compatibility issues with the connection of PAServer to the virtual Mac I am using. Giving a brief context, I am using a virtual Mac through a service provided by MacInCloud (https://www.macincloud.com/), which offers an installed and updated PAServer on the machine from the following link: https://docwiki.embarcadero.com/RADStudio/Alexandria/en/Installing_the_Platform_Assistant_on_a_Mac The problem is that the version of Delphi 11.3 we are using requires compatibility with version 13.3.12.7 of PAServer, but the download from the official Embarcadero page provides PAServer version 13.3.12.6. As the Mac machine belongs to the personnel at MacInCloud, they do not accept the installation of a .pkg that does not come from an official Embarcadero download link. (I don't have administrator permissions, so I can't install it myself.) So, the main question is, how can I get in touch with someone from Embarcadero to request an update to the official Download link?
  5. My iOS application is configured to accept PUSH. When I accept "my" PUSH intended for my application, everything works fine, my behavior logic works. When my application is open, when I click on “foreign” (for other applications) PUSH, my application closes abnormally. Tell me, what am I doing wrong? procedure TFmMain.FormCreate(Sender: TObject); begin ... TMessageManager.DefaultManager.SubscribeToMessage(TPushRemoteNotificationMessage, PushRemoteNotificationMessageHandler); PUSHMessage := ''; ... end; Procedure TFmMain.PushRemoteNotificationMessageHandler(const Sender: TObject; const AMessage: TMessage); Begin If AMessage Is TPushRemoteNotificationMessage Then Begin PUSHMessage := TPushRemoteNotificationMessage(AMessage).Value.Notification; End; end; The form contains TNotificationCenter; procedure TFmMain.NotificationCenter1ReceiveLocalNotification(Sender: TObject; ANotification: TNotification); begin // Some actions end; How can I process only “my own” PUSH and ignore “others”? Even if NotificationCenter1ReceiveLocalNotification(Sender: TObject; ANotification: TNotification) is empty, When I click on "Aliens" PUSH, my application crashes!
  6. Good afternoon! I have a question about push notifications in iOS. Is it possible to handle the click_action event (user clicking on a push notification)? The situation is as follows: I can't properly receive PUSH notifications when the iOS app is open or in the background. I'm interested in three application state scenarios: 1. iOS application is closed. A PUSH notification arrives. When you press PUSH, the application opens and “Some code” is executed. - This script works perfectly! 2. iOS application is open. A PUSH notification arrives and immediately “Certain code” is automatically executed. I wish it would ONLY run when PUSH is pressed! 3. The iOS application is in the background, minimized. A PUSH notification arrives. When you press PUSH, the application is activated, BUT “Some code” is not executed! That is, it all comes down to the PUSH notification click event: Only after clicking on PUSH notifications do I need to execute "Some code" Tell me how to do this or suggest your own scenario.
  7. Hello everyone! I have started trying to develop cross-platform FMX application. I succeeded in compile a simple app with just a form (only TLayout and TImageList which contains images) in Windows and Android platform. But when I switched to iOS, I cannot compile with the given error: "F1026: File not found 'dsymutil.exe'. Can you help me figure out that what I made incorrectly? As I know, dsymutil is an utility of Xcode command line tools which is not available on Windows, isn't it? P.S: I am using Delphi 11.3. I have already setup Xcode 14.3.1, its Command Line Tools, PA Server 22. Delphi can load list of profiles and simulation devices from my Mac.
  8. IMG SPA

    Delphi To IOS Deploying error

    Hello, I'm trying to deploying a Delphi FMX application to iPhone IOS. I have no problems on connecting with the MAC but I have an internal API error on executing (please see attached file) Delphi version: 11.2 Patch 1 IOS version: 16.6 X-code version: 14.3.1 Can anyone help me? Thanks
  9. Dear all, I have install the Delphi 11.3 CE and try to compile the project to iOS64 target and received this exception [Fatal Error] Module not found: dcciosarm64280.dll I have tried to reinstall the Delphi on two different PCs but nothing changed. Any idea where the problem is ? Thank you Regards Jan
  10. Hi, The following code is used in an app to retrieve the safe area on iOS: function GetSafeAreaLayout: TRectF; var App: UIApplication; Win: UIWindow; Guide: UILayoutGuide; begin App := TUIApplication.Wrap (TUIApplication.OCClass.sharedApplication); Win := TUIWindow.Wrap (App.windows.objectAtIndex (0)); Guide := Win.safeAreaLayoutGuide; Result := Guide.layoutFrame.ToRectF; end; It is triggered in Resize, and worked for all iPhones when compiled under RAD 11.1. However, compiling under 11.2 and 11.3 patch 1, while the above function completes successfully on iPhone SE, 7 & 8, Result.Top returns as 0 when the app first starts (i.e. causes app to overlay system menu at top of phone). Either calling the function again after app start, or re-orientating the phone fixes the issue. This start-up problem does not happen on the iPhoneX. Has anyone else encountered this issue and know of a fix, or is there a better, more reliable way to access the safe area? Please accept my thanks in advance.
  11. Delphi 11.2 patch 2. iOS application raises "EUnsupportedPlatformService with message 'Unsupported platform service: Terminate'" error upon Application.Terminate; or MainForm.Close; There is no problem with Android application. Actually it's [Exit] button functionality in the application. Can someone help?
  12. I have a FireMonkey application which works fine in an Android. Now I want to build it in iOS. But the problem is, I did never it before. Can someone explain what exactly I have to do? F.e. Mac ot not, if 'yes' - what configuration, OS, iPhone or enough is simulator etc? Simple things for someone with the skills...
  13. Goal: I have configured my app to be opened by some links in iOS, like myapp://lala (using custom scheme), or https://myapp.com/c/lala using universal links, and is already opening my app, but i need to know which url that opened my app. (There is even a tutorial in FMX Express) Problem: I'm trying to handle incoming url from my ios app unsuccessfully. On iOS this should be done by capturing event TApplicationEvent.OpenURL like: procedure TipUrlHandler.ApplicationEventMessageHandler(const ASender: TObject; const AMessage: TMessage); begin case TApplicationEventData(TApplicationEventMessage(AMessage).Value).Event of TApplicationEvent.OpenUrl: HandleUrl(TiOSOpenApplicationContext(TApplicationEventData(TApplicationEventMessage(AMessage).Value).Context).URL); else end; end; Mas o TApplicationEvent.OpenUrl nunca é chamado. So I checked the class TApplicationDelegate in the unit FMX.Platform.iOS.pas in which the TApplicationDelegate.applicationOpenURLWithOptions function should be called every time the app is opened by a url as Apple documents: https://developer.apple.com/documentation/uikit/uiapplicationdelegate/1623112-application?language=objc class function TApplicationDelegate.applicationOpenURLWithOptions(self: id; _cmd: SEL; application: PUIApplication; url: Pointer; options: PNSDictionary): Boolean; So I went to check if the applicationOpenURLWithOptions method is being added correctly in TApplicationDelegate.CreateDelegateMetaClass: class procedure TApplicationDelegate.CreateDelegateMetaClass; begin ... // Opening a URL-Specified Resource if TOSVersion.Major >= 9 then class_addMethod(DelegateClass, sel_getUid('application:openURL:options:'), @applicationOpenURLWithOptions, 'B@:@@@@') else ... end; And then I was able to prove it wrong! The number of arguments declared is wrong, as the correct one should be B@:@@@ Then I made the modification to FMX.Platform.iOS.pas, being as follows: class procedure TApplicationDelegate.CreateDelegateMetaClass; begin ... // Opening a URL-Specified Resource if TOSVersion.Major >= 9 then class_addMethod(DelegateClass, sel_getUid('application:openURL:options:'), @applicationOpenURLWithOptions, 'B@:@@@') else ... end; But the TApplicationDelegate.applicationOpenURLWithOptions function is not yet called. What is wrong? @EDIT Sorry! It is working for custom schemes like "myapp://lala" (with or without the correction in FMX.Platform.iOS.pas) but it is not working for universal links like https://myapp.com/c/lalala. Although I have already configured the universal link correctly and when I click on this universal link, the iOS open my app, but the url can't be handle with TApplicationEvent.OpenUrl, but I discovered that the handling of incoming url of a universal link is different: Handling Universal Links
  14. Hi everyone, I’m experimenting with the ability to allow users to change their app icon at runtime in iOS which is officially supported now. I have all the APIs etc to make it work but it requires the alternative icon graphics to be included in the Asset Catalog. The asset catalog is generated by Delphi during build using the Deployment Manager references but I can’t see how to include files in the DM which will be pulled into the Asset Catalog so not sure if it’s possible? Has anyone looked into this or managed to get Delphi to do this for additional images aside from the standard icon files? If not I’ll raise a QP request but wanted to check with the community first. Thanks
  15. Hi all, and my excuses for revisiting an old subject, but I haven't found this particular info. Using my i7 iMac with PAServer 13.1.11.0, Monterey 12.3.1 and XCode 13.3 debugging works as expected for devices with ios 15.4, 15.4.1, and 15.5. However, debugging does NOT work on i9 MacBook Pro with Monterey 12.4 and XCode 13.4.1 for any of the devices with ios 15.4, 15.4.1, and 15.5: I can deploy, start, and run my app, but breakpoints don't work (they appear enabled before pressing F9, but become disabled after pressing F9). I would greatly appreciate if anyone who got the combination of Monterey 12.4, XCode 13.4.1, and iOS 15.5 to work could let me know (including any necessary "tricks" that may be required). Also, I wonder if there really is any difference between Intel and M1 macs in this respect. Best regards, Per
  16. We started porting the Skia4Delphi library to C++Builder and we came across a problem in the static linking of objects, specifically linking the file “/usr/lib/clang/lib/darwin/libclang_rt.ios.a” which is in the SDK path (ex: “C:\Users\<username>\Documents\Embarcadero\Studio\SDKs\iPhoneOS15.2.sdk\usr\lib\clang\lib\darwin\libclang_rt.ios.a”) In Delphi, this linking is very simple to do. We can simply declare a fake method and add the external '/<sdk_sub_path>/<filename>.a', which is exactly what we do in our Delphi implementation: procedure libcompiler_rt; external '/usr/lib/clang/lib/darwin/libclang_rt.ios.a'; In C++Builder however, we didn't find anything similar. So far we've only been able to force this link in two different (but very rudimentary) ways: Method 1 - Configuring project linking: Adding to the project library path “$(BDSPLATFORMSDKSDIR)\<DefaultPlatformSDK>\usr\lib\clang\lib\darwin\” Note: This is necessary because although some SDK paths are automatically passed to the linker, this is not. Adding the command -lclang_rt.ios to the project link The problem with this method is that apparently there is no environment variable for the <DefaultPlatformSDK>, and adding only relative paths, in this case “\usr\lib\clang\lib\darwin\”, doesn't work. We also tried “$(SDKROOT)\usr\lib\clang\lib\darwin\” but to no avail. Method 2 – Adding objects to the project Directly add the file “libclang_rt.ios.a” to the project. It also works, but this is also a bad option. Questions Is there any other way to force link an SDK object in C++Builder? It would be nice to have a simple solution that requires no configuration: #pragma link "/usr/lib/clang/lib/darwin/libclang_rt.ios.a" // But this don't work Would there be any variables we could use to represent the path of the SDK being used? (Ex: “$(SDKROOT)\usr\lib\clang\lib\darwin\”)
  17. Hi all, A generic question. I'm deploying my apps with an embedded SQLite DB. Each time I compile/deploy, that existing on device DB file is overwritten by the default one. It's fine for development. But how do you actually proceed if you want to deploy an update? If a user has the app already with personal data, I don't want her/him to lose that data. Testing whether the DB already exists is not possible since it's deployed each time within the new binary. One way would be to have all the code to check whether the DB exists. If not, programmatically create it and fill it with sample data. If it does, just check its version and apply possible structure upgrades? But it feels like this would embark a lot of code that may not really be useful. How do you guys deploy news versions of your apps without overwriting exists DBs? I especially think about iOS and Android devices. Thanks for any light. Steve
  18. Walter Campelo

    Error deploying IOS Release App

    Dear friends: I am using Delphi 10.4.2 to compile an application for Android and for iOS. For Android it has already been published on Google Play. For iOS I can compile and run the application in development mode on an iPad (4th generation). I created all the certificates and also created a provisioning for the App with Apple through my developer account. But, when I go to perform the deployment I get the following error: [PAClient Error] Error: E0776 2021-10-18 20:57:41.276 xcodebuild[28696:1176276] [MT] DVTPlugInManager: Required plug-in compatibility UUID 42E1F17B-27B3-4DE8-92A8-DC76BA4F5921 for DVTCoreGlyphs.framework (com.apple.dt.DVTCoreGlyphs) not present Does anyone know how to solve this? Reminding that you just need to change the setting to "development" and the App runs on the iPad without problems. Best Regards!
  19. My app uses Firebase Admob support for showing advertisement banners. I developed app with Delphi 10.4.2 using the information from Embarcadero article at https://docwiki.embarcadero.com/RADStudio/Sydney/en/IOS_Firebase_Support and from Dave Nottage's articles regarding Firebase integration with Delphi at https://delphiworlds.com/2017/05/adding-firebase-cloud-messaging-mobile-apps-part-2/ and https://delphiworlds.com/2018/08/firebase-cloud-messaging-revisited/. I uploaded my app to App Store. It is name is "Evdeki Bar". It means "Bar At Home" in Turkish. My app works without problems on IOS 13 , IOS 14 and IOS 15 devices when it is downloaded from App Store. But, When I run from Delphi it does not work with IOS SDK 15.0 and IOS SDK 15.2. It stops executing after showing launch screen and waiting 2-3 seconds. It does not show my first form. I inspected the problem thoroughly, but, I could not found a solution to it. I analyzed device logs for my app. There is no app crash in the logs. I noticed that during launch of my app by PAServer app in Mac, iosinstall task crashes. I tried running app with Delphi 10.4.2 and Delphi 11. The problem exists with the both Delphi versions. I tried with Firebase IOS SDK versions 6.18, 6.19, 6.28, 6,.29, 6.30, 6.31 and 8.10, and problem continues with all of these versions. Firebase IOS SDK 6.31 includes Google Mobile Ads SDK 7.64 which is recommended version for IOS 14.0. I tried XCode 13.0 and XCode 13.2.1 and problem still continues. Moreover, I tried with both Debug and Release configurations. Is there a solution or workaround to this problem?
  20. Michael Collier

    How to: Phone camera frame(s) to server

    Hello, I'm evaluating latest version of Delphi RAD for possible iOS/android phone application. I'd like to be able to use a phone camera (iOS and Android) to take photos (maybe 1 per second) and upload to my server. So.. 1). I found sample project "accessCameraApp" - my first question is.. would this be the component to use for my photo capture? - or should I be using something different? 2) I found internet references to indy components (I have used this in the past), but they are not installed on my component palette (no problem though I guess I can install later), but I did find TNetHTTPClient and TNetHTTPRequest, I was wondering which I should use (indy/TNetHTTPClient or maybe synapse if it is available?) for posting photo frames to my server? (i.e. a php page that saves photo(s) in database BLOB field). Any help to point me in the right direction would be great, it's more about the selection of components that I would need, I have plenty of Object Pascal experience, and I do a lot of camera work using javascript. It's just that the latest set of Delphi tools are new to me. Thanks in advance, Mike
  21. Is anyone managing to use the storyboard launch screen? Here it is only working with the original delphi color and image. When I try to change the background color or the image in the project options, it has no effect.
  22. Fivecord

    Can't use deployed files on iOS

    I'v made an iOS app where I want the user to select the style. In the deployment I have added some fsf-files which have a Remote Path set to StartUp\Documents The style is set via the following code: astylefile := TPath.Combine(TPath.GetDocumentsPath, 'BlackRock_iOS.fsf'); TStyleManager.SetStyleFromFile(astylefile); Then I get the error: Cannot open file "/var/mobile/containers/Data/Application/.../Documents/BlackRock_iOS.fsf". No such file or directory. If I inspect the file appname.app, the folder StartUp/Documents is present with the fsf-files in it, so the files are deployed. Thus something prevents my app to access the files? I tried the same in a blank iOS app, where the styles are applied successful. Anybody an idea of what could be wrong?
  23. Setup is delphi 10.4.2 - xcode 13 - sdk 15 I was finaly able to get instruments to work on my IOS app. (Had to build using developer cert and profile not adHoc) Where I run my app, with Leaks this is what I see for a short timestamp. My question is are all these leaks? How do I relate this to my code? In several cases, the program is just sitting on a screen waiting for user input, but the leak list keep growing. There are no timers in my program. Leaked Object Count Address Size Responsible Library Responsible Frame Malloc 96 Bytes 1 0x285eeaca0 96 Bytes CodeRouteTest 0x100f1221c Malloc 96 Bytes 1 0x285f16460 96 Bytes CodeRouteTest 0x100f1221c Malloc 96 Bytes 1 0x285eeaee0 96 Bytes CodeRouteTest 0x100f1221c Malloc 96 Bytes 1 0x285eed5c0 96 Bytes CodeRouteTest 0x100f1221c Malloc 96 Bytes 3 < multiple > 288 Bytes CodeRouteTest 0x100f1221c Malloc 96 Bytes 1 0x285f164c0 96 Bytes CodeRouteTest 0x100f1221c Malloc 96 Bytes 1 0x285f67360 96 Bytes CodeRouteTest 0x100f1221c Malloc 80 Bytes 1 0x281d28500 80 Bytes CodeRouteTest 0x100f1221c Malloc 96 Bytes 1 0x285f161c0 96 Bytes CodeRouteTest 0x100f1221c Malloc 96 Bytes 2 < multiple > 192 Bytes CodeRouteTest 0x100f1221c IFMXTextPosition 1 0x2839d6290 16 Bytes CodeRouteTest 0x10104de08 Malloc 96 Bytes 1 0x285f16b80 96 Bytes CodeRouteTest 0x100f1221c Malloc 96 Bytes 1 0x285ee8ea0 96 Bytes CodeRouteTest 0x100f1221c IFMXTextPosition 1 0x2839d5c90 16 Bytes CodeRouteTest 0x10104de08 Malloc 96 Bytes 1 0x285f16580 96 Bytes CodeRouteTest 0x100f1221c Malloc 96 Bytes 1 0x285ee94a0 96 Bytes CodeRouteTest 0x100f1221c Malloc 96 Bytes 1 0x285eeba20 96 Bytes CodeRouteTest 0x100f1221c Malloc 96 Bytes 1 0x285eeb000 96 Bytes CodeRouteTest 0x100f1221c Malloc 96 Bytes 1 0x285eef420 96 Bytes CodeRouteTest 0x100f1221c IFMXTextRange 1 0x2839d5170 16 Bytes CodeRouteTest 0x10104de08 Malloc 96 Bytes 1 0x285f66460 96 Bytes CodeRouteTest 0x100f1221c Malloc 96 Bytes 1 0x285eec420 96 Bytes CodeRouteTest 0x100f1221c Malloc 96 Bytes 2 < multiple > 192 Bytes CodeRouteTest 0x100f1221c Malloc 96 Bytes 1 0x285ee9020 96 Bytes CodeRouteTest 0x100f1221c Malloc 80 Bytes 1 0x281d284b0 80 Bytes CodeRouteTest 0x100f1221c Malloc 96 Bytes 1 0x285ee8a80 96 Bytes CodeRouteTest 0x100f1221c Malloc 96 Bytes 1 0x285eead00 96 Bytes CodeRouteTest 0x100f1221c Malloc 96 Bytes 1 0x285ee2340 96 Bytes CodeRouteTest 0x100f1221c Malloc 96 Bytes 1 0x285eed680 96 Bytes CodeRouteTest 0x100f1221c Malloc 96 Bytes 1 0x285eead60 96 Bytes CodeRouteTest 0x100f1221c Malloc 96 Bytes 1 0x285f163a0 96 Bytes CodeRouteTest 0x100f1221c Malloc 96 Bytes 1 0x285f16ac0 96 Bytes CodeRouteTest 0x100f1221c UICTFontDescriptor 1 0x285f17ae0 96 Bytes UIFoundation -[UIFontDescriptor _swapWithFontAttributes:options:] UICTFontDescriptor 1 0x285ee5200 96 Bytes UIFoundation -[UIFontDescriptor _swapWithFontAttributes:options:] Malloc 80 Bytes 1 0x281d280f0 80 Bytes CodeRouteTest 0x100f1221c
  24. I submitted my iOS app to App store but rejected. The reason is my app prompts error when user refuse allow the location service. I test this scenario and found that if user not authorise the location service when first installing the app, it would have a dead loop prompting error “ Unauthorized to user location services”. My app stuck there and cannot proceed further. I discovered the reason for the dead looping. I start the location sensor (LocationSensor.Active := True) when the application started. Due to unknown reason, may be network problem, it cannot send back any location data some time. I followed suggestion on the Stack Overflow to put the LocationSensor.Active := True in a timer event, keep looping until location data coming out. This method works quite good. However, this method is not really detecting the location service is on/off, it just working when the sensor has some delay in reading location data. Is there a function to detect the iOS location service is on or off ? B.R. Leo
  25. Hello, everyone! English is not my first language, so please be kind to my mistakes ... but I'll try explain my problem. In my app need intercept swipe gesture. I read links in Apple Dev portal, more read codes on swift and objective-c different people on stackoverflow portal, and finally read delphi codes and delphi sources in RAD Studio ... But a week of torment has passed and nothing comes of it. Please tell me what is the problem? My code worked, but crashed after Result := True in shouldBegin function! I not understand why? What is it magic? If something like that is in the source code of the RAD Studio, why my app receive Access violation? I think problem in this line code: FSwipeRecognizer.initWithTarget(GetObjectID, sel_getUid('HandleSwipe:')); I guess because my app or system not see procedure HandleSwipe. My full code: unit Unit1; interface uses System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants, FMX.Types, FMX.Controls, FMX.Forms, FMX.Graphics, FMX.Dialogs, iOSapi.Foundation, iosapi.UIKit, iOSapi.CocoaTypes, FMX.Platform.iOS, Macapi.ObjCRuntime, Macapi.ObjectiveC, iOSapi.CoreGraphics, FMX.Helpers.iOS, iOSapi.WebKit, FMX.WebBrowser, Macapi.Helpers, FMX.Gestures, FMX.VirtualKeyboard.iOS; type TDelegateTouch = class; TForm1 = class(TForm) procedure FormCreate(Sender: TObject); procedure FormDestroy(Sender: TObject); private { Private declarations } FSGRDelegate: TDelegateTouch; public { Public declarations } end; TDelegateTouch = class(TOCLocal, UIGestureRecognizerDelegate) private FSwipeRecognizer: UISwipeGestureRecognizer; constructor Create; public { UIGestureRecognizerDelegate } destructor Destroy; procedure HandleSwipe(gestureRecognizer: UISwipeGestureRecognizer); function gestureRecognizer(gestureRecognizer: UIGestureRecognizer; shouldReceiveTouch: UITouch): Boolean; overload; cdecl; function gestureRecognizer(gestureRecognizer: UIGestureRecognizer; shouldRecognizeSimultaneouslyWithGestureRecognizer: UIGestureRecognizer): Boolean; overload; cdecl; function gestureRecognizerShouldBegin(gestureRecognizer: UIGestureRecognizer): Boolean; overload; cdecl; end; var Form1: TForm1; implementation {$R *.fmx} procedure TForm1.FormCreate(Sender: TObject); begin FSGRDelegate := TDelegateTouch.Create; end; { TDelegateSwipeTouch } constructor TDelegateTouch.Create; var UI: UIView; SGR: UISwipeGestureRecognizer; UIGest: Pointer; Int: Integer; ViewClass, FM1, FM2: Pointer; begin inherited; FSwipeRecognizer := TUISwipeGestureRecognizer.Alloc; FSwipeRecognizer.initWithTarget(GetObjectID, sel_getUid('HandleSwipe:')); //FSwipeRecognizer.setDelaysTouchesBegan(False); //FSwipeRecognizer.setCancelsTouchesInView(True); FSwipeRecognizer.setDirection(UISwipeGestureRecognizerDirectionLeft); UI := WindowHandleToPlatform(Form1.Handle).View; UI.addGestureRecognizer(FSwipeRecognizer); //UI.setMultipleTouchEnabled(True); end; function TDelegateTouch.gestureRecognizer( gestureRecognizer: UIGestureRecognizer; shouldReceiveTouch: UITouch): Boolean; begin Result := gestureRecognizer.isKindOfClass(objc_getClass('UISwipeGestureRecognizer')); end; destructor TDelegateTouch.Destroy; begin FSwipeRecognizer.release; inherited; end; function TDelegateTouch.gestureRecognizer(gestureRecognizer, shouldRecognizeSimultaneouslyWithGestureRecognizer: UIGestureRecognizer): Boolean; begin Result := NSObjectToID(shouldRecognizeSimultaneouslyWithGestureRecognizer.view) = NSObjectToID(gestureRecognizer.view); end; function TDelegateTouch.gestureRecognizerShouldBegin(gestureRecognizer: UIGestureRecognizer): Boolean; var RecognizerClassName: MarshaledAString; begin RecognizerClassName := class_getName(object_getClass(NSObjectToId(gestureRecognizer))); Result := RecognizerClassName = 'UISwipeGestureRecognizer'; end; procedure TDelegateTouch.HandleSwipe(gestureRecognizer: UISwipeGestureRecognizer); begin //if gestureRecognizer.state = UIGestureRecognizerStateEnded then begin ShowMessage('Test'); //end; end; procedure TForm1.FormDestroy(Sender: TObject); begin FSGRDelegate.Free; end; end. P.S. Part of the code was taken from the FMX.Platfom.iOS module. My equipment iPhone 11 iOS 14.5, MacBook Pro 13 Big Sur 11.2.3 with XCode 12.5, RAD Studio 10.4.2. Thanks everyone for the answers.
×