我正在使用FBDialogs在Facebook上分享.
Facebook共享工作正常,但处理程序永远不会被调用(我在第一行放置断点)
我的SDK是通过CocoaPods安装的
pod 'Facebook-iOS-SDK', '3.9.0'
Run Code Online (Sandbox Code Playgroud)
这是代码,几乎是facebook开发页面上的例子.我正在使用ios7测试iPod.
// If the Facebook app is installed and we can present the share dialog
if ([FBDialogs canPresentShareDialogWithParams:params]) {
// Present the share dialog
[FBDialogs presentShareDialogWithParams:params
clientState:nil
handler:^(FBAppCall *call, NSDictionary *results, NSError *error) {
//never gets here
if(error) {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Error"
message:[NSString stringWithFormat: @"O comparilhando não foi bem sucedido. %@",error.description]
delegate:nil
cancelButtonTitle:@"OK"
otherButtonTitles:nil];
[alert show];
} else {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Sucesso"
message:@"O compartilhando foi bem sucedido"
delegate:nil …Run Code Online (Sandbox Code Playgroud) 我有两个与一对多关系的续集模型.我们称之为所有者和财产.
假设它们是使用sails-hook-sequelize定义的(简化).
//Owner.js
module.exports = {
options: {
tableName: 'owner'
},
attributes: {
id: {
type: Sequelize.BIGINT,
allowNull: false,
primaryKey: true,
autoIncrement: true
},
name: {
type: Sequelize.STRING(255)
},
associations: function () {
Owner.hasMany(Property, {
foreignKey: {
name: 'owner_id'
}
});
}
}
//Property.js
module.exports = {
options: {
tableName: 'property'
},
attributes: {
id: {
type: Sequelize.BIGINT,
allowNull: false,
primaryKey: true,
autoIncrement: true
},
name: {
type: Sequelize.STRING(255)
}
}
Run Code Online (Sandbox Code Playgroud)
现在假设我想在我的数据库中插入所有者记录并插入一些属性记录以与所有者关联.我该怎么做呢?
我正在寻找类似的东西
Owner.create({name:'nice owner',
property: [{name:'nice property'},
{name:'ugly property'}]}); …Run Code Online (Sandbox Code Playgroud) 我的db模型看起来像这样
"clientId":"123456"
"devices" :
[{
"deviceId" : "123",
"deviceType" : "ios",
"notification" : true,
}
{
"deviceId" : "321",
"deviceType" : "android",
"notification" : true,
}
]
Run Code Online (Sandbox Code Playgroud)
我传递给我的DB方法的c#模型有ClientId,DeviceId,DeviceType和通知.请注意,它没有设备阵列
我正在努力实现的行为
(工作)如果ClientId还没有在数据库中,请在db中使用传递的值创建一个新记录(devices数组将有一个元素)
如果已在数据库中找到ClientId,请根据以下规则更新记录:
2.1如果devices数组不包含DeviceId,则使用传递的值向数组添加新元素
2.2如果设备阵列已包含DeviceId,则更新元素的deviceType和通知.
我正在使用c#.任何帮助赞赏
示例:给定上述数据库状态,通过传递clientId:123456,deviceId 321 deviceType"kindle",通知"false",db将更改为
"clientId":"123456"
"devices" :
[{
"deviceId" : "123",
"deviceType" : "ios",
"notification" : true,
}
{
"deviceId" : "321",
"deviceType" : "kindle",
"notification" : false,
}
]
Run Code Online (Sandbox Code Playgroud) 我将数据库连接的用户名和密码存储在
/config/connections.js
Run Code Online (Sandbox Code Playgroud)
我将在哪里存储更通用的内容(例如AWS凭证)?
我想象将下面的对象保存在某个文件中。
module.exports.aws = {
key:'my key',
secret: 'my token',
bucket: 'my bucket'
}
Run Code Online (Sandbox Code Playgroud)
然后像这样使用它:
req.file('image')
.upload({
adapter:require('skipper-s3'),
key:aws.key,
secret:aws.secret,
bucket:aws.bucket,
}, function whenDone(err, uploadedFiles) {
}
Run Code Online (Sandbox Code Playgroud)