Coder Social home page Coder Social logo

lockmenow's Introduction

LockMeNow!

My iPhone 5 lock button is not working properly, so I wrote this application.

Locking the iDevice

Since I want to lock the device, I need to be able to trigger the same functionality iOS does when the lock button is hit. However, Apple does not play nice with its private frameworks. After some research, I found that I need to call the GSEventLockDevice() function which belongs to a private framework GraphicsServices.

The approach I take with this application is to dynamically load the lib and call this function. This is easily done using the dlopen and dlsym functions.

The code looks like this:

char *gsDylib = "/System/Library/PrivateFrameworks/GraphicsServices.framework/GraphicsServices";
void *handle = dlopen(gsDylib, RTLD_NOW);
if (handle) {
  BOOL locked = FALSE;
  void (*_GSEventLockDevice)() = dlsym(handle, "GSEventLockDevice");
  if (_GSEventLockDevice)  {
    _GSEventLockDevice();
    //...
  }
  dlclose(handle);
  //...
}

Limitations

This application can obviously not be accepted (as is) on the Apple Store, and that's mostly why I put it here. If you want to use the application, you will need a developer cert (or a jailbroken device and using the iDevice build toolchain).

Author

You can find me on twitter: @rgaucher

lockmenow's People

Contributors

neuroo avatar

Stargazers

wuting avatar RenderCoder avatar wangwei avatar Alaric Gonzales avatar Zhijin Chen avatar Vitaliy avatar alberto avatar Evgeny Karkan avatar ShenYj avatar Roman avatar weineel avatar  avatar Adam Hanna avatar crafthm avatar williamsxu avatar Cory avatar  avatar  avatar Zahidur Rahman Faisal avatar Sam5 avatar Syed Haris Hussain avatar Alex Zhang avatar Mykola Konyk avatar Marko Tasic avatar Mikey D. avatar  avatar Kevin.Xiao avatar Johnny Tseng avatar Cameron Banga avatar Simon Maddox avatar

Watchers

 avatar James Cloos avatar  avatar

lockmenow's Issues

Needs Jailbrake ?

Does this need jailbroken the device ? I mean is this AppStore safe ? If I use this will APPLE approve ?

iOS 7?

I don't suppose you've found a method for iOS 7 yet???

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.