开发者

NSString and UITouch...what in the world is going on?

I have an error with NSString. In one of my .m files I have a member called "conversions" of type NSString and within a method of that class the string is manipulated and added on to and etc. Well, when I try to Log that string in a different method that is later called, for some reason the string is printing as a UI开发者_运维问答Touch object. Specifically, I try to log the string as follows

NSLog(@"%@", conversions);

and in my console it prints

<UITouch 0x131700> phase: Ended tap count: 1 window: <UIWindow: 0x136470; frame = (0 0: 320 480) opaque = NO.....(and more property type stuff)

Why has my NSString turned into what looks like a UITouch object? What is going on?


A likely cause for problems like these is that "conversions" got released too early, thus got deallocated and you were still holding a reference to that memory location. Then another object got allocated at this location.

To debug this, set NSZombieEnabled. It doesn't deallocate objects but replaces them with "zombies". See for example the following link:

http://www.tomwhitson.co.uk/blog/2009/04/debugging-with-nszombiesenabled/

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