MorphiiSDK 0.0.67

MorphiiSDK 0.0.67

测试已测试
语言语言 Obj-CObjective C
许可证 商业
发布最后发布2017年11月
SwiftSwift 版本3.0

Charles von LeheMorphii DevMichael Wright 维护。



MorphiiSDK 0.0.67

Morphii SDK

Morphii SDK

是什么

Morphii SDK 为开发者提供将 morphii 技术添加到 iOS 原生应用的能力。Morphii 允许用户操纵情绪的类型和强度。有几种不同的 morphii,以提供全面可能的情绪范围。开发者还可以选择添加一个与 morphii 一起的评论部分。然后开发者可以收集用户与 morphii 的交互的相关信息,用于分析目的。有关更多信息,请参阅Morphii 网站:

如何使用它

要求

  • Xcode 8.+
  • 最小部署目标为 10.2

项目设置

  1. 在 Xcode 中创建一个新项目。
  2. 打开终端
  3. 导航到您的项目目录
  4. 如果您还没有使用 Cocoapods,运行 pod init
  5. 将以下内容添加到您的 podfile
pod 'MorphiiSDK', :git => 'https://github.com/Vizbii/morphii-sdk-ios.git', :tag => '0.0.67'
  1. 运行 pod install
  2. import MorphiiSDK 添加到您想使用 SDK 的任何地方

导入

以下是使用 Morphii SDK 所需的导入。

// Swift
import MorphiiSDK
// Objective-C
#import <MorphiiSDK/MorphiiSDK.h>

MorphiiService

MorphiiService 类是开发者将工作的主要类。这个类包含了进行身份验证、添加 MorphiiView 以及提交数据以接收包含用户输入数据的 Result Records(结果记录)的方法。所有 MorphiiService 方法都将从 sharedInstance 对象调用。示例

身份验证

public func authenticate (username:String, password:String, accountId:String, completion:@escaping (_ results:MorphiiSDK.AuthenticationResults)->Void)

此方法通过 morphii 服务器身份验证开发者的账户。它需要一个 usernamepasswordaccount ID。完成(completion)返回一个 AuthenticationResults 对象。在使用 SDK 的任何其他方法之前,必须成功验证用户。建议进行检查以确保身份验证结果没有返回一个包含 codemessage 以提供开发者错误信息的错误对象,并且 isAuthenticated 为 true。如果有错误,则错误对象包含有关发生错误的 insight 的代码和消息。如果没有错误且身份验证成功,则建议在此回调内添加任何 morphii 视图。

// Swift
override func viewDidLoad() {
  super.viewDidLoad()
  // Do any additional setup after loading the view, typically from a nib.

  let service = MorphiiService.sharedInstance()
  service.authenticate(username: "user_name", password: "password", accountId: "account-id") { (result) in
    if result.isAuthenticated {
      // Authentication successful.
      // Add morphii views.
    }
    else {
      print("Authentication failed")
      print("error code: \(result.error?.code)")
      print("error message: \(result.error?.message)")
    }
  }
}
// Objective-C
- (void)viewDidLoad {
  [super viewDidLoad];

  MorphiiService *service = [MorphiiService sharedInstance];
  [service authenticateWithUsername:@"user_name" password:@"password" accountId:@"account-id" completion:^(AuthenticationResults * _Nonnull results) {
    if (results.isAuthenticated) {
      // Authentication successful.
      // Add morphii views.
    }
    else {
      // There was an error.
      NSLog(@"Error authenticating");
      NSLog(@"error code: %@", results.error.code);
      NSLog(@"error message: %@", results.error.message);
    }
  }];
}

添加

public func add(containerView:UIView, config:BasicViewConfiguration, delegate:BasicViewDelegate?) -> BasicView

此方法向指定的容器布局添加一个 BasicView。此方法需要一个参数:一个 basicViewConfiguration。为了创建一个 BasicViewConfiguration 的实例,您需要创建一些支持类,并将这些类作为参数传递到配置中。有关更多信息,请参阅“支持类”部分。如果成功,add 方法将返回一个 BasicView,如果出错,则返回 null

