ID为xxxxxxxx的应用在ID为yyyy的应用上没有正确的view_structure

时间:2019-04-05 10:05:35

标签: ios swift podio

我正在尝试在iOS应用程序的podio应用程序中创建一个新项目。以下代码行符合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) 

我没有做错什么。请帮助我。

1 个答案:

答案 0 :(得分:0)

听起来像您使用了错误的凭据集来查看您尝试使用的应用程序项。您是如何授权的?您为此脚本使用正确的应用程序ID和令牌组合吗?

通常,您会看到[PodioKit authenticateAutomaticallyAsAppWithID:123456 token:@"my-app-token"];,它使您可以与应用程序123456中的任何内容进行交互,但这听起来像是您正在尝试根据错误消息与2个应用程序中的数据进行交互。如果这是小规模实施(或出于测试目的),则可以改用“以用户身份验证”方法。这是他们在Authentication for the Objective C library.

上拥有的文档
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
  }
}];