As you might have noticed, we changed our product name from PubNativeLite to HyBid. We tried so hard to minimize the work for the migration process but still, there are some steps that you need to do in your app so that HyBid.framework works properly. This article aims to help you in that manner. Ready...? Let's start.

Required Steps

  1. Locate the PubnativeLite.framework in your Project Navigator and delete it.
267

(Choose Move to Trash when Xcode shows you the prompt screen.)

534
  1. Download the latest release of HyBid.framework and simply drag and drop it to Embedded Binaries section on project configuration page.

  2. Update your existing Run Script to the new one down below.

APP_PATH="${TARGET_BUILD_DIR}/${WRAPPER_NAME}"

find "$APP_PATH" -name 'HyBid.framework' -type d | while read -r FRAMEWORK
do
    FRAMEWORK_EXECUTABLE_NAME=$(defaults read "$FRAMEWORK/Info.plist" CFBundleExecutable)
    FRAMEWORK_EXECUTABLE_PATH="$FRAMEWORK/$FRAMEWORK_EXECUTABLE_NAME"
    echo "Executable is $FRAMEWORK_EXECUTABLE_PATH"

    EXTRACTED_ARCHS=()

    for ARCH in $ARCHS
    do
        echo "Extracting $ARCH from $FRAMEWORK_EXECUTABLE_NAME"
        lipo -extract "$ARCH" "$FRAMEWORK_EXECUTABLE_PATH" -o "$FRAMEWORK_EXECUTABLE_PATH-$ARCH"
        EXTRACTED_ARCHS+=("$FRAMEWORK_EXECUTABLE_PATH-$ARCH")
    done

    echo "Merging extracted architectures: ${ARCHS}"
    lipo -o "$FRAMEWORK_EXECUTABLE_PATH-merged" -create "${EXTRACTED_ARCHS[@]}"
    rm "${EXTRACTED_ARCHS[@]}"

    echo "Replacing original executable with thinned version"
    rm "$FRAMEWORK_EXECUTABLE_PATH"
    mv "$FRAMEWORK_EXECUTABLE_PATH-merged" "$FRAMEWORK_EXECUTABLE_PATH"

done
  1. Update the parts where you add the PubnativeLite.framework to your code.
import PubnativeLite

to

import HyBid
#import <PubnativeLite/PubnativeLite.h>

to

#import <HyBid/HyBid.h>
  1. Update the init() method.
PubnativeLite.initWithAppToken("<YOUR_APP_TOKEN_HERE>") { (sucess) in
            print("PubnativeLite initialisation completed")
        }

to

HyBid.initWithAppToken("<YOUR_APP_TOKEN_HERE>") { (sucess) in
            print("HyBid initialisation completed")
        }
[PubnativeLite initWithAppToken:@"<YOUR_APP_TOKEN_HERE>" completion:^(BOOL success) {
            NSLog(@"PubnativeLite initialisation completed");
    }];

to

[HyBid initWithAppToken:@"<YOUR_APP_TOKEN_HERE>" completion:^(BOOL success) {
            NSLog(@"HyBid initialisation completed");
    }];

Well... That's it! After this step, just try to build your project and Xcode will inform you where the code needs to be updated. (In order to help you, we have even added some warnings to HyBid.framework to show you those classes and/or protocols etc.)

822

We highly encourage you to take those warnings into consideration and update any class/protocol names.

The following part can guide you if you set up an advanced configuration with the SDK.

Changes in the Advanced Configurations (Optional)

If your app is COPPA compliant

PubnativeLite.setCoppa(Bool)

to

HyBid.setCoppa(Bool)
[PubnativeLite setCoppa:BOOL];

to

[HyBid setCoppa:BOOL];

Test Mode

PubnativeLite.setTestMode(Bool)

to

HyBid.setTestMode(Bool)
[PubnativeLite setTestMode:BOOL];

to

[HyBid setTestMode:BOOL];

Targeting

var targeting = PNLiteTargetingModel()
targeting.age = <AGE>
targeting.interests = <ARRAY_OF_THE_INTERESTS>
targeting.gender = "<GENDER>"     // "f" for female, "m" for male
PubnativeLite.setTargeting(targeting)

to

var targeting = HyBidTargetingModel()
targeting.age = <AGE>
targeting.interests = <ARRAY_OF_THE_INTERESTS>
targeting.gender = "<GENDER>"     // "f" for female, "m" for male
HyBid.setTargeting(targeting)
PNLiteTargetingModel *targeting = [[PNLiteTargetingModel alloc] init];
targeting.age = <AGE>;
targeting.interests = <ARRAY_OF_THE_INTERESTS>;
targeting.gender = "<GENDER>";     // "f" for female, "m" for male
[PubnativeLite setTargeting:targeting];

to

HyBidTargetingModel *targeting = [[HyBidTargetingModel alloc] init];
targeting.age = <AGE>;
targeting.interests = <ARRAY_OF_THE_INTERESTS>;
targeting.gender = "<GENDER>";     // "f" for female, "m" for male
[HyBid setTargeting:targeting];

If you are using the adapters, the following part can guide you in your migration.

Integrate The Adapters (Optional)

Ensure that you've imported the updated PubnativeLite/PubnativeLiteDemo/Adapters folder and all of its contents to your project.

Swift Integration

To use the Adapters in your Swift project, ensure that you've imported PubnativeLite/PubnativeLiteDemo/Adapters/HyBid-Bridging-Header.h to your project and the Objective-C Bridging Header build setting under Swift Compiler - Code Generation has a path to the header.