Search code examples
ioscamerajailbreak

how quick shoot tweak works on jailbreak iOS device


as we know, iOS doesn't support background camera.but jailbreak tweak quick shoot can do it. i want to know how it works.it used some special lib?


Solution

  • No, you don't need any specials libs. You can use public APIs from AVFoundation.framework. With AVCaptureSession you can take photos and record videos inside a daemon or a tweak. And as far as I know you can do this even with regular AppStore apps while being in background.

    I've done both and on iOS 5-6 it works just like that. On iOS 7 Apple protected microphone and camera with entitlements. If you try to access them inside a daemon you will just get an error while trying to capture photo, video or audio. No dialogs will be shown. In the console you will see a message saying you can't access camera or microphone.

    In order to solve this issue you need to sign your daemon with special entitlements. Add com.apple.private.tcc.allow key with array value. Then insert into that array the following string items: kTCCServiceMicrophone, kTCCServiceCamera. It should look like that

    <key>com.apple.private.tcc.allow</key>
    <array>
        <string>kTCCServiceMicrophone</string>
        <string>kTCCServiceCamera</string>
    </array>
    

    If you want to capture photo/video/audio in a daemon you just need to sign it with the entitlements. If you want to do it inside a tweak you need to be sure which app will be loading your tweak as it's this app that needs to be signed with the entitlements. Let's say, you want to do it in a SpringBoard tweak. Just open SpringBoard binary with any text editor and search for <key> string. You will find entitlements among which will be entitlements we need. Fortunately, SpringBoard on iOS 7 already signed with the entitlements that allow him to use camera and microphone.