Git Product home page Git Product logo

restart-ios's Introduction

How to restart iOS in 20 lines of code

Download this project and install the app on your iOS device. It will allow you to seemingly restart the operating system by simply opening the app!

Requirements

Only works on iOS 7.1 with iPhone 5 or older (including iPhone 5c). i.e. it will not work on iPhone 5s.

How it works

The only lines of code that do anything in this app are the following:

- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath
{
  UICollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"MyCell" forIndexPath:indexPath];
  UIView *subView = [[UIView alloc] initWithFrame:cell.bounds];
  [cell addSubview:subView];
  
  // The following lines of code cause the crash, all three lines are required.
  cell.layer.cornerRadius = 1;
  subView.layer.shadowOpacity = 1;
  subView.layer.borderWidth = 1;
  
  return cell;
}

There may be other ways to acheive the same result, but by having these lines of code in the app, the app will cause SpringBoard to crash and restart, appearing to the average user that the operating system has restarted.

It's very simple when broken down:

  • Dequeue a collection view cell in the usual way and add a subview to it
  • Set the cell's corner radius to non-zero
  • Set the subview's shadow opacity to non-zero
  • Set the subview's border width to non-zero

Easy, huh? But by removing any one of these lines, the app will run normally with no effect on the processes of the operating system.

Disclaimer

This works by taking advantage of a bug in backboardd, the daemon that runs alongside the SpringBoard daemon. The few lines of code in the app cause the daemon to crash, in turn causing SpringBoard to restart. The daemon has been witnessed to get into a state whereby this crash doesn't occur, and under such conditions, this app will not work. If this is the case for you -- and you have confirmed your device meets the Requirements -- please restart your device manually to witness this great app in action.

Disclaimer #2

If you hadn't realised already, this is kind of a joke. I wouldn't expect an app of any size to cause the operating system to crash, least of all an app written in only 20 lines of code. Apple have been made aware of this and are investigating it.

Hopefully with this app in mind, if you notice strange things in your own apps causing the backboardd daemon to terminate after updating to iOS 7.1, you will be able to diagnose the problem more easily.

If you like this project, why not follow me on twitter?

restart-ios's People

Contributors

samdods avatar

Stargazers

Mighel avatar tony eve avatar Kai Li avatar ThomasW avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.