Create an account

Very important

  • To access the important data of the forums, you must be active in each forum and especially in the leaks and database leaks section, send data and after sending the data and activity, data and important content will be opened and visible for you.
  • You will only see chat messages from people who are at or below your level.
  • More than 500,000 database leaks and millions of account leaks are waiting for you, so access and view with more activity.
  • Many important data are inactive and inaccessible for you, so open them with activity. (This will be done automatically)


Thread Rating:
  • 708 Vote(s) - 3.48 Average
  • 1
  • 2
  • 3
  • 4
  • 5
What's a reliable way to make an iOS app crash?

#11
a wrong `NSLog` statement will do it

NSLog(@"%@",1);
Reply

#12
How about a good old stack overflow :)

- (void)stackOverflow
{
[self stackOverflow];
}
Reply

#13
I use

[self doesNotRecognizeSelector:_cmd];
Reply

#14
Send a message to a deallocated object
Reply

#15
When working with RubyMotion I use this:

n=Pointer.new ('c', 1)
n[1000] ='h'
Reply

#16
in Objective-C use C directly to cause a bad access

strcpy(0, "bla");

*Note: while this works on any system I know -- in a future version of the C runtime OR the compiler this might not lead to a crash anymore. see

[To see links please register here]

)*

(in swift you would have to bridge to objC to do this)
Reply

#17
Try this:

- (IBAction)Button:(id)sender
{
NSArray *array = [NSArray new];
NSLog(@"%@",[array objectAtIndex:8]);
}
Reply

#18
I think in Swift you could easily throw a fatal error:

func foo() {
fatalError("crash!")
}

It is actually even intended to use this feature in case something goes wrong in order to make the app crash.

To avoid an if statement in a special case, you could use `precondition`, too. It's similar to `assert`, makes thus the intention (if wanted) pretty clear and is _not_ removed in the final release as `assert`. It is used like `precondition(myBoolean, "This is a helpful error message for debugging.")`.
Reply

#19
Most popular one - unrecognised selector crash:

NSObject *object = [[NSObject alloc] init];
[object performSelector:@selector(asfd)];
Make sure you don't have -asdf method implemented in that class haha

Or index beyond bound exception:

NSArray * array = [NSArray array];
[array objectAtIndex:5];

And of course
`kill( getpid(), SIGABRT );`
Reply



Forum Jump:


Users browsing this thread:
1 Guest(s)

©0Day  2016 - 2023 | All Rights Reserved.  Made with    for the community. Connected through