// Swift
func createBasicView(containerView: UIView) -> BasicView {

  // Create Project
  let project = Project(id: "my-project-id", description: "My Project Description")

  // Create Target
  let metadata: NSDictionary? = ["value-1" : "key1", "value-2" : "key2"]
  let target = Target(id: "my-target-id", type: "question", metadata: metadata)

  // Options configuration
  let options = Options(stage: "live", initialIntensity: 0.5)

  // Comment configuration
  let comment = Comment(show: false, required: false, maxLength: 100, label: "Comment", hintText: "Enter comment")

  // Create User
  let properties: NSDictionary? = ["[email protected]" : "email", "value-2" : "key2", "value-3" : "key3"]
  let user = User(id: "user-id", type: "external", properties: properties)

  // Morphii configuration.
  let morphiiConfig = MorphiiConfiguration(showName: true)
  morphiiConfig.add(id: "6202184382145363968", name: nil, weight: 1)

  // Create the BasicViewConfiguration and add to the service.
  let config = BasicViewConfiguration(morphiiConfig: morphiiConfig, target: target, project: project, comment: comment, options: options, user: user)

  let service = MorphiiService.sharedInstance()
  let basicView = service.add(containerView: containerView, config: config, delegate: self)
  return basicView
}
// Objective-C
-(BasicView*)createBasicView: (UIView *)container {

  // Project information
  Project *project = [[Project alloc] initWithId:@"my-project-id" description:@"My project description"];

  // Target info
  NSDictionary *metadata = @{@"value-1":@"key1", @"value-2":@"key2"};
  Target *target = [[Target alloc] initWithId:@"my-target-id" type:@"question" metadata:metadata];

  // Options info
  Options *options = [[Options alloc] initWithStage:@"live" initialIntensity:0.5];

  // Comment info
  Comment *comment = [[Comment alloc] initWithShow:NO required:NO maxLength:100 label:@"Comment" hintText:@"Enter comment"];

  // User data
  NSDictionary *properties = @{@"[email protected]":@"email", @"value-2":@"key2", @"value-3":@"key3"};
  User *user = [[User alloc] initWithId:@"user-id" type:@"external" properties:properties];

  // Morphii information
  MorphiiConfiguration *morphiiConfig = [[MorphiiConfiguration alloc] initWithShowName:YES];
  [morphiiConfig addWithId:@"6202184382145363968" name:nil weight:1];

  BasicViewConfiguration *config = [[BasicViewConfiguration alloc] initWithMorphiiConfig:morphiiConfig target:target project:project comment:comment options:options user:user];

  MorphiiService *service = [MorphiiService sharedInstance];    
  BasicView *basicView = [service addWithContainerView:container config:config delegate:nil];
  [container addSubview:basicView];
  return basicView;
}

添加选择视图

public func addSelectionView (初始强度:Double, 配置:MorphiiConfiguration, 代理:MorphiiSelectionViewDelegate) -> MorphiiSelectionView?

此方法返回一个 MorphiiSelectionView 对象,可以像 SingleMorphiiView 一样添加到您的容器布局中。此方法需要三个参数:初始强度MorphiiConfigurationMorphiiSelectionViewDelegateMorphiiConfiguration 是一个 MorphiiConfiguration 对象的实例,它配置了 Morphi 的显示方式。初始强度 是一个 Double,它决定了渲染的 Morphi 的起始强度。《MorphiiSelectionViewDelegate 返回选定的 Morphi 的 MorphiiConfiguration,可以用来创建一个新的 BasicViewConfiguration,以添加一个新的 BasicView 来允许用户操纵和利用选定的 Morphi。

