NSDecimalNumber crash on iOS18 when using decimalNumberByDividingBy

NSDecimalNumber will crash on iOS18 when using decimalNumberByDividingBy in some cases. For example

NSDecimalNumber* a= [NSDecimalNumber decimalNumberWithString:@"21000000000"];
NSDecimalNumber* b= [NSDecimalNumber decimalNumberWithString:@"18446744073709551615"];
NSDecimalNumber* c = [a decimalNumberByDividingBy:b]; // this line will crash

the crash error is EXC_BREAKPOINT

the crash stack is

I know some foundation implementation changed on iOS18, But are there some ways to avoid it? It appears on iOS18 only.

Answered by DTS Engineer in 805069022

See this thread.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

See this thread.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

NSDecimalNumber crash on iOS18 when using decimalNumberByDividingBy
 
 
Q