Swift function containing parameters not available in Objective-C class

后端 未结 2 1762
感动是毒
感动是毒 2021-01-26 09:03

UPDATE: This question does not duplicate the question mentioned above. It was verified (see comment below) that the method definition IS properly added to the

相关标签:
2条回答
  • 2021-01-26 09:44

    The bad boy in your parameter list is the Int? param. Int's are represented as NSInteger in Objective-C. Thus they don't have a pointer and can't have a null value. Consider removing the optional qualifier or changing it to NSNumber?, like: func getSearchResults(searchText: String?, searchType: String?, zoom: Int) -> NSDictionary

    0 讨论(0)
  • 2021-01-26 09:55

    Lou Franco's explanation is correct. Your function has an Int? parameter, and there is no equivalent of that in Objective-C. Therefore the entire function cannot be exposed to Objective-C. Use Int or, if it really can be nil, use NSNumber?.

    0 讨论(0)
提交回复
热议问题