// Swift
func createSelectionView() -> MorphiiSelectionView? {
  let service = MorphiiService.sharedInstance()

  let morphiiConfig = MorphiiConfiguration(showName: true)
  morphiiConfig.add(id: "6202185104333209600", name: nil, weight: 1)
  morphiiConfig.add(id: "6202185110939238400", name: nil, weight: 2)
  return service.addSelectionView(initialIntensity: 1.0, config: morphiiConfig, delegate: self)
}
// Objective-C
-(MorphiiSelectionView*)createSelectionView {
  MorphiiService *service = [MorphiiService sharedInstance];   

  MorphiiConfiguration *morphiiConfig = [[MorphiiConfiguration alloc] initWithShowName:YES];
  [morphiiConfig addWithId:@"6202185104333209600" name:nil weight:1];
  [morphiiConfig addWithId:@"6202185110939238400" name:nil weight:2];

  MorphiiSelectionView *morphiiSelectionView = [service addSelectionViewWithInitialIntensity:1.0 config:config delegate:nil];
  return morphiiSelectionView;
}

提交

public func submit (完成: (@escaping ([ReactionResultRecord]) -> Void))

如果还没有提交,此方法将提交所有当前在应用中的 BasicView 的数据。完成将返回一个 [ReactionResultRecord]。此 Array 包含每个使用该方法提交的 BasicViewReactionResultRecord

//Swift
func submit () {
  MorphiiService.sharedInstance().submit { (records) in
    for record in records {
      print("Results Record");
      print("================================================");
      print("targetId: \(record.targetId)")
      print("viewId: \(record.viewId)")

      if !record.isSubmitted {
        // There was an error.
        print("error code: \(record.error?.code)")
        print("error message: \(record.error?.message)")
      }
      else {
        print("reactionId: \(record.reactionId)")

        if record.morphii != nil {
          print("morphii-id: \(record.morphii?.id)")
          print("morphii-name: \(record.morphii?.name)")
          print("morphii-displayName: \(record.morphii?.displayName)")
          print("morphii-intensity:  \(record.morphii?.intensity)")
          print("morphii-weight:  \(record.morphii?.weight)")
        }
        else {
          print("No morphii details provided.")
        }

        if record.comment != nil {
          print("comment-text: \(record.comment?.text)")
          print("comment-locale: \(record.comment?.locale)")
        }
        else {
          print("No comment field")
        }
      }

      print("================================================")
      print("================================================")
    }
  }
}
// Objective-C
- (void)submit {
  [[MorphiiService sharedInstance] submitWithCompletion:^(NSArray<ReactionResultRecord *> * _Nonnull records) {
    for (ReactionResultRecord *record in records) {
      NSLog(@"Results Record");
      NSLog(@"================================================");
      NSLog(@"targetId: %@",record.targetId);
      NSLog(@"viewId: %@",record.viewId);

      if (!record.isSubmitted) {
        // There was an error.
        NSLog(@"error code: %@",record.error.code);
        NSLog(@"error message: %@",record.error.message);
      }
      else {
        NSLog(@"reactionId: %@", record.reactionId);

        if (record.morphii != nil) {
          NSLog(@"morphii-id: %@", record.morphii.id);
          NSLog(@"morphii-name: %@", record.morphii.name);
          NSLog(@"morphii-displayName: %@", record.morphii.displayName);
          NSLog(@"morphii-intensity:  %f", record.morphii.intensity);
          NSLog(@"morphii-weight:  %ld", record.morphii.weight);
        }
        else {
          NSLog(@"No morphii details provided.");
        }

        if (record.comment != nil) {
          NSLog(@"comment-text: %@", record.comment.text);
          NSLog(@"comment-locale: %@", record.comment.locale);
        }
        else {
          NSLog(@"No comment field");
        }
      }

      NSLog(@"================================================");
      NSLog(@"================================================");
    }
  }];
}

重置

public func reset (评论:Bool)

此方法将所有 BasicView 重置为其默认配置。该方法有一个参数:评论。此参数是一个布尔值,如果为真,则将评论字段重置为其默认值,如果为假,则将保留用户所做的更改。

// Swift
func reset() {
  MorphiiService.sharedInstance().reset(comment: true)
}
// Objective-C
- (void)reset {
  [[MorphiiService sharedInstance] resetWithComment:YES];
}

基本视图

