문제

I've this following code segment. The output for the integer variable comes as expected in iOS 5, but some irregular output is coming in iOS 6! Can anyone please explain what's happening?

int XmlMsgSubType;
[XmlMsgSubTypeData getBytes:&XmlMsgSubType length:1];
NSLog(@"XML subtype data: %@", XmlMsgSubTypeData);
NSLog(@"XML subtype: %d", XmlMsgSubType);

Output in iOS 5

XML subtype data: <06>
XML subtype: 6

Output in iOS 6

XML subtype data: <06>
XML subtype: 985605638
도움이 되었습니까?

해결책

If for some reason on ios 6 there is no data in the XmlMsgSubTypeData object, then XmlMsgSubType would be uninitialized and therefore the value returned would be undefined. I suspect the actually error is happening where you read the data into XmlMsgSubTypeData. Try calling [XmlMsgSubType length] to check it is not zero.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top