小编Jon*_*son的帖子

用身份验证中间件来表达资源?

Passport.js为node.js和Express提供了很好的身份验证,包括一个中间件解决方案:

ensureAuthenticated = function(req, res, next) {
  if (req.isAuthenticated()) {
    return next();
  }
  return res.redirect("/login");
};
Run Code Online (Sandbox Code Playgroud)

如何在快速资源模块中使用此中间件?不幸,

app.resource('users', ensureAuthenticated, require('./resources/users'));
Run Code Online (Sandbox Code Playgroud)

不起作用.

javascript middleware connect node.js express

5
推荐指数
2
解决办法
1万
查看次数

ios 6.0.1 ALAssetsLibraryChangedNotification,试图了解发送的内容

我一直在使用iOS 6.x中的ALAssetsLibraryChangedNotification(目前特别是6.0.1),我得到的结果与我期望在我的userinfo中收到的内容相反,基于我从文档中理解的内容.

这是我的事件注册代码:

  [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(assetsLibraryDidChange:) name:ALAssetsLibraryChangedNotification object:_library];
Run Code Online (Sandbox Code Playgroud)

测试,我进入我的照片库,删除一些项目,添加一些项目.

这是我的经纪人.

    - (void)assetsLibraryDidChange:(NSNotification *)note
{
  NSDictionary* info = [note userInfo];
  NSLog(@"assetsLibraryDidChange calling syncPhotoInfoFromAssets, userInfo %@", info);
  //   If the user information dictionary is nil, reload all assets and asset groups.
  if(note.userInfo==nil) {
    [self syncPhotoInfoFromAssets];
    return;
  }

  //   If the user information dictionary an empty dictionary, there is no need to reload assets and asset groups.
  if(note.userInfo.count == 0) {
    return;
  }

 // If the user information dictionary is not empty, …
Run Code Online (Sandbox Code Playgroud)

objective-c nsnotificationcenter assetslibrary alassetslibrary

5
推荐指数
1
解决办法
5728
查看次数