这些方法类似于在 MorphiiService 类中找到的方法,但通常在调用时更改影响范围。

提交

public func submit ( completion:@escaping (_ results:[ReactionResultRecord])->Void)

此方法从特定 BasicView 中获取数据并进行提交。它将返回一个 [ReactionResultRecord]。此 Array 将只有一个 ReactionResultRecord,因为只提交了一个 BasicView

// Swift
func submit() {
  basicView?.submit { (records) in
    for record in records {
      print("Results Record");
      print("================================================");
      print("targetId: \(record.targetId)")
      print("viewId: \(record.viewId)")

      if !record.isSubmitted {
        // There was an error.
        print("error code: \(record.error?.code)")
        print("error message: \(record.error?.message)")
      }
      else {
        print("reactionId: \(record.reactionId)")

        if record.morphii != nil {
          print("morphii-id: \(record.morphii?.id)")
          print("morphii-name: \(record.morphii?.name)")
          print("morphii-displayName: \(record.morphii?.displayName)")
          print("morphii-intensity:  \(record.morphii?.intensity)")
          print("morphii-weight:  \(record.morphii?.weight)")
        }
        else {
          print("No morphii details provided.")
        }

        if record.comment != nil {
          print("comment-text: \(record.comment?.text)")
          print("comment-locale: \(record.comment?.locale)")
        }
        else {
          print("No comment field")
        }
      }

      print("================================================")
      print("================================================")
    }
  }
}
// Objective-C
- (void)submit {
  [_basicView submitWithCompletion:^(NSArray<ReactionResultRecord *> * _Nonnull records) {
    for (ReactionResultRecord *record in records) {
      NSLog(@"Results Record");
      NSLog(@"================================================");
      NSLog(@"targetId: %@",record.targetId);
      NSLog(@"viewId: %@",record.viewId);

      if (!record.isSubmitted) {
        // There was an error.
        NSLog(@"error code: %@",record.error.code);
        NSLog(@"error message: %@",record.error.message);
      }
      else {
        NSLog(@"reactionId: %@", record.reactionId);

        if (record.morphii != nil) {
          NSLog(@"morphii-id: %@", record.morphii.id);
          NSLog(@"morphii-name: %@", record.morphii.name);
          NSLog(@"morphii-displayName: %@", record.morphii.displayName);
          NSLog(@"morphii-intensity:  %f", record.morphii.intensity);
          NSLog(@"morphii-weight:  %ld", record.morphii.weight);
        }
        else {
          NSLog(@"No morphii details provided.");
        }

        if (record.comment != nil) {
          NSLog(@"comment-text: %@", record.comment.text);
          NSLog(@"comment-locale: %@", record.comment.locale);
        }
        else {
          NSLog(@"No comment field");
        }
      }

      NSLog(@"================================================");
      NSLog(@"================================================");
    }
  }];
}

PNG

public func png (大小:CGSize) -> UIImage?

此方法返回一个指定的 BasicView 中的 Morphi 的 UIImage。此视图必须在调用此方法之前提交。

// Swift
func getPng() {
  imageView.image = basicView?.png(size: CGSize(width: 60, height: 60))
}
// Objective-C
- (void)getPng {
  UIImage *image = [_basicView pngWithSize:CGSizeMake(60, 60)];    
  [_imageView setImage: image];
}

重置

public func reset (评论:Bool)

此方法将 BasicView 重置为其默认值。需要提供一个参数:评论。如果标记为真,则将评论字段重置为其默认值,如果为假,则保留用户所做的更改。

// Swift
func reset() {
  basicView?.reset(comment: true)
}
// Objective-C
- (void)reset {
  [_basicView resetWithComment:YES];
}

MorphiiSelectionView

MorphiiSelectionView 是一个包含 Morphi 列表的视图。此对象由 添加选择视图 返回。

支持类

这些是作为 MorphiiServiceMorphiiSelectionViewBasicView 方法参数的支持类。

项目

此类用于对不同的项目数据进行分组。它需要两个参数:id描述。`id` 是一个 String,用于标记项目。`描述` 是一个 String,简要描述项目。此对象用于构建 BasicViewConfiguration

