Crashes in simulator and iOS9
hufkens opened this issue ยท 8 comments
Somehow since the last Xcode update (8.1) randomkit crashes for me when I run my app in the Simulator and also on iOS9 devices.I'm using the latest version 2.1.0 through CocoaPods. It worked before but somehow since the last update something changed/
The crash occurs in this method on the return statement:
extension UInt: RandomWithMax, RandomWithMin, RandomToValue, RandomThroughValue, RandomWithinRange, RandomWithinClosedRange {
fileprivate var _resigned: UInt {
return UInt(UIntMax(self)._resigned)
}
}
More info: http://crashes.to/s/ac28a42158e
Any help would be appreciated.
Can you tell me what MemoryLayout<UInt>.size
and MemoryLayout<UIntMax>.size
output for iOS 9 and the simulator?
In the simulator and iOS9 device
MemoryLayout<UInt>.size -> 4
MemoryLayout<UIntMax>.size -> 8
On iOS10 device it is:
MemoryLayout<UInt>.size -> 8
MemoryLayout<UIntMax>.size -> 8
The crash is triggered bij the shuffled() func in the Shuffleable extension.
Hope that helps.
I now get a compiler error.
Integer+RandomKit.swift:257:25: Shift amount is greater than or equal to type size in bits
Looks like the crash is gone now in the Simulator. I haven't tested it yet on iOS9 but I'll keep you posted. Thanks a lot ๐
Just ran the app on an iOS9 Device and it worked.
Thanks a lot ๐