The problem you are facing is memory management. I used to have this problem.
When you are an NSLog uid, what you get is the address for the WebView object. Why does this happen when the uid is NSString ??? Let me get to know the magic of memory management: D
When you set your uid variable in this line:
uid = [uid stringByReplacingOccurrencesOfString:@"-" withString:@""];
What you did is set the autoreleased variable to uid. This means that it will be released, and this place of memory will be for captures. Between this function, it ends the next time you access it, it was released and something else was stored there.
How do you fix this? When you assign something to a property, such as uid, ALWAYS execute it using the setter methods created in the @property declaration. Use either self.uid = string or [self setUid:string . This will allow you to correctly release the old line and save the new one.
This is a problem that cost me many hours trying to find a problem line. Another symptom that can happen is a program crash when trying to send a message to a released object. They can be VERY hard to track. I hope my answer helps you and you donβt have to endure this frustration :)
Good luck
source share