반응형
Designing an InterfaceThe NSXPCConnection API takes advantage of Objective-C protocols to define the programmatic interface between the calling application and the service. Any instance method that you want to call from the opposite side of a connection must be explicitly defined in a formal protocol. For example:@protocol FeedMeACookie - (void) feedMeACookie: (Cookie *)cookie; @end @protocol FeedMeAWatermelon - (void) feedMeAWatermelon: (Watermelon *) watermelon reply: (void (^) (Rind *)) reply; @end Each method must have a return type of void, and all parameters to methods or reply blocks must be either:
|
NSXPCConnection API 는 호출하는 어플리케이션과 서비스간의 인터페이스를 프로그램적으로 정의한다. 호출하여 사용할 메소드는 프로토콜로 명시적으로 정의되어야 한다. 예를 들면 아래와 같다. XPC를 통한 통신은 비동기적이기 때문에, 프로토콜의 모든 메소드는 void 를 반환하여야 한다. 반환되는 데이터가 필요할 때에는 reply 블록을 다음과 같이 정의할 수 있다. 메소드는 오직 하나의 reply 블록만 가질 수 있다. |
728x90
'프로그래밍 > MAC OS' 카테고리의 다른 글
macOS Xcode 에서 한글입력 특이사항 (0) | 2023.02.28 |
---|---|
spctl rejected (the code is valid but does not seem to be an app) (0) | 2023.01.12 |
Cocoa 와 CocoaTouch 의 차이점 (0) | 2022.07.26 |
mojave 에서 gatekeeper 비활성화하여, notarization 안 된 프로그램 실행하기 (0) | 2022.02.28 |
OS X Specific Directories (0) | 2022.02.22 |