2

Is there a way to know the size of iOS Share Extension app?

Brief context : I am implementing custom share extension in my App (Swift). I am trying to make it such that extension's loading time is quick. In apple documentation it is recommended to do so, otherwise extension app won't be launched. Apple documentation mentions a time of around 1 second to complete "extension launching task".

enter image description here

Measures:

Because of sandboxing, extension is not (directly) communicating with app and therefore, I am loading significant amount of data from NSUserDefaults to load the extension (through suite/app groups). This is causing some time issues

I am not able to calculate what exact time I'm taking to load the extension Or how close I am to the threshold time setup by Apple Docs, which is 1 second. The extension works fine though, but I'm not sure.

Online somewhere I read that keeping the file size under 5 MB helps, and so I'm trying to keep it under that. Any idea how to find the extension app size so that I can compare and check?

Source for the information that suggests 5MB size

Akshansh Thakur
  • 5,163
  • 2
  • 21
  • 38
  • "I am not able to calculate what exact time I'm taking". Why not? Why can't you log the time you start to read the data from NSUserDefaults and then log the time you have finished for example? – Gruntcakes Jul 07 '16 at 18:47
  • I would not want to do that. Because on the top of NSUserDefault data, I am also accessing context inside extensionContext property of controller. That also adds time, and then constraints in the view.. everything combined together is indicative of how much time I'm taking, not just the UserDefaults. @SausageModulationMatrix – Akshansh Thakur Jul 07 '16 at 18:48
  • Why take things so literally - I said "for example". You know when you start doing things and you know when you stop. You have logging available. Its up to you where you want to put those logging statements. Another option may be to use Xcode's profiling tools. – Gruntcakes Jul 07 '16 at 18:57
  • Haha.. okay @SausageModulationMatrix. I will try something along those lines. However, it would be best if i could get the size. That's what I'm looking for :) Thanks for input though! There is also a very cruel bug through which I'm not able to debug the extension using photos app. – Akshansh Thakur Jul 07 '16 at 19:00
  • Here's a popular answer : http://stackoverflow.com/questions/24031612/how-to-debug-ios-8-extensions-with-nslog And I'm facing the same issues, breakpoints are working fine. but logs don't appear :( – Akshansh Thakur Jul 07 '16 at 19:01
  • Logging in extensions won't appear in Xcode if you are running the container app, but you should be able to view it in Xcode's devices output. I'm able to interactively debug extensions and view the log output in Xcode main output window by choosing Debug | Attach to Process by PID or Name then typing in the name of the target of the extension, then when the extension executes you can step through it in the debugger or just view its logging appear in the console. Logging works for me, but I'm using Xcode 8. – Gruntcakes Jul 07 '16 at 19:07
  • I don't know if there's a direct way of viewing the size, but there's lots of mac tools that allow you to browse the iOS filesystem and see your app and view its attributes. – Gruntcakes Jul 07 '16 at 19:09

0 Answers0