1

我使用下面的代码从代码更改键盘布局,但出现在第二行的警告下方。

//warning
Assigning to 'TISInputSourceRef' (aka 'struct __TISInputSource *') from 'const void *' discards qualifiers

//code
CFArrayRef sourceList = TISCreateInputSourceList (NULL, false);
TISInputSourceRef wantedSource= CFArrayGetValueAtIndex(sourceList, 0);
TISSelectInputSource(wantedSource);
4

1 回答 1

0

我认为你需要转换返回的值CFArrayGetValueAtIndex,它的类型是const void*

TISInputSourceRef wantedSource = (TISInputSourceRef)CFArrayGetValueAtIndex(sourceList, 0);
于 2012-05-25T08:28:35.617 回答