I am parsing an开发者_如何学编程 xml and I would like to know how I can keep track of the time it takes to do the same.
I tried to use alerts, but it kept crashing my app due to the large number of alert popping up.
Is it the same if I try to run my project on my iPAD through XCODE (i.e. by selecting target as my iPAD) and if I try to run the project when the iPAD is not connected to the mac? I ask this because, when I try NSLogging the times, it comes out on the Xcode. But I feel that is it not right.
NSLog is supposed to show in XCode. It prints a log message to the system log, which, on the iPad you have no way of seeing on the device itself.
If it were me, I'd do something like this:
Store an NSDate variable before decoding the XML (probably as a property, since you're most likely doing XML decoding asynchronously)
self.timingDate = [NSDate date];
Then, when the XML has finished decoding:
NSLog(@"Time taken: %f", [[NSDate date] timeIntervalSinceDate:self.timingDate]);
That will print out the amount of time spent decoding in seconds.
You can use NSLog and run it while not connected to your XCode machine. Afterwards, y0u can connect it to XCode and read the console entries made while it was disconnected. Just go to the organizer and select your device's console.
edit: You can also see the NSlog entries on the device itself by installing the Console app from the App Store.
精彩评论