Parse.com错误'启用固定时不允许使用方法'。当我使用PFQueryTableViewController子类时

时间:2014-12-31 11:48:11

标签: ios objective-c swift parse-platform ios8

我目前正在使用1.6.1来自CocoaPods(=最新)

在我的swift项目中,我启用了localdatastore,然后设置了解析应用程序ID。 之后,我加载了一个故事板,它是一个PFQueryTableViewController子类。 真的没什么特别的。但它仍然崩溃。 它似乎在Parse内部崩溃[PFQuery setCachePolicy:]

可能有什么不对?如何使离线功能正常工作?

*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Method not allowed when Pinning is enabled.'
*** First throw call stack:
(
    0   CoreFoundation                      0x00000001078a0f35 __exceptionPreprocess + 165
    1   libobjc.A.dylib                     0x0000000107ea3bb7 objc_exception_throw + 45
    2   CoreFoundation                      0x00000001078a0e6d +[NSException raise:format:] + 205
    3   NMC-Goes                            0x00000001044abe44 -[PFQuery setCachePolicy:] + 35
    4   NMC-Goes                            0x00000001043f6e85 -[PFQueryTableViewController queryForTable] + 341
    5   NMC-Goes                            0x00000001043f712e -[PFQueryTableViewController loadObjects:clear:] + 110
    6   NMC-Goes                            0x00000001043f70ba -[PFQueryTableViewController loadObjects] + 58
    7   NMC-Goes                            0x00000001043f69f9 -[PFQueryTableViewController viewDidLoad] + 73
    8   NMC-Goes                            0x000000010425ae1a _TFC8NMC_Goes23TripTableViewController11viewDidLoadfS0_FT_T_ + 74
    9   NMC-Goes                            0x000000010425bca2 _TToFC8NMC_Goes23TripTableViewController11viewDidLoadfS0_FT_T_ + 34
    10  UIKit                               0x00000001063f3a90 -[UIViewController loadViewIfRequired] + 738
    11  UIKit                               0x000000010642206b -[UINavigationController _layoutViewController:] + 44
    12  UIKit                               0x00000001064225b5 -[UINavigationController _updateScrollViewFromViewController:toViewController:] + 216
    13  UIKit                               0x00000001064226b4 -[UINavigationController _startTransition:fromViewController:toViewController:] + 92
    14  UIKit                               0x0000000106423487 -[UINavigationController _startDeferredTransitionIfNeeded:] + 523
    15  UIKit                               0x0000000106423f47 -[UINavigationController __viewWillLayoutSubviews] + 43
    16  UIKit                               0x0000000106569509 -[UILayoutContainerView layoutSubviews] + 202
    17  UIKit                               0x0000000106347973 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 521
    18  QuartzCore                          0x0000000105fdbde8 -[CALayer layoutSublayers] + 150
    19  QuartzCore                          0x0000000105fd0a0e _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 380
    20  QuartzCore                          0x0000000105fd087e _ZN2CA5Layer28layout_and_display_if_neededEPNS_11TransactionE + 24
    21  QuartzCore                          0x0000000105f3e63e _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 242
    22  QuartzCore                          0x0000000105f3f74a _ZN2CA11Transaction6commitEv + 390
    23  UIKit                               0x00000001062cc54d -[UIApplication _reportMainSceneUpdateFinished:] + 44
    24  UIKit                               0x00000001062cd238 -[UIApplication _runWithMainScene:transitionContext:completion:] + 2642
    25  UIKit                               0x00000001062cbbf2 -[UIApplication workspaceDidEndTransaction:] + 179
    26  FrontBoardServices                  0x000000010b6a12a3 __31-[FBSSerialQueue performAsync:]_block_invoke + 16
    27  CoreFoundation                      0x00000001077d653c __CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK__ + 12
    28  CoreFoundation                      0x00000001077cc285 __CFRunLoopDoBlocks + 341
    29  CoreFoundation                      0x00000001077cc045 __CFRunLoopRun + 2389
    30  CoreFoundation                      0x00000001077cb486 CFRunLoopRunSpecific + 470
    31  UIKit                               0x00000001062cb669 -[UIApplication _run] + 413
    32  UIKit                               0x00000001062ce420 UIApplicationMain + 1282
    33  NMC-Goes                            0x000000010427840e top_level_code + 78
    34  NMC-Goes                            0x00000001042784ea main + 42
    35  libdyld.dylib                       0x000000010877a145 start + 1
    36  ???                                 0x0000000000000001 0x0 + 1
)

