stdout hanging on iOS 5.1
stdout hanging on iOS 5.1
- Subject: stdout hanging on iOS 5.1
- From: Jens Alfke <email@hidden>
- Date: Tue, 13 Mar 2012 15:08:55 -0700
I’ve been dealing with an emergency today where a developer found that the library I work on doesn’t work in iOS 5.1, causing their (already-released) app to fail to launch. It’s been especially hard to figure out because the problem is a Heisenbug that _only_ manifests itself if the device hasn’t been connected to Xcode. If you run the app with Xcode, or from the device at any time after the device has been connected to Xcode, everything works fine (until you reboot.)
Through trial and error I’ve figured out that the problem has to do with writing to stdout (i.e. calling printf). I don’t do it myself, but some gnarly code I use (the Erlang runtime) does. As near as I can tell, on iOS 5.1 this is causing the thread to hang. The reason I know this is because if I call freopen to redirect stdout to a file (which I did in an attempt to capture any error messages that weren’t showing up in the console afterward), the problem goes away and the app launches.
So is anyone aware of any problems using stdout in iOS apps? Something that may have changed in iOS 5.1? I’m willing to commit my two-line patch that adds the freopen call, but I’d be a lot more comfortable with it if I knew why the hell it worked!
—Jens
PS: Posting this to xcode-users instead of cocoa-dev because it seems more related to tools/debuggers than to frameworks.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden