GithubHelp home page GithubHelp logo

isabella232 / uport-ios-demo Goto Github PK

View Code? Open in Web Editor NEW

This project forked from uport-project/uport-ios-demo

0.0 0.0 0.0 1.37 MB

Demo iPhone app using uPort SDK

License: MIT License

Swift 98.87% Shell 1.13%

uport-ios-demo's Introduction

uPort Demo App for iOS

This repository shows how to setup an iOS app that uses the uPort SDK.

Getting Started With the Demo App

The uPort iOS SDK and its frameworks use Carthage as dependency manager. We chose Carthage over CocoaPods because it's simple and nonintrusive.

Installing Carthage

If you have Homebrew (also known as Brew) installed on your macOS machine, just run:

brew install carthage

Otherwise, you could download and install the latest Cathage.pkg.

Getting the uPort SDK

Now that you have Carthage installed, run the following command (from the root directory of this demo app repository):

carthage update --platform iOS --no-use-binaries --cache-builds

This command is also available from the included build script. So alternatively you can run:

./build

This git-clones the uPort SDK's repositories and subsequently builds them as iOS frameworks.

Running the Demo App

If you open the uPortDemo.xcodeproj Xcode project, the app should build and run on the Simulator.

Feel Free

This demo app uses the MIT license, so it's totally fine to copy and use it as the base of your new app.

Adding the uPort SDK to Your App

Now that you may have had a look at our demo app, let's see how you add the uPort SDK to your app.

1. Copy-Paste the Cartfile

Copy the Cartfile (from this demo app's root directory) to your app directory; preferably place it in the root directory. You need to add this file to your git repository as it tell Carthage where the uPort SDK can be found and which version to use.

If you wish, also copy the build script.

2. Get the uPort SDK

To download and build the SDK's frameworks, run:

carthage update --platform iOS --no-use-binaries --cache-builds

This will create the file Cartfile.resolved by which Carthage keeps track of dependencies. Add this file to your git repository.

3. Ignore Carthage Output

The above command will also create the Cathage/ directory. This directory contains the cloned uPort SDK repositories in subdirectory Carthage/Checkouts/ and the built frameworks in Carthage/Build/.

To prevent adding the uPort source code and binaries to your git repository, add the following lines to your .gitignore file (assuming you run carthage from your root directory (where your Xcode project or workspace is)):

Carthage/Checkouts
Carthage/Build

4. Drag Frameworks Into Xcode Target

Drag all built .framework 'files' from Carthage/Build/iOS/ into your Xcode target's Build Phases > Link Binary With Libraries section.

Currently these are: BigInt.framework, CoreEth.framework, CryptoSwift.framework, openssl.framework, SipHash.framework, Sodium.framework, UPTEthereumSigner.framework, Uport.framework, and Valet.framework.

5. Add Carthage's Copy-Frameworks Run Script

On your application target’s Build Phases tab, click the + icon at top-right and create a New Run Script Phase with the following contents:

/usr/local/bin/carthage copy-frameworks

Then, add the paths to the uPort frameworks under Input Files:

$(SRCROOT)/Carthage/Build/iOS/BigInt.framework
$(SRCROOT)/Carthage/Build/iOS/CoreEth.framework
$(SRCROOT)/Carthage/Build/iOS/CryptoSwift.framework
$(SRCROOT)/Carthage/Build/iOS/openssl.framework
$(SRCROOT)/Carthage/Build/iOS/SipHash.framework
$(SRCROOT)/Carthage/Build/iOS/Sodium.framework
$(SRCROOT)/Carthage/Build/iOS/UPTEthereumSigner.framework
$(SRCROOT)/Carthage/Build/iOS/UPort.framework
$(SRCROOT)/Carthage/Build/iOS/Valet.framework

Finally add the Output Files for this Run Script Phase:

$(BUILT_PRODUCTS_DIR)/$(FRAMEWORKS_FOLDER_PATH)/BigInt.framework
$(BUILT_PRODUCTS_DIR)/$(FRAMEWORKS_FOLDER_PATH)/CoreEth.framework
$(BUILT_PRODUCTS_DIR)/$(FRAMEWORKS_FOLDER_PATH)/CryptoSwift.framework
$(BUILT_PRODUCTS_DIR)/$(FRAMEWORKS_FOLDER_PATH)/openssl.framework
$(BUILT_PRODUCTS_DIR)/$(FRAMEWORKS_FOLDER_PATH)/SipHash.framework
$(BUILT_PRODUCTS_DIR)/$(FRAMEWORKS_FOLDER_PATH)/Sodium.framework
$(BUILT_PRODUCTS_DIR)/$(FRAMEWORKS_FOLDER_PATH)/UPTEthereumSigner.framework
$(BUILT_PRODUCTS_DIR)/$(FRAMEWORKS_FOLDER_PATH)/UPort.framework
$(BUILT_PRODUCTS_DIR)/$(FRAMEWORKS_FOLDER_PATH)/Valet.framework

Remarks:

  1. You may think that this could also be done by adding a New Copy Files Phase where you drag in the frameworks and select Frameworks as Destination. This has indeed the same effect, but carthage copy-frameworks strips x86/Simulator from the framework binaries to work around an old App Store submission issue.
  2. This script works, but some say it's error prone. In case you encounter issues with submitting your app, try this.
  3. Without this step or if you make a mistake (e.g. a typo in one of the Input Files), the app builds. But it fails to run and Xcode prints an error that looks like: dyld: Library not loaded: @rpath/UPort.framework/UPort Referenced from: .../uPortDemo.app/uPortDemo Reason: image not found

For more general details have a look at the Carthage documentation.

Using the uPort SDK In Your Code

Although the SDK consists of a list of frameworks, you only need import UPort for Swift or #import UPort; for Objective-C to include the full SDK.

License

The uPort demo app is released under the MIT License.

This license do not apply to the frameworks used. Please check the frameworks' repositories for their respective licenses.

uport-ios-demo's People

Contributors

meaning-matters avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.