Spark-setup-ios - Get the device id on completion

Hi there,

I’m a complete beginner at developing in iOS and am trying to get a simple example working with the spark-setup-ios Library, I’m porting it over to ReactNative.

The flow I’m aiming to get is as follows:

  1. User logs in to app with x API
  2. User puts button into setup mode and follows the Particle Setup instructions
  3. App retrieves the setup device id and posts it to x API along with the userID

Everything is working as expected I simply need access to a callback with the device id. Is there any way to get this? My code is as follows:

//  RNParticle.m
#import "SparkSetup.h"
#import "RNParticle.h"
#import "AppDelegate.h"

@implementation RNParticle
RCT_EXPORT_MODULE();
RCT_EXPORT_METHOD(open)
{
  SparkSetupMainController *setupController = [[SparkSetupMainController alloc] initWithSetupOnly:YES];
  AppDelegate *delegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
  [delegate.window.rootViewController presentViewController:setupController animated:YES completion:nil];
}
@end

Hi Kyle

For the sake of completeness and reference, my answer is here: