Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Parse.com error 'Method not allowed when Pinning is enabled.' when I use a PFQueryTableViewController subclass

I am currently using 1.6.1 via CocoaPods (= latest)

In my swift project I enable the localdatastore and then set the parse application id. After that, I load a storyboard which is a PFQueryTableViewController subclass. Really nothing special there. But it still crashes. It seems to crash in Parse internally on [PFQuery setCachePolicy:]

What could be wrong? How do I make offline functionality working?

*** 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
)
like image 898
Tycho Pandelaar Avatar asked Dec 31 '14 11:12

Tycho Pandelaar


2 Answers

You cannot use the old query caching policies when pinning is enabled.

See here: PFQuery Class Reference - cachePolicy

like image 60
That Guy Avatar answered Sep 28 '22 08:09

That Guy


I've made an example project to demo the problem to Parse.com (see the bug: https://developers.facebook.com/bugs/1544122569192939/).

The response that I got from Parse was that the ParseUI framework from cocoapods is known to have this problem.

They suggested I get ParseUI from https://parse.com/docs/downloads

I'll try and see if that fixes the problem with my PFQueryTableViewController

Edit: I've added the framework manually and took it out of the Podfile. The crash now no longer occurs. So the bug is in the ParseUI cocoapod like parse told me on developers.facebook.com

like image 34
Tycho Pandelaar Avatar answered Sep 28 '22 07:09

Tycho Pandelaar