Updating extensions for iOS 11

From iPhone Development Wiki

Let's collect knowledge like we did with iOS 10, iOS 9, iOS 8 and iOS 7 – paste in your notes and share what you've learned, and somebody else will organize it later. :) If you want to ask questions and share tips over chat with other developers, see How to use IRC for how to connect to #theos and #iphonedev.

Hey developer, you can add your knowledge here! Yes, you! Make an account and edit this page!

If you want to see what's been recently updated on this page, you can use the wiki's history feature to compare the revisions (to look at the diff) since the last time you visited this page.

Screenshots

Since iOS 9.3.3 the SBScreenshotManager has been used. This is no longer the case, it seems. The class still exists, however it doesn't appear to be used anymore. Instead, there is a new framework named "ScreenshotServices" where most of the screenshot abilities have been kicked off to.

However, if the needs are simple, the SpringBoard _class_ has gotten two new methods to kick off screenshots with as well. `takeScreenshot` will be invoked with the hardware keys, at which point you can do what you need. This method won't work when the user invokes a screenshot in another way, like with AssistiveTouch. `takeScreenshot` only calls `takeScreenshotAndEdit:(BOOL)arg1` though, which IS called by AssistiveTouch, so you can use that one instead.

If you have more complex needs, you likely will have to dig into the new services. Here is the decompiled version (Hopper) of `takeScreenshotAndEdit:` for some guidance.

   void -[SpringBoard takeScreenshotAndEdit:](void * self, void * _cmd, bool arg2) {
       ...
       r21 = arg2;
       r20 = self;
       r19 = [SSScreenCapturerPresentationOptions new];
       if ([SSScreenCapturer shouldUseScreenCapturerForScreenshots] != 0x0) {
               [r19 setPresentationMode:r21];
               [r20->_screenCapturer takeScreenshotWithPresentationOptions:r19];
       }
       else {
               [r20->_screenshotManager saveScreenshots];
       }
       ...
       return;
   }

Other avenues for screenshots I found while researching were:

- `SBCombinationHardwareButtonActions`s method `-(void)performTakeScreenshotAction` which also did not work with AssistiveTouch.

- `SSScreenCaptureAbilityCheck`s method `-(bool)isAbleToTakeScreenshots` which seems to be always called. I didn't track down exactly from where it was called yet. I didn't need it.