Skip to content

Installing ORSSerialPort

Andrew Madsen edited this page Feb 17, 2019 · 9 revisions

There are several ways to add ORSSerialPort to your project. Choose whichever method you're most comfortable with below. The methods are listed roughly in order of my own preference.

Using an Xcode subproject

Xcode sub-projects allow your project to use and build ORSSerialPort as an implicit dependency.

  1. Add ORSSerialPort to your project as a Git submodule:

    $ cd MyXcodeProjectFolder
    $ git submodule add https://github.com/armadsen/ORSSerialPort.git Frameworks/ORSSerialPort
    $ git commit -m "Added ORSSerialPort submodule"
    
  2. Drag Frameworks/ORSSerialPort/Framework Project/ORSSerialPort.xcodeproj into your existing Xcode project

  3. Navigate to your project's settings, then select the target you wish to add ORSSerialPort to

  4. Navigate to Build Phases and expand the Link Binary With Libraries section

  5. Click the + and find ORSSerial.framework.

  6. You should now be able to add #import <ORSSerial/ORSSerial.h> (Objective-C) or import ORSSerial (Swift) to any of your target's source files and begin using ORSSerialPort.

I've posted a video of this process.

Carthage

Using Carthage, you can easily add ORSSerialPort to your project as a pre-built framework. In order to use this method, you must have Carthage installed.

  1. Create a Cartfile for your project.
  2. Add the following line to your Cartfile:
github "armadsen/ORSSerialPort"
  1. In your project directory, run carthage update
  2. Find ORSSerial.framework in Carthage.build/Mac.
  3. Navigate to your project's settings, then select the target you wish to add ORSSerialPort to.
  4. On the General tab, drag ORSSerial.framework from Finder into the "Embedded Binaries" section.
  5. You should now be able to add #import <ORSSerial/ORSSerial.h> (Objective-C) or import ORSSerial (Swift) to any of your target's source files and begin using ORSSerialPort.

Using CocoaPods

You can use CocoaPods to add ORSSerialPort to your project. In order to use this method, you must have CocoaPods installed.

  1. Add the following line to your Podfile:

    pod "ORSSerialPort"
  2. In your project directory, run pod update

  3. You should now be able to add #import <ORSSerialPort/ORSSerialPort.h>, etc. to any of your target's source files and begin using ORSSerialPort.

Manually from source

If you don't want to use CocoaPods or use an Xcode subproject, you can add ORSSerialPort's source directly to your project. For various reasons, I don't recommend using this method, especially if you're relatively new to using Xcode or using third-party libraries.

  1. Add ORSSerialPort to your project as a Git submodule:

    $ cd MyXcodeProjectFolder
    $ git submodule add https://github.com/armadsen/ORSSerialPort.git ThirdParty/ORSSerialPort
    $ git commit -m "Added ORSSerialPort submodule"
    
  2. Drag ThirdParty/ORSSerialPort/Source into your Xcode project, and ensure that you add it to the targets that you wish to use it with.

  3. You should now be able to add #import "ORSSerialPort.h", etc. to any of your target's source files and begin using ORSSerialPort.

Note Please be aware that if you've set Xcode's Link Frameworks Automatically to No then you will need to manually link your target with IOKit.framework.

Use in Sandboxed Applications

No matter which method you use to install ORSSerialPort, if you are using it in a sandboxed application, as required for apps submitted to the Mac App Store, you must add the com.apple.security.device.serial to your application project's sandbox entitlements file:

Sandbox entitlements screenshot

You can’t perform that action at this time.