Expand my Community achievements bar.

Adobe Campaign User Groups are live now. Join our Adobe Campaign User Groups and connect with your local leaders!

Adobe Campaign registerDevice iOS

Avatar

Level 1

I am trying to register an iOS device to notifications using ACP. 

I have a react native project and I am exposing the registerDevice function via the bridge. 

RCT_EXPORT_METHOD(acpRegisterDevice: (nonnull NSString*) token userKey: (nullable NSString*) userKey additionalParams: (nullable NSDictionary*) additionalParams resolver:(RCTPromiseResolveBlock)resolve rejector:(RCTPromiseRejectBlock)reject) {
  [ACPCampaignClassic registerDevice:[NSData dataWithHexString:token] userKey:userKey additionalParams:additionalParams callback:^(BOOL success) {
    NSLog(@"Registration Status: %d", success);
    resolve(resolve);
  }];
}

 

Currently it is calling the 'CampaignClassicRegisterDevice' and returning as success; however, there is a mismatch between the token.

The token is being passed through as a string from the JavaScript then enocded as a hexstring when passing to the ACPCampaignClassic registerDevice. Then when `CampaignClassicRegisterDevice` event is called, it is passing the encoded value instead of the original token value.

I have this working on Android as the registerDevice function accepts a string, but the iOS function requires NSData.

Does anyone have any solution to how I can pass the token as NSData and still send the original value?

Pods

pod 'ACPCampaignClassic', '~> 2.1.0'
pod 'ACPCore', '~> 2.9.3'
pod "NSData+FastHex"

 

0 Replies