mirror of
https://github.com/thestk/stk
synced 2026-01-11 20:11:52 +00:00
update iOS Demos
This commit is contained in:
@@ -1,20 +1,24 @@
|
||||
This file contains instructions for integrating the STK in Xcode projects and solutions to common integration issues.
|
||||
# Readme
|
||||
|
||||
* [Setup](#setup)
|
||||
* [Usage](#usage)
|
||||
* [Troubleshooting](#troubleshooting)
|
||||
|
||||
## Setup
|
||||
|
||||
### If you have [CocoaPods](https://cocoapods.org)
|
||||
### [CocoaPods](https://cocoapods.org) (Recommended)
|
||||
|
||||
1. Add `pod 'STK', '~> 4.5'` to your Podfile.
|
||||
1. Add `pod 'STK', '~> 4.6'` to your Podfile.
|
||||
|
||||
1. Run `pod install`
|
||||
|
||||
### If you don't have CocoaPods
|
||||
### Manual
|
||||
|
||||
1. Clone or [download][download_link] the STK into your project's directory.
|
||||
|
||||
1. Open the **STK for iOS** folder, and drag and drop **STK.xcodeproj** into your Xcode project.
|
||||
|
||||
1. Open your project's settings, open the *Build Phases* tab. In the *Link Binary with Libraries* section, add **libSTK.a**.
|
||||
1. Open your project's settings, open the *Build Phases* tab. In the *Link Binary with Libraries* section, add **libSTK.a**.
|
||||
![][linking_libSTK_screenshot]
|
||||
|
||||
1. In your project's settings, open the *Build Settings* tab. In the *Search Paths* section, double click on the field to the right of *Header Search Paths*, and add the path to the STK's **include** directory relative to your Xcode project's directory.
|
||||
@@ -23,13 +27,13 @@ This file contains instructions for integrating the STK in Xcode projects and so
|
||||
|
||||
## Usage
|
||||
|
||||
1. Import the STK classes in the source files you require.
|
||||
1. Import the STK classes you require in your Objective-C source files (Swift does not yet support importing C++ code)
|
||||
* E.g. `#import "SineWave.h"`
|
||||
|
||||
1. Change the extension of Objective-C files that import STK files to **.mm**.
|
||||
1. Change the extension of any Objective-C files that import STK files to **.mm**.
|
||||
* E.g. **ViewController.m** —> **ViewController.mm**
|
||||
|
||||
You can also look at the [iOS Demo project](..projects/demo/iOS%20Demo) for a sample usage.
|
||||
See the [iOS Demo project](..projects/demo/iOS%20Demo) for a sample usage.
|
||||
|
||||
|
||||
## Troubleshooting
|
||||
@@ -38,16 +42,16 @@ You can also look at the [iOS Demo project](..projects/demo/iOS%20Demo) for a sa
|
||||
|
||||
If you get this error when `#import`ing an STK header, you have added the wrong header search path for the STK in your project's settings (see Step 4 in Setup)
|
||||
|
||||
The STK's header search path you need to add is the path to the STK's **include** directory relative to your project's directory (as if you were `cd`ing into it). For example, it is `stk/include/` if the stk directory is inside your project's directory, but it is `../stk/include/` if both share the same directory.
|
||||
The STK's header search path you need to add is the path to the STK's **include** directory relative to your project's directory (as if you were `cd`ing into it). For example, it is `stk/include/` if the stk directory is inside your project's directory, but it is `../stk/include/` if both share the same directory.
|
||||
|
||||
If this problem doesn't go away:
|
||||
|
||||
1. Delete **STK.xcodeproj** from your Xcode project
|
||||
1. Move the STK directory within your project's directory.
|
||||
1. Move the STK directory within your project's directory.
|
||||
1. Follow step 1 from **Setup**, add `stk/include` to the *Header Search Paths*.
|
||||
|
||||
If that doesn't solve it:
|
||||
Install CocoaPods and use it to install the STK. It takes one minute and will make your life easier. Visit the [CocoaPods website](https://cocoapods.org) for installation instructions.
|
||||
Install CocoaPods and use it to install the STK. It takes one minute and will make your life easier. Visit the [CocoaPods website](https://cocoapods.org) for installation instructions.
|
||||
|
||||
### FileRead::open: could not open or find file (../../rawwaves/filename.raw)!
|
||||
|
||||
@@ -56,16 +60,16 @@ If you use a class that makes use of raw waves (such as `Mandolin`, `Wurley`, or
|
||||
|
||||
#### If you're using CocoaPods
|
||||
|
||||
Add this code before using a class that needs the raw waves:
|
||||
Add this code before using a class that needs the raw waves:
|
||||
```objective-c
|
||||
stk::Stk::setRawwavePath([[[NSBundle mainBundle] pathForResource:@"rawwaves" ofType:@"bundle"] UTF8String]);
|
||||
```
|
||||
|
||||
#### If you're not using CocoaPods
|
||||
|
||||
1. Open your project's settings, open the *Build Phases* tab.
|
||||
1. In the *Copy Bundle Resources*, drag and drop **rawwaves.bundle** (it's located in **STK.xcodeproj**'s **Helpers** folder).
|
||||
1. Then add this code before using a class that needs the raw waves:
|
||||
1. Open your project's settings, open the *Build Phases* tab.
|
||||
1. In the *Copy Bundle Resources*, drag and drop **rawwaves.bundle** (it's located in **STK.xcodeproj**'s **Helpers** folder).
|
||||
1. Then add this code before using a class that needs the raw waves:
|
||||
|
||||
```objective-c
|
||||
NSBundle *rawwaveBundle = [NSBundle bundleWithURL:[[NSBundle mainBundle] URLForResource:@"rawwaves" withExtension:@"bundle"]];
|
||||
@@ -80,12 +84,12 @@ This means that **rawwaves.bundle** hasn't been copied to the build folder, so y
|
||||
Select the rawwaves scheme:
|
||||
|
||||
![][rawwaves_scheme_screenshot]
|
||||
|
||||
Build it (⌘+B) then build your project's main scheme.
|
||||
|
||||
Build it (⌘+B) then build your project's main scheme.
|
||||
|
||||
### Apple Mach-O Linker Error
|
||||
|
||||
This means that **STKLib.a** isn't being linked to your binary. Follow step 2 above in [Setup](#setup).
|
||||
This means that **STKLib.a** isn't being linked to your binary. Follow step 2 above in [Setup](#setup).
|
||||
|
||||
|
||||
[download_link]: https://github.com/thestk/stk/archive/master.zip
|
||||
|
||||
Reference in New Issue
Block a user