// Swift
// Project information
let project = Project(id: "my-project-id", description: "My Project Description")
// Objective-C
// Project information
Project *project = [[Project alloc] initWithId:@"my-project-id" description:@"My project description"];

目标

Target类用于描述形态ii相对于什么存在。该类需要三个参数:idtypemetadata。其中id是一个String,作为引用对象的标签。type也是一个String,用于描述Target是什么。例如:问题、图像、视频、文章等。metadata是一个对象,包含开发人员希望记录的额外信息;该参数可以为nil。该对象用于构建基本视图配置

// Swift
// Target information
let metadata: NSDictionary? = ["value-1" : "key1", "value-2" : "key2", "value-3" : "key3"]
let target = Target(id: "test-target-id-1", type: "question", metadata: metadata)
// Objective-C
// Target info
NSDictionary *metadata = @{@"value-1":@"key1", @"value-2":@"key2"};
Target *target = [[Target alloc] initWithId:@"my-target-id" type:@"question" metadata:metadata];

用户

这个类用于定义与形态ii交互的用户。它使用了三个参数:idtypeproperties。其中id是一个String,作为用户的唯一标识。type也是一个String,定义了用户的类型。包括的选项有:外部、Facebook、Twitter或Google。properties参数是一个字典,开发人员可以用它来收集任何他们想要的额外信息;该参数可以为nil。该对象用于构建基本视图配置

// Swift
// User information
let properties: NSDictionary? = ["[email protected]" : "email", "value-2" : "key2", "value-3" : "key3"]
let user = User(id: "user-id", type: "external", properties: properties)
// Objective-C
// User information
NSDictionary *properties = @{@"[email protected]":@"email", @"value-2":@"key2", @"value-3":@"key3"};
User *user = [[User alloc] initWithId:@"user-id" type:@"external" properties:properties];

评论

这个类用于配置基本视图的评论部分。该类需要五个参数:showrequiredmaxLengthlabelhintText。其中show参数是一个布尔值,用于确定评论部分是否可见。required参数是一个布尔值,用于确定用户是否必须提交评论才能提交基本视图。maxLength参数是一个int,用于确定允许的评论字符的最大数量;如果设置为0,则允许无限数量的字符。label参数是一个String,在评论字段上方显示。hintText是一个String,将在评论字段中显示。该对象用于构建基本视图配置

// Swift
// Comment configuration
let comment = Comment(show: false, required: false, maxLength: 100, label: "Post", hintText: "Post Here")
// Objective-C
// Comment info
Comment *comment = [[Comment alloc] initWithShow:NO required:NO maxLength:100 label:@"Comment" hintText:@"Enter comment"];

选项

这个类用于定义额外的配置。它需要两个参数:stageinitialIntensitystage参数是一个String,有三个选项:testvalidationlive。其中test选项将不会对数据进行分析处理。validation选项将发送需要由分析代理处理的数据,但不会出现在任何报告数据中。live选项将全部数据处理和数据报告参数。其中initialIntensity参数是一个double,用于确定形态ii的起始强度。此值必须在0到1之间。该对象用于构建基本视图配置

// Swift
// Options configuration
let options = Options(stage: "live", initialIntensity: 0.5)
// Objective-C
// Options configuration
Options *options = [[Options alloc] initWithStage:@"live" initialIntensity:0.5];

形态ii配置

这个类用于定义形态ii的默认配置。MorphiiConfiguration对象接受一个参数:showName。这是一个布尔值,当为真时,将在形态ii下方显示名称。当为假时,名称不会显示。创建一个MorphiiConfiguration对象后,需要调用其add方法来添加配置信息。该方法需要三个参数:idnameweight。其中id是一个String,用于确定添加哪个形态ii。其中name是开发人员为形态ii定义的标签。该参数可以定义为null。如果定义为null,将使用默认的形态ii名称。weight参数是一个int,用于分配给形态ii的权重。该对象用于构建基本视图配置并添加一个形态ii选择视图

