Dynamic libraries: a.k.a dynamic shared libraries, shared
objects, or dynamically linked libraries
O que por nesse slide???
Slide 27
Slide 27 text
App using static libraries
Source: https://developer.apple.com/library/content/documentation/DeveloperTools/Conceptual/DynamicLibraries/100-Articles/OverviewOfDynamicLibraries.html
Slide 28
Slide 28 text
App using dynamic libraries
Source: https://developer.apple.com/library/content/documentation/DeveloperTools/Conceptual/DynamicLibraries/100-Articles/OverviewOfDynamicLibraries.html
Slide 29
Slide 29 text
Create a new dylib in Swift
Slide 30
Slide 30 text
Use your dylib with Swift
Slide 31
Slide 31 text
Eeeeh!
It’s work!!
Slide 32
Slide 32 text
NO
It’s not work in iOS/
tvOS
Slide 33
Slide 33 text
I sent a e-mail for Apple Engineer support:
I want to compile a dynamic library to use in my apple
tv's application. My dylib is wrote with Swift. I tried (see
"Steps to Reproduce" section), but I can't load my dylib
neither at simulator nor at physical device.
Then I received:
Thank you for contacting Apple Developer Technical
Support (DTS). Our engineers have reviewed your request
and have concluded that there is no supported way to
achieve the desired functionality given the currently
shipping system configurations.
Slide 34
Slide 34 text
2 ATTEMPT
BUNDLES
ND
Slide 35
Slide 35 text
Ohh! I found a Apple’s documentation with a suggestive
name
and, this documentation explain about “Bundle”… but…
what is it?
Slide 36
Slide 36 text
Bundles provide a interface to encapsulate executable
(dylib, for example) and the resources (xib, for example).
Source: https://developer.apple.com/library/content/documentation/CoreFoundation/Conceptual/CFBundles/AboutBundles/AboutBundles.html
Slide 37
Slide 37 text
Somebody make this things to iOS? Or with Swift?
Yes! Somebody make it work in iOS!
So so… Somebody make it work with Swift + Objc-C
Slide 38
Slide 38 text
Then… I created a Proof of Concept purely in Swift with a
app to iOS, to send a AppStore
Slide 39
Slide 39 text
Eeeeh!
It’s work!!
Slide 40
Slide 40 text
NO
I can’t send it to AppStore
Slide 41
Slide 41 text
For some reasons, I can’t send it to AppStore
- problem in certificate in bundle
- size of app
- and others random problems
Slide 42
Slide 42 text
BUT…
THE MAJOR
PROBLEM IS…
Slide 43
Slide 43 text
No content
Slide 44
Slide 44 text
No content
Slide 45
Slide 45 text
OTHER
EXPERIMENTS
- SCRIPT
- LLVM C API
Slide 46
Slide 46 text
1 EXPERIMENT
SCRIPT
ST
Slide 47
Slide 47 text
Maybe another strategy is using not compiled code,
but yes a script to download and execute in run time!
Slide 48
Slide 48 text
With JS, we have a proof of concept to run JS in AppleTV
Slide 49
Slide 49 text
2 EXPERIMENT
LLVM C API
ND
Slide 50
Slide 50 text
What is LLVM?
Well… LLVM is “Low Level Virtual Machine”, and it’s not only
one virtual machine
Source: http://aosabook.org/en/llvm.html
Slide 51
Slide 51 text
Example of C code to LLVM IR
C
LLVM IR
Source: http://aosabook.org/en/llvm.html
Slide 52
Slide 52 text
Then, Alex Desinov created a example of using LLVM C API
with Swift
Slide 53
Slide 53 text
WORKAROUND…
Slide 54
Slide 54 text
Well… We can use a simple workaround…
We could make the app 100% open source and, if the user
wants create a plugin, he will need create a new file in the
project.
Some tools, like Fastlane, can help
Slide 55
Slide 55 text
Create a reflexive code can help…
READ IT IN MY BLOG!! macalogs.com.br
Slide 56
Slide 56 text
SOME OTHERS
THINGS…
Slide 57
Slide 57 text
Like Apple kill the dlopen in NSUserDefault, him can kill
others solutions that appear.
Apple has been closing any way to create a app can execute
arbitrary code, even with respondsToSelector and
performSelector