Xcode 7 and my code:
Xcode 7和我的代码:
func sendSetDataStreamingCommand {
let mask = RKDataStreamingMask.AccelerometerFilteredAll |
RKDataStreamingMask.IMUAnglesFilteredAll |
RKDataStreamingMask.QuaternionAll ;
self.robot.enableSensors(mask,atStreamingRate:RKStreamingRate.DataStreamingRate10);
}
the warning is :
警告:
swift Binary operator '|' cannot be applied to two UIViewAutoresizing operands
then change code:
然后改变代码:
func sendSetDataStreamingCommand {
let mask=[RKDataStreamingMask.AccelerometerFilteredAll,
RKDataStreamingMask.IMUAnglesFilteredAll,
RKDataStreamingMask.QuaternionAll]
self.robot.enableSensors(mask,atStreamingRate:RKStreamingRate.DataStreamingRate10);
}
then warning in last sentence is :
最后一句的警告是:
Cannot convert value of type '[RKDataStreamingMask]' to expected argument type 'RKDataStreamingMask'
Please teach me how to do ?Thanks.
请教我怎么做?谢谢。
1 个解决方案
#1
1
To declare a variable containing multiple members of OptionSetType
you have to annotate the type explicitly, otherwise the square brackets are treated as an array.
要声明一个包含OptionSetType多个成员的变量,必须显式地注释该类型,否则方括号将被视为数组。
let mask : RKDataStreamingMask = [.AccelerometerFilteredAll, .IMUAnglesFilteredAll, .QuaternionAll]
#1
1
To declare a variable containing multiple members of OptionSetType
you have to annotate the type explicitly, otherwise the square brackets are treated as an array.
要声明一个包含OptionSetType多个成员的变量,必须显式地注释该类型,否则方括号将被视为数组。
let mask : RKDataStreamingMask = [.AccelerometerFilteredAll, .IMUAnglesFilteredAll, .QuaternionAll]