方法
  • public func add(id: String, name: String?, weight: Int = 0) : 此方法将特定的 morphii 添加到 MorphiiConfiguration 中。
// Swift
// Morphii configuration.
let morphiiConfig = MorphiiConfiguration(showName: true)
morphiiConfig.add(id: "6202185104333209600", name: nil, weight: 1)
// Objective-C
MorphiiConfiguration *morphiiConfig = [[MorphiiConfiguration alloc] initWithShowName:YES];
[morphiiConfig addWithId:@"6202185104333209600" name:nil weight:1];

BasicViewConfiguration

此类定义了 BasicView 的配置。用于创建一个新的 BasicView。该对象需要六个参数:morphiiConfigurationtargetprojectcommentoptionsuser。参考上文以辅助创建这些对象。

// Swift
// Project information
let project = Project(id: "my-project-id", description: "My Project Description")

// Target information
let metadata: NSDictionary? = ["value-1" : "key1", "value-2" : "key2"]
let target = Target(id: "test-target-id-1", type: "question", metadata: metadata)

// Options configuration
let options = Options(stage: "test", initialIntensity: 0.5)

// Comment configuration
let comment = Comment(show: true, required: true, maxLength: 100, label: "Post", hintText: "Post Here")

// User information
let properties: NSDictionary? = ["[email protected]" : "email", "value-2" : "key2", "value-3" : "key3"]
let user = User(id: "user-id", type: "external", properties: properties)

// Morphii configuration.
let morphiiConfig = MorphiiConfiguration(showName: true)
morphiiConfig.add(id: "6202185104333209600", name: nil, weight: 1)

let config = BasicViewConfiguration(morphiiConfig: morphiiConfig, target: target, project: project, comment: comment, options: options, user: user)
// Objective-C
// Project information
Project *project = [[Project alloc] initWithId:@"my-project-id" description:@"My project description"];

// Target info
NSDictionary *metadata = @{@"value-1":@"key1", @"value-2":@"key2"};
Target *target = [[Target alloc] initWithId:@"my-target-id" type:@"question" metadata:metadata];

// Options info
Options *options = [[Options alloc] initWithStage:@"live" initialIntensity:0.5];

// Comment info
Comment *comment = [[Comment alloc] initWithShow:NO required:NO maxLength:100 label:@"Comment" hintText:@"Enter comment"];

// User data
NSDictionary *properties = @{@"[email protected]":@"email", @"value-2":@"key2", @"value-3":@"key3"};
User *user = [[User alloc] initWithId:@"user-id" type:@"external" properties:properties];

// Morphii information
MorphiiConfiguration *morphiiConfig = [[MorphiiConfiguration alloc] initWithShowName:YES];
[morphiiConfig addWithId:@"6202185104333209600" name:nil weight:1];

BasicViewConfiguration *config = [[BasicViewConfiguration alloc] initWithMorphiiConfig:morphiiConfig target:target project:project comment:comment options:options user:user];

ReactionResultRecord

ReactionResultRecord 对象由 submit 方法返回。注意,如果账户订阅过期或达到记录限制,则不会在 ReactionMorphiiResultRecordReactionCommentRecord 对象中返回细节。

属性
  • isSubmitted: Bool : 如果成功提交反应,则为真。
  • reactionId: String? : 返回为此次反应生成的反应 ID。
  • viewId: String : 返回视图 ID。
  • targetId: String : 返回与此反应相关的目标 ID。
  • comment: ReactionCommentRecord?:返回一个 ReactionCommentRecord 对象,其中包含有关反应评论的更多详细信息。
  • morphii: ReactionMorphiiResultRecord?:返回一个 ReactionMorphiiResultRecord 对象,其中包含有关反应 morphii 的更多详细信息。
  • error: ReactionError?:返回一个 ReactionError 对象,其中包含有关反应错误的更多详细信息。
