Iphone swift(id)initWithPreset中的转换:(int[])preset
可以转换-(id)initWithPreset:(int[])预置; 迅速地 在目标c中Iphone swift(id)initWithPreset中的转换:(int[])preset,iphone,swift,Iphone,Swift,可以转换-(id)initWithPreset:(int[])预置; 迅速地 在目标c中 MP3Converter *mp3Converter = [[MP3Converter alloc] initWithPreset:type]; 但我用的是Swift var mp3Converter : MP3Converter! mp3Converter = MP3Converter(preset:PRESET_VOICE ) 我们如何给他们预设:预设声音?。它给出了错误
MP3Converter *mp3Converter = [[MP3Converter alloc] initWithPreset:type];
但我用的是Swift
var mp3Converter : MP3Converter!
mp3Converter = MP3Converter(preset:PRESET_VOICE )
我们如何给他们预设:预设声音?。它给出了错误不安全的不可变指针。问题似乎在于您定义常量数组的方式 您需要将它们定义为整数指针,而不是数组。检查:
//const int PRESET_FM[] = {1, 2, 4, 5}; //<< This won't get exported to swift
const int * PRESET_FM = {1, 2, 4, 5}; //Swift can see this fine
嗯
//const int PRESET_FM[] = {1, 2, 4, 5}; //<< This won't get exported to swift
const int * PRESET_FM = {1, 2, 4, 5}; //Swift can see this fine
var mp3Converter : mp3Converter = MP3Converter(preset:UnsafeMutablePointer<Int32>( PRESET_FM)(PRESET_VOICE))
- (id)initWithPreset:(int *)preset