init: unrecognized selector sent to instance

  

I try to implement the new mandatory (in June) authentication services in my ios APP made with delphi Rio 10.3.3. for this I convert this class:

AS_EXTERN API_AVAILABLE(ios(13.0), macos(10.15), tvos(13.0), watchos(6.0))
@interface ASAuthorizationController : NSObject

/*! @abstract Authorization requests that are being serviced by this controller
*/
@property (nonatomic, readonly, strong) NSArray<ASAuthorizationRequest *> *authorizationRequests;

/*! @abstract This delegate will be invoked upon completion of the authorization indicating success or failure.
Delegate is required to receive the results of authorization.
*/
@property (nonatomic, weak, nullable) id <ASAuthorizationControllerDelegate> delegate;

/*! @abstract This delegate will be invoked upon needing a presentation context to display authorization UI.
*/
@property (nonatomic, weak, nullable) id <ASAuthorizationControllerPresentationContextProviding> presentationContextProvider API_UNAVAILABLE(watchos);

/*! @abstract Initialize the controller with authorization requests.

@param authorizationRequests At least one request should be provided. Requests of same type maybe honored in first in first out order
*/
– (instancetype)initWithAuthorizationRequests:(NSArray<ASAuthorizationRequest *> *)authorizationRequests NS_DESIGNATED_INITIALIZER;

/*! @abstract Initiate the authorization flows. Upon completion, the delegate will be called with either success or failure.
Certain authorization flows may require a presentation context, the presentationContextProvider will be called to provider it.

The instance will remain retained until the user completes the flow and the delegate callback is made.
*/
– (void)performRequests;

+ (instancetype)new NS_UNAVAILABLE;

– (instancetype)init NS_UNAVAILABLE;

@end

to this delphi class

ASAuthorizationControllerClass = interface(NSObjectClass)
[‘{1FFA7BB5-DAA7-4FD5-A5B7-FE466A83A23F}’]
end;
ASAuthorizationController = interface(NSObject)
[‘{214873D8-CCF0-42B8-A381-04BBCFB75269}’]
//function authorizationRequests : NSArray; cdecl;
procedure setDelegate(delegate: ASAuthorizationControllerDelegate); cdecl;
function delegate : ASAuthorizationControllerDelegate; cdecl;
procedure setPresentationContextProvider(presentationContextProvider: ASAuthorizationControllerPresentationContextProviding); cdecl;
function presentationContextProvider: ASAuthorizationControllerPresentationContextProviding; cdecl;
function initWithAuthorizationRequests(authorizationRequests: NSArray): ASAuthorizationController; cdecl;
procedure performRequests; cdecl;
end;
TASAuthorizationController = class(TOCGenericImport<ASAuthorizationControllerClass, ASAuthorizationController>) end;
PASAuthorizationController = Pointer;

but the problem is that when I call TASAuthorizationController.create I receive this error:

-[ASAuthorizationController init]: unrecognized selector sent to instance 0x283c23380

How can I create under delphi an instance of ASAuthorizationController? normally I must call initWithAuthorizationRequests but it’s not marked with a (+) but with a (-) so it’s mean it’s not a static/class function so I need an instance of ASAuthorizationController to call it

Comments are closed.