Skip to content

NBUKit Installation

Ernesto Rivera edited this page May 28, 2013 · 5 revisions

Cocoapods (Recomended)

For versions 1.9.0 and up

  1. Install Cocoapods if not already done.
    • $ [sudo] gem install cocoapods
    • $ pod setup
  2. Add pod 'NBUKit' to your Podfile.
  3. Install the dependencies for your project.
    • $ pod install

If you have a problem try gem update cocoapods first.

Manual Installation

For versions 1.5.x and up to 1.8.x

1. Add the NBUKit project and config files to your project

  • Drag NBUKit.xcodeproj and .xcconfig files from the Finder to your project.
    Add files

  • Uncheck the Add to targets option.
    Add files' options

2. Set-up the configuration files

  • Choose the NBUKit_Debug, NBUKit_Testing or NBUKit_Production for each configuration.
    Configuration

3. Edit your target's build phases

  • Add NBUKit as a Target dependency.
    Build phases

  • Add a new Run Script build phase:

# Copy NBUKit.framework resources to NBUKitResources.bundle
echo "Copy NBUKit.framework resources..."
SOURCE_PATH="${DEPENDENCIES_BUILD_DIR}/NBUKit.framework/Resources/"
if [ ! -d "$SOURCE_PATH" ]; then
    SOURCE_PATH="${TARGET_BUILD_DIR}/NBUKit.framework/Resources/"
fi
echo "From: $SOURCE_PATH"
TARGET_PATH="${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/NBUKitResources.bundle"
echo "To: $TARGET_PATH"
mkdir -p "$TARGET_PATH"
cp -R "$SOURCE_PATH" "$TARGET_PATH"

4. Optionally edit your target's Info.plist

  • Set your Bundle display name and Bundle identifier to ${DISPLAYNAME} and ${BUNDLEID} respectively.
    Info.plist

  • You can customize the settings for each configuration.
    Customize

5. Import NBUKit header files

  • Import NBUKit.h in your Prefix.pch file to have access to all NBUKit classes from all your files.
// Prefix.pch
#import <Availability.h>
#ifdef __OBJC__
    #import <UIKit/UIKit.h>
    #import <Foundation/Foundation.h>
    #import <NBUKit/NBUKit.h>
#endif
  • Or manually import headers.
// AppDelegate.m
#import "AppDelegate.h"
#import <NBUKit/NBUMailComposeViewController.h>
#import <NBUKit/UIImage+NBUAdditions.h>