init: нераспознанный селектор отправлен на экземпляр - PullRequest
2 голосов
/ 19 апреля 2020

Я пытаюсь внедрить новые обязательные (в июне) службы аутентификации в моем ios APP, созданном с delphi Rio 10.3.3. для этого я конвертирую этот класс:

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

в этот delphi класс

  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;

, но проблема в том, что когда я звоню TASAuthorizationController.create, я получаю эту ошибку:

- [ASAuthorizationController init]: нераспознанный селектор отправлен на экземпляр 0x283c23380

Как создать под delphi экземпляр ASAuthorizationController? обычно я должен вызывать initWithAuthorizationRequests, но он не помечен (+), но (-), так что это означает, что это не статическая / классовая функция, поэтому мне нужен экземпляр ASAuthorizationController для его вызова

...