In my app, when I press a button the method called for that button first assigns my textfield texts directly to NSArray
object like:
val = [[NS
Most probably your app is crashing due to memory issues since it is not crashing in simulator, try to release all objects that you allocate at the points you are done with them.
If you have your custom objects which you allocate and initialize as;
MyCustomClass *myObject = [[MyCustomClass alloc] init];
you need to release them as
[myObject release];
especially if they have members which are assigned big sized images or other kind of data.
If your app starts to crash less after you start solving these memory management issues, it shows that you are on the right way. So keep releasing.
In XCode, go to menu "edit scheme", choose the running configuration and add 'NSZombieEnabled' like in the picture below, when your apps crashes, it will provide you additional infos on the crash that should help you debug it.
EDIT
Note that when your application debug is over, remove the NSZombieEnabled command as it impacts the application performances
Delete the app from simulator/ delete the build file from Mac/ clean the product from XCode and then again run it in simulator. Check if it crashes in simulator now.
Take a look at this link : EXC_BAD_ACCESS signal received. Also, Take NSLog of all the textfield.texts before putting them in array. May be one of them has become nil.it may be a case of memory managemnet...have you released all the objects after their use?
simulator has the memory space of whole of the machine...but iphone has a defined memory of a sandbox for a single app.
All objects involved in array creation using initWithObjects
should be actual objects. There is no enough code in your question to know if lat
and longt
are objects too. Are they?
If they aren't, wrap them with [NSNumber numberWithFloa:<# the float #>
].
If that's not the problem, check SO questions regarding EXC_BAC_ACCESS
to learn to debug them.