7 个答案:

答案 0 :(得分:10)

启用固定时,无法使用旧的查询缓存策略。

见这里: PFQuery Class Reference - cachePolicy

答案 1 :(得分:5)

我已经做了一个示例项目来向Parse.com演示问题(请参阅错误:https://developers.facebook.com/bugs/1544122569192939/)。

我从Parse得到的回应是来自cocoapods的ParseUI框架已知有这个问题。

他们建议我从https://parse.com/docs/downloads

获得ParseUI

我试着看看是否能修复PFQueryTableViewController的问题

编辑:我已手动添加框架并将其从Podfile中取出。崩溃现在不再发生。所以这个bug就像ParseUI cocoapod一样,解析器告诉我在developers.facebook.com

答案 2 :(得分:4)

我也遇到了同样的问题。我在下面的一行中评论了扩展 PFQueryTableViewController &它对我有用。

if ([self.objects count] == 0) {
    query.cachePolicy = kPFCachePolicyCacheThenNetworkd;
}

答案 3 :(得分:3)

当我尝试Parse时,我得到了确切的堆栈跟踪。但后来发现我把这行代码包含在我的app委托中。

<强>目标C

[Parse enableLocalDatastore];

我删除了这段代码,它就像一个魅力。

<强>夫特

删除:

Parse.enableLocalDatastore()

答案 4 :(得分:1)

<div id="table">
   <div class="row">
      <div class="cell">
         <h5>Pyraminx ao12 16 46</h5>
         <iframe width="560" height="315" src="https://www.youtube.com/embed/XDN9BXLFGhg" frameborder="0" allowfullscreen></iframe>
      </div>
      <div class="cell">
         <h5 align="right">Lubing DaYan ZhanChi Cube</h5>
         <iframe width="560" height="315" src="https://www.youtube.com/embed/ydg0APsB7IU" frameborder="0" align="right" allowfullscreen></iframe>
      </div>
   </div>
   <div class="row">
      <div class="cell">
         <h5>TheCubicle.US | Yuxin 4x4 + ShengShou pyraminx</h5>
         <iframe width="560" height="315" src="https://www.youtube.com/embed/vEkiT62B-nE" frameborder="0" allowfullscreen></iframe>
      </div>
      <div class="cell">
         <h5 align="right">Cubing - 2x2 ao5 36.9</h5>
         <iframe width="560" height="315" src="https://www.youtube.com/embed/ydg0APsB7IU" frameborder="0" align="right" allowfullscreen></iframe>
      </div>
   </div>
   <div class="row">
      <div class="cell">
         <h5>Tutorial - sl1pg8r symbol with a cube</h5>
         <iframe width="560" height="315" src="https://www.youtube.com/embed/2f7xz6ym__0" frameborder="0" allowfullscreen></iframe>
      </div>
      <div class="cell">
         <h5 align="right">Mindcuber Demo and Explaination</h5>
         <iframe width="560" height="315" src="https://www.youtube.com/embed/oEIMf1JdyDc" frameborder="0" align="right" allowfullscreen></iframe>
      </div>
   </div>
</div>
在App Delegate中使用setApplicationID代替Controller解决了我的问题。

答案 5 :(得分:0)

你可以在swift中试用这段代码。

if [self.objects].count == 0 {

        query?.cachePolicy = PFCachePolicy.CacheThenNetwork

    }

答案 6 :(得分:0)

Screen Shot

我添加了'进口螺栓&#39;下面:

import UIKit

import Parse

如屏幕截图所示。

这解决了我的问题。