Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: support iOS #381

Closed
eseidel opened this issue Apr 26, 2023 · 26 comments
Closed

feat: support iOS #381

eseidel opened this issue Apr 26, 2023 · 26 comments
Assignees

Comments

@eseidel
Copy link
Contributor

eseidel commented Apr 26, 2023

A placeholder bug for our eventual iOS support. Please feel encouraged to upvote this bug to let us know if this is important to you.

@Andrius0124
Copy link

Thanks for starting this crucial service for the Flutter ecosystem.
Just wanted to ask if we have a roadmap for iOS support.
In my personal view, I think iOS is more important than Android as Google reviews take usually 30 mins whereas Apple could take days.

@ArkerX
Copy link

ArkerX commented May 1, 2023

the code push service available in China?

@eseidel
Copy link
Contributor Author

eseidel commented May 1, 2023

the code push service available in China?

We have not tested in China yet. Happy to work with you to figure it out. Please reach out on Discord: https://discord.gg/shorebird

See also #435

@ritesh24
Copy link

ritesh24 commented May 1, 2023

Super egerly waiting for code push for iOS. App updates takes more time in case of iOS rather than Android. If would be nice if iOS support can also be prioratized?

@mralbertchen
Copy link

Seconded. We are waiting for this to be supported before adopting Shorebird!

@animeshjain
Copy link

Would love iOS support. I build a multiplayer app (android + ios, and flutter web planned to launch soon), so not having iOS is a bit of a deal breaker :/

@joshuadutton
Copy link

Huh, a GitHub issue that actually encourages +1 and "me too" (count this as a "me too")

@jaredanderton
Copy link

Agreed, Flutter is the best way to do cross platform. So iOS support is a hard requirement for me. Support that and I'm onboard :)

@TRemigi
Copy link

TRemigi commented May 2, 2023

👍

@aler
Copy link

aler commented May 3, 2023

code push is not allowed by the app store guidelines

2.5.2 Apps should be self-contained in their bundles, and may not read or write data outside the designated container area, nor may they download, install, or execute code which introduces or changes features or functionality of the app, including other apps. Educational apps designed to teach, develop, or allow students to test executable code may, in limited circumstances, download code provided that such code is not used for other purposes. Such apps must make the source code provided by the app completely viewable and editable by the user.

https://developer.apple.com/app-store/review/guidelines

@nilsreichardt
Copy link
Contributor

@aler https://github.com/microsoft/react-native-code-push#app-store

@aler
Copy link

aler commented May 3, 2023

@nilsreichardt it does make an exception for JavaScript code that works for ReactNative apps. Not sure how that enables Dart code push, especially considering you probably won't be pushing Dart code but pushing AOT snapshots instead.

@eseidel
Copy link
Contributor Author

eseidel commented May 3, 2023

Dart has lots of ways to compile to interpreted code (including JavaScript). We're evaluating exactly which set of options will provide the best experience for devs, but whatever we release will of course help devs comply with the App Store guidelines. Code Push is incredibly common in the industry. All the largest apps I know of use some form of code push. Many use JavaScript yes (via React Native, WebViews, ionic, or just running JS in JavaScriptCore), others also use other interpreted languages (like lua in games). Code Push (despite earlier complaints from stores) is very well trodden ground, the question is just how best to wire it up for Dart, since as others have suggested Dart (intentionally) does not use interpreted code on iOS today. I'm working on writing up our options now, which may include us even writing our own (new) interpreter for Dart. We'll see.

@Andrius0124
Copy link

@aler Apple allows it as long as it's not introducing new functionality. Hotfixes are completely fine to be updated over the air. With Shorebird it will be down to us developers to follow the guidelines or not.

@eseidel
Copy link
Contributor Author

eseidel commented May 4, 2023

Just wanted to note that I've started working on planning our iOS support. It may take us several weeks to get something working though. Will update when I know more.

@eseidel eseidel self-assigned this May 4, 2023
@eseidel eseidel moved this to In Progress in 0.1.0: Open beta May 4, 2023
@bgoncharuck
Copy link

Code push makes sense only in iOS

@eseidel eseidel moved this from In Progress to Done in 0.1.0: Open beta May 9, 2023
@eseidel eseidel moved this from Done to Punted in 0.1.0: Open beta May 9, 2023
@eseidel eseidel moved this to In Progress in 0.2.1 : 100 users May 9, 2023
@bartekpacia
Copy link

I'm genuinely curious about how you accomplish this.

If anyone's interested, here are the "notes on codepush".

@xalikoutis
Copy link

xalikoutis commented Jun 4, 2023

Just find out shorebird , we are a flutter team that maintains a a white label e-learning app.
Patches and updates in apple store is an nightmare that we live 2-3 times per month.
We will speak soon....

@eseidel eseidel moved this from In Progress to Todo in 0.2.1 : 100 users Jun 5, 2023
@eseidel eseidel moved this from Todo to In Progress in 0.2.1 : 100 users Jun 5, 2023
@eseidel eseidel moved this from In Progress to Todo in 0.2.1 : 100 users Jun 5, 2023
@jaketothepast
Copy link

Hi, with iOS support I will subscribe. Flutter developer here that also hates the app store approval processes :)

@eseidel
Copy link
Contributor Author

eseidel commented Jun 7, 2023

It works! https://youtu.be/7KDgFvdogsE

We have some work before it's ready for production, but we'll be releasing initial support to customers in the coming days/weeks.

@eseidel eseidel moved this from Todo to Punted in 0.2.1 : 100 users Jun 9, 2023
@eseidel eseidel moved this to Todo in fluttercon Jun 9, 2023
@eseidel eseidel moved this from Todo to In Progress in fluttercon Jun 9, 2023
@eseidel eseidel moved this from In Progress to Punted in fluttercon Jun 29, 2023
@maks
Copy link

