Skip to main content

Posts

Showing posts with the label try-catch

Try-catch exception handling practice for iPhone/Objective-C

Apologies if this question has already been answered somewhere else, but I could not find any decisive answer when searching on it: I'm wondering when try-catch blocks are to be used in objective-c iPhone applications. Apple's "Introduction to the Objective-C Programming Language" state that exceptions are resource intensive and that one should "not use exceptions for general flow-control, or simply to signify errors." From reading a few related questions here I also gather that people are not often using this method in practice. So I guess the question is: what are the situations when it's appropriate to use try-catch blocks when developing for iPhone/Objective-C and when should they absolutely NOT be used? For example, I could use them to catch beyond bounds and other exceptions when working with objects in arrays. I have a method which performs are few tasks with objects that are passed on in a number of arrays. The method returns nil if an er

App Bypassing the Login-screen, even though it shouldn"t

Whenever I launch my App, even from a new emulator with now files created it still executes the bit of code, that says if the file has been created do this intent, I don't understand, it shouldn't, I have no way of testing, because I have an iPhone not an Android phone, in theory the code should not be called, only on the second time loading the app. Thanks! Code: Public class LogIn extends Activity implements OnClickListener { Button send; EditText user; EditText pass; CheckBox staySignedIn; FileOutputStream Fos; String a; String b; String string = a; String string2 = b; String DANNYISREALLLLYYYGAAYYYYYIMNOTBS; String FILENAME = "userandpass"; @Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); setContentView(R.layout.login); send = (Button) findViewById(R.id.bLogIn); user = (EditText) find

App Bypassing the Login-screen, even though it shouldn"t

Whenever I launch my App, even from a new emulator with now files created it still executes the bit of code, that says if the file has been created do this intent, I don't understand, it shouldn't, I have no way of testing, because I have an iPhone not an Android phone, in theory the code should not be called, only on the second time loading the app. Thanks! Code: Public class LogIn extends Activity implements OnClickListener { Button send; EditText user; EditText pass; CheckBox staySignedIn; FileOutputStream Fos; String a; String b; String string = a; String string2 = b; String DANNYISREALLLLYYYGAAYYYYYIMNOTBS; String FILENAME = "userandpass"; @Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); setContentView(R.layout.login); send = (Button) findViewById(R.id.bLogIn); user = (EditText) find