Reputation: 419
Here is the simple example , Application have a button
,on clicking it should print Check
. It is printing when I am running from Xcode
(*very simple).But after clicking on stop button on Xcode and then launching the app again from icon this time , the button is not printing anything.
Code:
- (IBAction)save:(id)sender
{
NSLog(@"check");
}
What is the reason behind this?
Upvotes: 1
Views: 125
Reputation: 8014
When you run from xcode, the output is redirected to the debug console. This does not happen by default when you run from the icon.
However, you can ask to see the output by selecting Debug -> Open System Log... from the top bar menu.
So open the system log and then run your app from the icon and you will see the output.
Upvotes: 1
Reputation: 4677
Adding to @njuri, you can connect to the process from Xcode that was started outside of Xcode.
Click the Debug menu and choose Attach to Process then "By Process Identifier (PID) or Name" and enter your app's name. You can hit breakpoints and inspect the process. It does not recapture the stdout though. To see your logs, go to the Devices tool (Shift-Command-2)
Upvotes: 2
Reputation: 4391
When you stop Xcode running an application it stops receiving messages from the app. And when you running it again from Simulator Xcode knows nothing about new process.
Upvotes: 3