我的智慧结束了。我有一个适用于iOS和Android的Appcelerator应用程序。它使用Alloy模型。我无法在iOS 11上使用它。
在iOS 11的iPhone 7模拟器中构建和启动应用程序时,我在应用程序启动时收到以下错误。
[DEBUG] : Installing sql database "db.sql" with name "db"
[INFO] : [LiveView] Error Evaluating /alloy/models/Receive.js @ Line: <null>
[ERROR] : config.adapter.idAttribute "id" not found in list of columns for table "receive"
[ERROR] : columns: []
[ERROR] : File: /alloy/models/Receive.js
[ERROR] : Line: <null>
[ERROR] : SourceId: <null>
[ERROR] : Backtrace:
[ERROR] : undefined
[INFO] : [LiveView] Error Evaluating app.js @ Line: 240
[ERROR] : TypeError: undefined is not a constructor (evaluating 'new (require("/alloy/models/" + ucfirst(name)).Collection)(args)')
[ERROR] : File: app.js
[ERROR] : Line: 240
[ERROR] : SourceId: <null>
[ERROR] : Backtrace:
[ERROR] : undefined
[DEBUG] : Application booted in 835.013032 ms
[TRACE] : Uploaded tiapp metadata with Appcelerator Platform!
仅在iOS 11中发生。适用于iOS 10.3和Android的构建工作正常,应用程序运行良好。
我的模特/ receive.js看起来像这样。
exports.definition = {
config: {
"columns": {
"id" : "INTEGER PRIMARY KEY AUTOINCREMENT",
"lev_naam" : "TEXT",
"product" : "TEXT",
"state" : "INTEGER",
"type" : "TEXT",
"subtype" : "TEXT",
"temp" : "TEXT",
"packing" : "INTEGER",
"freshness" : "INTEGER",
"tht" : "INTEGER",
"description" : "TEXT",
"check_date" : "INTEGER",
"check_week" : "INTEGER",
"check_year" : "INTEGER",
"creation_date" : "INTEGER",
"update_date" : "INTEGER",
"username" : "TEXT",
"location" : "TEXT",
"db_id" : "INTEGER",
"issend" : "INTEGER",
"isdeleted" : "INTEGER",
"uid" : "TEXT",
},
"defaults": {
"lev_naam" : "",
"product" : "",
"state" : -1,
"type" : "",
"subtype" : "",
"temp" : null,
"packing" : null,
"freshness" : null,
"tht" : null,
"description" : "",
"check_date" : null,
"check_week" : null,
"check_year" : null,
"creation_date" : 0,
"update_date" : 0,
"username" : null,
"isdeleted" : null,
"issend" : null,
"db_id" : null,
"uid" : null,
},
"adapter": {
"db_file" : 'db.sql',
"type": "sql",
"collection_name": "receive",
"idAttribute": "id",
}
},
(.... rest of code)
当我为所有模型删除适配器对象中的idAttribute键时,它会在iOS 11中构建并运行,但由于某种原因我的提取查询失败,因为我正在使用其ID获取项目。
我使用的是最新版本的Appcelerator,并且我已将Titanium SDK更新为最新版本(6.2.2.GA)。
错误告诉我,不知何故应用程序将我的列对象视为空....但它显然不是。
希望你们有答案!