Question: Is it possible to log to a file on the iPhone (or get at the console output somehow) to read it later, or perhaps directly from the phone?

I need to debug an app that is using a cable-connected accessory device, so it cannot be connected to XCode at the same time.

Answer: 
Kevin Xi's approach is OK. You can also redirect NSLog output to the file using following code in AppDelegate's didFinishLaunchingWithOptions method:

```
NSArray *allPaths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [allPaths objectAtIndex:0];
NSString *pathForLog = [documentsDirectory stringByAppendingPathComponent:@"log.txt"];
freopen([pathForLog cStringUsingEncoding:NSASCIIStringEncoding],"a+", stderr);

```
As far as I know, this is not possible.

You can eventually use a free and excellent solution like [bugfender](http://www.bugfender.com) which will allow you to get the data logged by NSLog remotely. This could help you.