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: 
You can make use of [PonyDebugger](https://github.com/square/PonyDebugger). 

I've been using it a lot to debug networking and CoreData resources, but it also allows logging to the console with PDLog.

> 
> PonyDebugger is a remote debugging toolset. It is a client library and gateway server combination that uses Chrome Developer Tools on your browser to debug your application's network traffic and managed object contexts.
> 
> 
> 

Some recommendations:

* It works better in Safari than Chrome.
* Look into repo issues for making it work in your OSX version if needed. I have it working on El Capitan.
* Automatic connection didn't work for me, try using local IP gateway address instead:
	+ e.g. `[debugger connectToURL:[NSURL URLWithString:@"ws://192.168.0.12:9000/device"]];`
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.