我目前正在使用CloudKit JS API并使用Node执行脚本。
我安装了Apple here提供的云套件库:
curl "https://cdn.apple-cloudkit.com/ck/2/cloudkit.js" > cloudkit.js
脚本是下一个:
var fetch = require("node-fetch");
var CloudKit = require("./cloudkit.js");
CloudKit.configure({
services: {fetch: fetch},
containers: [{
containerIdentifier: 'CONTAINER',
apiToken: 'TOKEN',
environment: 'development'
}]
});
var container = CloudKit.getDefaultContainer();
container.setUpAuth();
var publicDB = container.publicCloudDatabase;
function demoPerformQuery() {
publicDB.performQuery({recordType: 'Schedule'}).then(function(response){
console.log(response)
}).catch(function(error){
console.log(error)
})
}
demoPerformQuery();
运行时的输出是:
(node:30096) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): [CKError
ckErrorCode: AUTHENTICATION_FAILED
extensionErrorCode: undefined
isCKError: true
isError: true
isServerError: true
isServerExtensionError: true
message: no auth method found
name: Error
reason: no auth method found
recordName: undefined
redirectURL: undefined
retryAfter: undefined
serverErrorCode: AUTHENTICATION_FAILED
subscriptionID: undefined
uuid: 63b0ebe0-852a-454b-afc4-5a669e0a307c
zoneID: undefined
]
{ Error: no auth method found
at Function.value (/home/pi/Web/cloudkit.js:14:1432)
at /home/pi/Web/cloudkit.js:13:27352
at process._tickCallback (internal/process/next_tick.js:109:7)
_ckErrorCode: 'AUTHENTICATION_FAILED',
_uuid: '63a63eff-a962-4299-afcf-85c1a916f9ea',
_reason: 'no auth method found',
_serverErrorCode: 'AUTHENTICATION_FAILED',
_extensionErrorCode: undefined,
_retryAfter: undefined,
_recordName: undefined,
_subscriptionID: undefined,
_zoneID: undefined,
_redirectURL: undefined,
message: 'no auth method found' }
正如我在StackOverflow中所读到的那样,解决方法可能是使用npm
进行安装,但作为Node I的新手,它会卡在npm run-script install-cloudkit-js
的位置因为我没有那个剧本而且我不知道如何继续。
答案 0 :(得分:0)
您的问题似乎与<forecast:ForecastCustomerMonthQuantityGridViewDataColumn
Header="{Binding RelativeSource={RelativeSource Self}, Path=MonthIndex}"
HeaderTextAlignment="Center"
HeaderTextWrapping="Wrap"
Width="60"
IsReadOnly="True"
MonthIndex="1"
CellTemplate="{StaticResource CustomerForecastQuantityDataTemplate}"/>
尝试更改代码,使其看起来更像这样:
container.setUpAuth();