sunshine-protocol / sunshine-keybase-ui-old

Flutter ui for sunshine-keybase
Apache License 2.0
2 stars 0 forks source link

Build iOS app #4

Closed shekohex closed 4 years ago

shekohex commented 4 years ago

Currently, we had issues to build our app into iOS targets, see #1 for more info.

So here is what I tried and it worked for now

  1. Start Clean :)
    $ git clone https://github.com/sunshine-protocol/sunshine-identity-ui.git
  2. Clone sysinfo locally
    $ git clone https://github.com/GuillaumeGomez/sysinfo.git
  3. Edit sysinfo version (downgrade)
    [package]
    name = "sysinfo"
    -version = "0.14.14"
    +version = "0.13.14"
  4. Patch our Cargo.toml files

Path: ./Cargo.toml

[patch.crates-io]
netstat2 = { git = "https://github.com/shekohex/netstat2-rs/", branch = "ios-support" }
sysinfo = { path = "../sysinfo" } # local sysinfo for testing

Path: ./native/identity-client/Cargo.toml

[dependencies]
# we don't use it in code directly..
ed25519-dalek = "=1.0.0-pre.3" # prevent update of ed25519-dalek

and Run cargo update after that (IMPORTANT).

  1. Build The Project using cargo make
$ cargo make ios-release --profile release

that would take a while, get you a cup of coffee or watch a Netflix Movie ;)

okay, after that, Run

$ cargo make post-ios --profile release
  1. Build the flutter App This a sanity check step, to make sure it builds as an iOS app and links everything together.
    $ flutter build -v ios --simulator
  2. Run it start an iOS simulator open -a simulator and
    $ flutter run

That's it, hope it works for you too.

4meta5 commented 4 years ago

I get the following error on step 5

Encountered error while building for simulator.

#0      throwToolExit (package:flutter_tools/src/base/common.dart:14:3)
#1      BuildIOSCommand.runCommand (package:flutter_tools/src/commands/build_ios.dart:101:7)
<asynchronous suspension>
#2      FlutterCommand.verifyThenRunCommand (package:flutter_tools/src/runner/flutter_command.dart:797:18)
#3      _rootRunUnary (dart:async/zone.dart:1198:47)
#4      _CustomZone.runUnary (dart:async/zone.dart:1100:19)
#5      _FutureListener.handleValue (dart:async/future_impl.dart:143:18)
#6      Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:696:45)
#7      Future._propagateToListeners (dart:async/future_impl.dart:725:32)
#8      Future._completeWithValue (dart:async/future_impl.dart:529:5)
#9      Future._asyncCompleteWithValue.<anonymous closure> (dart:async/future_impl.dart:567:7)
#10     _rootRun (dart:async/zone.dart:1190:13)
#11     _CustomZone.run (dart:async/zone.dart:1093:19)
#12     _CustomZone.runGuarded (dart:async/zone.dart:997:7)
#13     _CustomZone.bindCallbackGuarded.<anonymous closure> (dart:async/zone.dart:1037:23)
#14     _microtaskLoop (dart:async/schedule_microtask.dart:41:21)
#15     _startMicrotaskLoop (dart:async/schedule_microtask.dart:50:5)
#16     _runPendingImmediateCallback (dart:isolate-patch/isolate_patch.dart:118:13)
#17     _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:169:5)

full error log

and the following error on step 6:

➜  sunshine-identity-ui git:(master) ✗ flutter run
Launching lib/main.dart on iPhone SE (2nd generation) in debug mode...
Running pod install...                                              1.8s
Running Xcode build...                                                  

Xcode build done.                                            4.2s
Failed to build iOS app
Error output from Xcode build:
↳
    ** BUILD FAILED **

Xcode's output:
↳
    /Users/4meta5/sunshine-protocol/sunshine-identity/sunshine-identity-ui/packages/identity_client/ios/Classes/SwiftIdentityClientPlugin.swift:16:5:
    error: use of unresolved identifier 'last_error_length'
        last_error_length()
        ^~~~~~~~~~~~~~~~~
    note: Using new build system
    note: Building targets in parallel
    note: Planning build
    note: Constructing build description

Could not build the application for the simulator.
Error launching application on iPhone SE (2nd generation).
shekohex commented 4 years ago

Fixed it, and pushed a commit for that 1e82521b8bb415a06a5d88e82255f4e9c3f32bcd

4meta5 commented 4 years ago

It worked 🎉 Let's keep this open until the instructions on the README work (after substrate releases rc5)

4meta5 commented 4 years ago

I'm going to close this in favor of #7 which is a near duplicate, but it has the full instructions.