(NSString *) is it in a pascal pointer or an NSString?
I have a doubt about this feature:
- (instancetype)initWithCenter:(CLLocationCoordinate2D)center
radius:(CLLocationDistance)radius
identifier:(NSString *)identifier;
In pascal, identifier:(NSString *)identifier
should it be converted as Pointer or NSString ?
in the delphi source code, this function is converted as follows:
function initWithCenter(center: CLLocationCoordinate2D; radius: CLLocationDistance; identifier: NSSTRING): Pointer; cdecl;
However, when I use it, I have AV ios under 10 (but it works on ios 9) : (
If I replace NSString with Pointer then it works on IOS 10, but I don't understand why ...
NOTE : this is very strange because in delphi everyone is (NSString *)
translated as NSString
and it works great EXCEPT for CLRegion.initCircularRegionWithCenter
(under ios10 / 64bit) and I really want to know why, https://quality.embarcadero.com/browse/RSP-15717 and http://delphiworlds.com/2016/07/region-monitoring-background-ios/
This is an Objective-C bridge issue, it works great for 32 bit support, correct translation of the CLRegion header . The problem is that the bridge does not work correctly for 64-bit support, the Objective-C Runtime ABI is different for 32-bit and 64-bit. To clarify the correct use of NSString :), the bridge will take care of retrieving the descriptor (a pointer to an object created using the Objective-C Runtime) for you, this is information that is passed during the Objective-C Runtime, in the current project, retrieving the descriptor is done using:
Handle := (DelphiObject as ILocalObject).GetObjectID
or call below function from Macapi.Helpers.pas :
function NSObjectToID(const AObject: NSObject): Pointer;
Dave Nottage's suggestion works because you now bypass the handle fetch bridge and pass it in directly. This is exactly the moment when the bridge is not working at its job. We don't need to introduce a low-level pointer type here , for our bridge the Delphi Objective-C NSString * equivalent is NSString . strong> interface.
See ( https://quality.embarcadero.com/browse/RSP-15717 ) for details . Thank:)
source to share