Information About Calling Objective-c from Swift

Asked 2 years ago, Updated 2 years ago, 40 views

I'm trying to call setupAppCWithMediaKey in test.m below over the code in view_test.swift
However, in the third specification of view_test.swift,
"launchOptions: 0x00000100" causes build error.
I would appreciate it if you could tell me about the cast when calling the objective-c content from swift.

/*test.m*/

+(void)setupAppCWithMediaKey:(NSString*)mk_
                      option: (NSUInteger) option_
               launchOptions: (NSDictionary*) launchOptions_;

/*view_test.swift*/

appCCloud.setupAppCWithMediaKey("xxxxxxxx", option:0x00000000, launchOptions:0x00000100)

Build Error Content
Type Expected Discount Type Cannot Convert Int' of 'NSObject': ANYOBJECT!

swift xcode

2022-09-30 19:37

1 Answers

It was resolved by writing as follows.

appCCloud.setupAppCWithMediaKey("xxxxxx", option: (0x00000000|0x00000100))

This post was posted as a community wiki based on @mat2's comments.


2022-09-30 19:37

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.