I am working on a mixed project of swift and objective-c. I need to use a function like this.
+ (nullable NSString *)funcName:(NSString **)param;
In swift,the param becomes AutoreleasingUnsafeMutablePointer
type.
Tried code like this
let str : NSString = ""
let pointer = UnsafeMutablePointer(mutating: str.utf8String)
let unsafe = AutoreleasingUnsafeMutablePointer<NSString?>.init(pointer)
let str = funcName(str.utf8String)
But it results in crash because the pointer I sent in is pointing to nil