我正在尝试在 iOS 应用程序的跑道应用程序中创建一个新项目。以下代码行按照跑道中的文档进行,但我遇到了 403 错误,主题为错误消息。我假设我需要将 session 验证为应用程序,因为我认为它将使用应用程序 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)
我不知道我做错了什么。请帮助我。
最佳答案
听起来您使用了错误的凭据集来查看您尝试使用的应用程序项目。你是怎么授权的?您是否有适合该脚本的应用程序 ID 和 token 组合?
通常您会看到 [PodioKitauthenticateAutomaticallyAsAppWithID: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
}
}];
关于ios - ID 为 xxxxxxxx 的应用程序在 id 为 yyyy 的应用程序上没有正确的 view_struct,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55532987/