// Swift
func submit() {
  MorphiiService.sharedInstance().submit { (records) in
    for record in records {
      print("Results Record");
      print("================================================");
      print("targetId: \(record.targetId)")
      print("viewId: \(record.viewId)")

      if !record.isSubmitted {
        // There was an error.
        print("error code: \(record.error?.code)")
        print("error message: \(record.error?.message)")
      }
      else {
        print("reactionId: \(record.reactionId)")

        if record.morphii != nil {
          print("morphii-id: \(record.morphii?.id)")
          print("morphii-name: \(record.morphii?.name)")
          print("morphii-displayName: \(record.morphii?.displayName)")
          print("morphii-intensity:  \(record.morphii?.intensity)")
          print("morphii-weight:  \(record.morphii?.weight)")
        }
        else {
          print("No morphii details provided.")
        }

        if record.comment != nil {
          print("comment-text: \(record.comment?.text)")
          print("comment-locale: \(record.comment?.locale)")
        }
        else {
          print("No comment field")
        }
      }

      print("================================================")
      print("================================================")
    }
  }
}
// Objective-C
- (void)submit {
  [[MorphiiService sharedInstance] submitWithCompletion:^(NSArray<ReactionResultRecord *> * _Nonnull records) {
    for (ReactionResultRecord *record in records) {
      NSLog(@"Results Record");
      NSLog(@"================================================");
      NSLog(@"targetId: %@",record.targetId);
      NSLog(@"viewId: %@",record.viewId);

      if (!record.isSubmitted) {
        // There was an error.
        NSLog(@"error code: %@",record.error.code);
        NSLog(@"error message: %@",record.error.message);
      }
      else {
        NSLog(@"reactionId: %@", record.reactionId);

        if (record.morphii != nil) {
          NSLog(@"morphii-id: %@", record.morphii.id);
          NSLog(@"morphii-name: %@", record.morphii.name);
          NSLog(@"morphii-displayName: %@", record.morphii.displayName);
          NSLog(@"morphii-intensity:  %f", record.morphii.intensity);
          NSLog(@"morphii-weight:  %ld", record.morphii.weight);
        }
        else {
          NSLog(@"No morphii details provided.");
        }

        if (record.comment != nil) {
          NSLog(@"comment-text: %@", record.comment.text);
          NSLog(@"comment-locale: %@", record.comment.locale);
        }
        else {
          NSLog(@"No comment field");
        }
      }

      NSLog(@"================================================");
      NSLog(@"================================================");
    }
  }];
}

ReactionMorphiiResultRecord

此对象包含与ReactionResultRecord 相关的 morphii 的详细信息。

属性
  • id: String:返回与此次反应相关的唯一 morphii ID。
  • name: String:返回与此次反应相关的 morphii 名称。
  • displayName: String:返回与此次反应相关的 morphii 显示名称。
  • intensity: Double:返回与此次反应相关的 morphii 强度。
  • weight: Int:返回与此次反应相关的 morphii 重量。

ReactionCommentRecord

此对象包含与ReactionResultRecord 相关的用户输入注释的详细信息。

属性
  • text: String:返回与此次反应相关的注释文本。
  • locale: String:返回与此次反应相关的注释区域设置。

ReactionError

此对象提供了在提交过程中可能发生的任何错误的详细信息。它包含两个属性:codemessagecode 属性是由数据分析管道定义的特定错误代码。与 code 属性相关的 message 属性解释了导致错误的原因。

属性
  • code: String:返回反应错误代码字符串。
  • message: String:返回反应错误消息字符串。

AuthenticationResults

此对象提供了认证结果的详细信息。此对象通过认证回调返回。

属性
  • isAuthenticated: Bool:返回认证是否成功。
  • error: ReactionError?:返回一个 AuthenticationError 对象,其中包含有关认证错误的更多详细信息。

AuthenticationError

此对象提供了在认证过程中可能发生的任何错误的详细信息。它包含两个属性:codemessagecode 属性是由数据分析管道定义的特定错误代码。与 code 属性相关的 message 属性解释了导致错误的原因。

方法
  • code: String:此方法返回认证错误代码字符串。
  • message: String : 此方法返回认证错误信息字符串。