maks commented Jul 12, 2023

@eseidel In your prior comment you noted all the existing publicly known code push on iOS users make use of interpreted languages as explicitly allowed in section 3.3.2 of the Apple Developer Program License Agreement, so now that you've got the post above of the demo of Shorebird working on iOS, are you able to comment on how it works?
Is it shipping Dart source via patches to the iOS app which then runs the patched Dart source with the Dart VM running interpreter mode? Or did you end up writing your own new Dart interpreter as mentioned you might do?

@eseidel
Copy link
Contributor Author

eseidel commented Jul 12, 2023

iOS is currently blocked on me fixing a two remaining crashers in our custom Dart interpreter. Our Dart interpreter is based on the Google Dart team's ARM Simulator (which they use for testing/debugging ARM compiler logic from non-ARM machines) and never had support for "ffi" code (which is required by Flutter to run). We added support for ffi (hence our previous demo), but that support is somewhat complicated (I had to write some custom arm64 assembly) and I'm still shaking out the last few bugs. Given the low-level of the system each bug requires several hours of concentrated time to fix. Now that I'm back from FlutterCon this is my #1 priority.

Good news is we also have a Dart compiler expert joining us in 2 weeks time, at which point our pace on iOS should dramatically increase (since I have other responsibilities beyond iOS hacking). Thanks for your patience.

Two known blockers:

You can see other known iOS issues (which will not block release) with iOS label: ios

@eseidel
Copy link
Contributor Author

eseidel commented Jul 12, 2023

@eseidel In your prior comment you noted all the existing publicly known code push on iOS users make use of interpreted languages as explicitly allowed in section 3.3.2 of the Apple Developer Program License Agreement, so now that you've got the post above of the demo of Shorebird working on iOS, are you able to comment on how it works? Is it shipping Dart source via patches to the iOS app which then runs the patched Dart source with the Dart VM running interpreter mode? Or did you end up writing your own new Dart interpreter as mentioned you might do?

We ended up taking the Dart "Simulator" and modifying it to support Flutter. So it's an interpreter, yes, but the odd part is that the format that it interprets is a subset of ARM64, which is less efficient than say the previous Dart interpreter was (which interprets a higher-level format). The benefit of using a subset of ARM64, is that it makes the second part of our design easier/possible, in that we intend to only run your new code in the interpreter, and whenever possible have our fork of Dart know how to jump back into the pre-compiled (and pre-signed) ARM64 code included in the IPA. That second part (which we're currently calling the "linker") doesn't work yet, but will soon. Right now focused on fixing bugs in our interpreter so that part can launch and we'll follow up with the (massive) speed improvements from the "linker" in the weeks after "iOS preview" launches.

@maks
Copy link

maks commented Jul 12, 2023

Thanks @eseidel, that all makes sounds reasonable given the requirements of Apples TOS and I must say wow, its a very impressive technical achievement to get that done! Using the ARM64 simulator actually does make very good sense given your requirements here and is really a variation on the use of WASM by both browsers, other app clients and server-side.

And thank you for being so open about the details on the implementation and your plan for supporting iOS.

To be honest, your responses here have actually completely changed my outlook on Shorebird: from being ambivalent about it due to Apple TOS restrictions, to now being excited about the possibilities it brings to Flutter app dev-ops and to being happy to use it with both my own apps and recommend it on future client projects.

Very much looking forward to being able to test out Shorebird on Android and iOS in the near future 👍🏻

@eseidel
Copy link
Contributor Author

eseidel commented Jul 18, 2023

I've spent the last week working on #829, turns out it blocks any progress on #654 as well. I'm close. I have my in-ffi-callback-calling-back-to-Simulator trampoline working, it's able to call Dart code and have the Dart code execute and return. Currently the Dart code is smashing the C stack so it crashes after executing the Dart, but I think I know why and I'm hopeful I may be able to get past that today. 🤞 Given how difficult modifying this code is (for me) I don't have a firm timeline on when iOS preview will be ready, but I'm still trying to ship it in the next two weeks (July) as promised.

As we announced yesterday, @kmillikin is joining our team in two weeks and I expect will greatly accelerate our work here. He knows the Dart VM, compilers and assembly much better than I do. I'm still hoping to have iOS Preview launched before he joins and then he and I will work to finish the (probably couple months of) work to get iOS up to full speed execution and reach feature parity with our Android offering.

@eseidel eseidel moved this to Todo in iOS Alpha Jul 25, 2023
@eseidel eseidel moved this from Todo to In Progress in iOS Alpha Jul 25, 2023
@eseidel
Copy link
Contributor Author

eseidel commented Jul 26, 2023

As of 0.11.0, Shorebird now supports iOS! 🎉
https://github.com/shorebirdtech/shorebird/blob/main/RELEASE_NOTES.md#0110-july-26-2023

We've called this "alpha" as there may be unforeseen bugs in this first release. The main work to this release was building a custom interpreter for Dart for iOS. This was done as part of complying with the App Store guidelines. In this alpha release, Dart code always runs in this interpreter (even with no updates) which makes it needlessly slow. We'll be making this all much faster in the coming months.

Please let us know if you encounter any issues!

I'm closing this issue for now. Lots left to do, but we'll track that work in other issues.

@eseidel eseidel closed this as completed Jul 26, 2023
@github-project-automation github-project-automation bot moved this from In Progress to Done in iOS Alpha Jul 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Status: Punted
Status: Punted
Status: Punted
Status: Done
Development

No branches or pull requests