Debugger does not stop at breakpoints when running on iPhone device - iphone

I want to test my app on device and see all the NSLOGs on console while runnig the ap on device.I also want to stop the app at breakpoints but app does not stop on breakpoints and not print NSLOGs .I have unchecked load symbols lazily .I am using a debug build .Please tell me how to achieve this
Thanks in advance
NOTE:After starting the app x code shows the app being debugged is not being run (I think the problem is after xcode transfers the app to device then it disconnects with device)

Do you have breakpoints enabled in xCode?
Should be looking like this;

Try to set breakpoint in the didFinishLaunchingWithOptions then the viewwillappear of the view you want to test the breakpoints on. basically any places before your code (which you want to test) which surely get called.
I had same problem before not exactly sure why does it happen though.
it's like preparing Xcode to look for breakpoints :)

Sounds like you're working with a jailbroken device .. Is that the case ?
If you are , the "official" answer should be "disable mobileSubstrate addons".
I've managed to run the app in debug mode , after :
Doing what you mentioned (got that error message).
Double tap home-button , hold the app icon, close the app..
Run it again from XCode.
Repeat again if necessary.

Related

iOS: Crash when keyboard is used...?

Pretty simple bug:
Pressing any key on my Mac's keyboard causes an "EXC_BAD_ACCESS" error to occur when running an app on the simulator. Unless I'm entering data into a text field that is, where it works fine.
-
Not sure if this is a bug in my app, or somewhere else. If by some chance, someone was using a bluetooth keyboard with my app, then I don't exactly want it crashing willy nilly... small chance I know, but I'd still rather fix it if it's a bug. I've enabled zombies - doesn't tell me anything about where the crash is occurring, and the app still crashes.
Any thoughts or answers are much appreciated, thanks :)
Turning off "Auto-Correction" in the simulator keyboard settings fixed this issue for me.
Screenshot of Keyboard Settings in Simulator:
Seems there are still bugs with the simulator.
This bug is usually attributed to trying to access an instance that has already been released. Check your instances, anything that you allocated, released, and then you are trying to access. It may not even be connected to the keyboard, but maybe a delegate method. Post some code so we can have a better idea of it. For example, the code for the view controller that is running at the time of the crash.
Try to run your app with "Guard Malloc" on. You find this setting when you go to
Manage Scheme -> Run app (on the left side) -> diagnostic (on the top
lashes) -> under Memeory management.
This will show you the crash point where it happens and you should be able to find the reason much more easily

iPhone simulator minimizes the application

I'm debugging my app with the simulator. And for some moment in concrete situation the app gets mimimized. I think there is some problem in my code (Most likely some variable is not initialized, because sometimes everything works) . But how can I catch this moment.
In xcode is still written that the program is running and I can put breakpoints and the will trigger.
And if i will reopen my application it will continue working...
When using device the are no problems too...
How can i catch this moment and pause the program to view a callstack.
EDIT
I Think the problem is here:
Objective-c singleton object does not working as expected
You could try catching it in the - (void)applicationDidEnterBackground:(UIApplication *)application-methode in the app delegate, at least then you will see specifically when it happens.

IPhone SDK : Start my application from scratch when launched again

Here are my issues,
When I install my application on my test device it has the behaviour I want.
However if I close it with the IPhone main button and restart with the icon, it starts back from the view where I left it, whereas I would like it to restart from my main view controller (my start view).
In the same way, I load some animations with viewDidLoad in certain views. I want them to show only the first time the view is loaded each time the application is launched. Right now animations only works the first time the application is launched after installation, then they don't screen anymore when I launch again the application.
Does anyone have a clue ?
Thank you very much for your help.
(Sorry if this topic is a bit easy for you guys :D, I'm quite new at it !)
No problem about being new! This is happening because, for devices from iOS 4.0 on up, your app will support multitasking by default. To disable this features, Add the key
UIApplicationExitsOnSuspend
to your Info.plist file, and set its value to YES. Good luck!
In addition to Sam's answer above, you can also add a key named:
Application does not run in background and set the value to YES.
Both work fine, however.

iphone app only works first time on simulator

I've got an issue with my iphone App and i'm not sure if its an xcode project issue or a code issue (I'm leaning towards xcode project issue at the moment).
If I reset the iphone simulator and build and run my app it works fine. If I then do a build and debug again the app will crash straight away with no meaningful callstack. The app will continue to crash until I remove it and start again. I didn't previously have this issue which makes me think i've just changed some project setting recently by mistake.
Has anyone had this before or can anyone think or a reason for this issue?
Are you saving/retrieving state? Without any other details, that's the first area I'd look into. Also try setting breakpoints and debug to pinpoint the problem.
paul_sns is correct, try setting breakpoint on your AppDelegate class and step-over. Probably you're retreaving a state that is incorrect. You could also activate the debugging console (run the application in debug mode) to see where it crashes (the callstack).
OK I've finally got to the bottom of it. I had quite a lot of memory overwriting going on (a sizing issue with a 2d array) and this was why it wasn't giving me any useful information when it crashed. Thanks for all the help - am glad I stumbled upon the problem before I pulled all my hair out!

Xcode Performance Tool thinks the iPhone simulator has a camera

When I run this code in the Simulator in the debugger or standalone
[UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera]
it tells me the camera is not available (returns NO), as expected.
However, if I run the same code in the simulator in Performance Tool, it returns YES! My code (which works fine on device) then continues to display the camera view in the simulator. If I attempt to capture an image though, I get a console message
photos can only be captured on HW
Which means that if I want to profile my application on the simulator (wouldn't it be nice if it worked on the device!!) I need to go change the code so that it displays the correct view (i.e. not the camera one!).
This does not, from googling, appear to be a well-known issue. Has anyone else experienced it and/or got a workaround?
The obvious workaround is to add an
#if TARGET_IPHONE_SIMULATOR
But that's just icky. The whole point of doing the isSourceTypeAvailable in the first place is to avoid that sort of thing.