小编Hug*_*ius的帖子

处理addPersistentStoreWithType中的错误

我试图在iPhone上创建持久存储协调器时查找有关处理错误的信息.我已经实现了轻量级迁移

   NSError *error = nil;
NSDictionary *options = [NSDictionary dictionaryWithObjectsAndKeys:
                         [NSNumber numberWithBool:YES], NSMigratePersistentStoresAutomaticallyOption,
                         [NSNumber numberWithBool:YES], NSInferMappingModelAutomaticallyOption, nil];
_persistentStoreCoordinator = [[NSPersistentStoreCoordinator alloc] initWithManagedObjectModel:[self managedObjectModel]];
if (![_persistentStoreCoordinator addPersistentStoreWithType:NSSQLiteStoreType configuration:nil URL:storeURL options:options error:&error]) {
    /*
     Replace this implementation with code to handle the error appropriately.

     abort() causes the application to generate a crash log and terminate. You should not use this function in a shipping application, although it may be useful during development. 

     Typical reasons for an error here include:
     * The persistent …
Run Code Online (Sandbox Code Playgroud)

core-data objective-c fatal-error

6
推荐指数
1
解决办法
4454
查看次数

来自iOS的Facebook开放图表共享无法在不首先触及Open Graph Debugger的情况下工作

我试图让Open Graph共享操作在iOS上运行.它正在工作一些,如果我使用Open Graph Debugger请求打开的图形URL,首先一切都按预期工作.但是,如果我不这样做,共享对话框中的预览将显示大约几秒钟,然后淡出.帖子按钮也被禁用.

我在后端看到的是,如果我使用Open Graph Debugger或将对象url粘贴到我自己的状态,我将收到来自Facebook服务器的请求(69.171.234.117).但是,当我直接从应用程序共享时,我看到来自另一个Facebook服务器(173.252.74.115)的请求,此服务器似乎无法正确读取Open Graph数据.

有没有人见过这样的事情或者知道是什么导致了它?

编辑:我已经为此问题向Facebook提交了一个错误.如果更改,将在此处更新.

EDIT2:Facebook已确认此错误并正在努力.目前建议的解决方法是在创建对象时使用https://graph.facebook.com/?id= {url}&scrape = true 触发初始刮擦.

EDIT3:Facebook关闭了错误报告并声称该问题已在最新的SDK中得到解决.我将验证这一点并报告回来.

EDIT4:现在我的测试似乎已经解决了.

facebook facebook-graph-api ios

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

从没有抛出的继承函数抛出异常

我正在尝试执行以下操作:

protocol X{
    func foo()
}
enum XError{
    case BAR
}
class Y:X{
    func foo(){
        throw XError.BAR
    }
}
Run Code Online (Sandbox Code Playgroud)

我不能在协议中添加一个throws声明,它抱怨说

由于封闭函数未声明为'throws',因此未处理错误.

我怎样才能做到这一点?

exception-handling swift

4
推荐指数
1
解决办法
3106
查看次数

jQuery .on委托,只指导选择器中的子项

您好我试图.on将事件绑定到一个元素的直接子节点.

dom看起来像这样

table > tbody > tr+ > td > table > tbody > tr+

到目前为止我已经尝试过

  • table.find(">tbody").on("dbclick", ">tr", listenerFunction);
  • table.on("dbclick", "> tbody > tr", listenerFunction);

这些都不能按预期工作,并且使用table.on("dbclick", "tr", listenerFunction)与嵌套表的碰撞导致双触发器等,因为两个表都有这个监听器.

任何想法最受赞赏.

编辑:HTML

<table>
  <tbody>
   <tr><!--Selectable row, adds the row after with sub table --></tr>
    <tr>
      <td>
        <table>
          <tbody>
            <tr></tr>
          </tbody>
        </table>
      </td>
    </tr>
  </tbody>
</table>
Run Code Online (Sandbox Code Playgroud)

javascript jquery javascript-events

3
推荐指数
1
解决办法
1716
查看次数