首页 > 解决方案 > ID 为 xxxxxxxx 的应用在 ID 为 yyyy 的应用上没有正确的 view_structure

问题描述

我正在尝试在 iOS 应用程序的音频应用程序中创建一个新项目。根据 podio 中的文档,以下代码行但我有一个 403 错误,主题为错误消息。我假设我需要将会话作为应用程序进行身份验证,因为我认为它将使用应用程序 ID 在用于登录的应用程序中创建 PKTItem。

let item = PKTItem(forAppWithID: lastItem + 1) 
item?.setValue(1, forField: "service") 
item?.setValue(testPet, forField: "pet")

item?.save().onComplete({(response, error) in 
    if (error != nil){ 
        print("error: \(error)") 
    } 
    else{ 
        print("response") 
    } 
})

我假设该项目将在用于使用 id 的项目签名的应用程序中创建lastItem + 1,我试图查看对象的 ID 是否正确

//this is supposed to be lastItem + 1
print("PKTItem ID: \(item?.appItemID)")
//this is supposed to be the app ID where it should create the new item
print("PKTItem AppID: \(item?.appID)")

PKTItem ID: Optional(0)
PKTItem AppID: Optional(1) 

我不知道我做错了什么。请帮助我。

标签: iosswiftpodio

解决方案


听起来您使用了错误的凭据集来查看您尝试使用的应用程序项目。你是怎么授权的?您是否有此脚本的正确 App ID 和 Token 组合?

通常您会看到[PodioKit authenticateAutomaticallyAsAppWithID:123456 token:@"my-app-token"];并允许您与应用程序 123456 中的任何内容进行交互,但听起来您正在尝试根据错误消息与 2 个应用程序中的数据进行交互。如果这是一个小规模的实现(或出于测试目的),您可以改用 Authenticate as User 方法。这是他们拥有的关于Objective C 库的身份验证的文档。

PKTAsyncTask *authTask = [PodioKit authenticateAsUserWithEmail:@"myname@mydomain.com" password:@"p4$$w0rD"];

[authTask onComplete:^(PKTResponse *response, NSError *error) {
  if (!error) {
    // Successfully authenticated
  } else {
    // Failed to authenticate, double check your credentials
  }
}];

推荐阅读