Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't reorder - crashes #12

Closed
cvconover opened this issue Mar 11, 2014 · 10 comments
Closed

Can't reorder - crashes #12

cvconover opened this issue Mar 11, 2014 · 10 comments
Milestone

Comments

@cvconover
Copy link

I have followed the I32RearrangeableExchangeableTablesViewController and when I reorder it crashes. Assuming my fault but not sure where to start looking. Tried debugging but still not seeing clear root cause.

I see it stating "This view probably hasn't received initWithFrame: or initWithCoder:" but not exactly sure what that means. My app was initially implemented back in 2011, so perhaps a version issue (ARC, or something to that effect).

Here is the debugger output with error below.

If you have any insights, would be much appreciated. This is a really great time saver for me. Thanks for putting it together and making it available.

2014-03-10 17:27:38.949 Lacrosse-Stats[609:70b] Dragging from destination to destination.
2014-03-10 17:27:38.950 Lacrosse-Stats[609:70b] Rearrangeing dst
2014-03-10 17:27:42.128 Lacrosse-Stats[609:70b] *** 6) start isCellInDstAtIndexPathExchangable
2014-03-10 17:27:42.128 Lacrosse-Stats[609:70b] Cell row: 3
2014-03-10 17:27:42.144 Lacrosse-Stats[609:70b] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Requesting the window of a view (<UITableViewCell: 0xdca2e00; frame = (0 0; 0 0); transform = [0, 0, 0, 0, 0, 0]; text = '2 - Frick, Andrew'; alpha = 0; autoresize = W; layer = (null)>) with a nil layer. This view probably hasn't received initWithFrame: or initWithCoder:.'
*** First throw call stack:
(
0 CoreFoundation 0x0389b5e4 exceptionPreprocess + 180
1 libobjc.A.dylib 0x02d898b6 objc_exception_throw + 44
2 CoreFoundation 0x0389b3bb +[NSException raise:format:] + 139
3 UIKit 0x01bb2f5b __windowForView + 467
4 UIKit 0x01bb52a0 -[UIView(Hierarchy) _postMovedFromSuperview:] + 28
5 UIKit 0x01bc04c1 -[UIView(Internal) _addSubview:positioned:relativeTo:] + 1847
6 UIKit 0x01bb39b1 -[UIView(Hierarchy) addSubview:] + 56
7 Lacrosse-Stats 0x00083d2f -[I3DragBetweenHelper animateDummyExchange:inContainer:withCompletionBlock:] + 879
8 Lacrosse-Stats 0x00088467 -[I3DragBetweenHelper handleDragFromDstStoppedInDstAtPoint:] + 1031
9 Lacrosse-Stats 0x00086949 -[I3DragBetweenHelper handleDragStopped:] + 1289
10 Lacrosse-Stats 0x0008623e -[I3DragBetweenHelper handlePan:] + 254
11 UIKit 0x01ed0e8c _UIGestureRecognizerSendActions + 230
12 UIKit 0x01ecfb00 -[UIGestureRecognizer _updateGestureWithEvent:buttonEvent:] + 383
13 UIKit 0x01ed156d -[UIGestureRecognizer _delayedUpdateGesture] + 60
14 UIKit 0x01ed4acd ___UIGestureRecognizerUpdate_block_invoke + 57
15 UIKit 0x01ed4a4e _UIGestureRecognizerRemoveObjectsFromArrayAndApplyBlocks + 317
16 UIKit 0x01ecb148 _UIGestureRecognizerUpdate + 199
17 UIKit 0x01b9719a -[UIWindow _sendGesturesForEvent:] + 1291
18 UIKit 0x01b980ba -[UIWindow sendEvent:] + 1030
19 UIKit 0x01b6be86 -[UIApplication sendEvent:] + 242
20 UIKit 0x01b5618f _UIApplicationHandleEventQueue + 11421
21 CoreFoundation 0x0382483f __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION
+ 15
22 CoreFoundation 0x038241cb __CFRunLoopDoSources0 + 235
23 CoreFoundation 0x0384129e __CFRunLoopRun + 910
24 CoreFoundation 0x03840ac3 CFRunLoopRunSpecific + 467
25 CoreFoundation 0x038408db CFRunLoopRunInMode + 123
26 GraphicsServices 0x037559e2 GSEventRunModal + 192
27 GraphicsServices 0x03755809 GSEventRun + 104
28 UIKit 0x01b58d3b UIApplicationMain + 1225
29 Lacrosse-Stats 0x0000300d main + 125
30 libdyld.dylib 0x03270701 start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)

@SteveFortune
Copy link
Member

What version of iOS and device are you running this on?

@SteveFortune
Copy link
Member

I have a feeling this is related to #8 and how NSKeyArchiver / NSKeyUnarchiver are used to clone the cells for animation.

But need to know more about the dev environment to resolve.

@cvconover
Copy link
Author

Xcode 5 (latest Mac Mavericks, latest update, powerbook that is about 5
months old).
Original app was target at iOS 4.x I believe. Hasn't been migrated to be
ARC so still lots of release/retain code.

@SteveFortune
Copy link
Member

Hmm ok. Are you running it ok an iOS 7 simulator? Or a device? Ive only been using this on devices and simulators that are iOS 6 and up so if youre running it on a previous verion of iOS i can imagine there will be problems.

Anyways ill see if I can reproduce the bug and post an update.

.happy coding! :)

@cvconover
Copy link
Author

I was testing with sim with deployment target set to 6.0 but base SDK set to 7.0 (based on some recommendation I read about). Testing on sim and iPad with iOS 6.1, it crashes. For some reason I can't get it to produce error stack trace and it just freezes on this line
https://github.com/ice3-software/i3-dragndrop/blob/master/Classes/I3DragBetweenHelper.m#L176

Not even pressing the "continue" in debugger makes it advance.

Like I said, unless this is important for you to fix, don't waste any time on me. I'll keep plugging away.
Cheers
Craig

@cvconover
Copy link
Author

I read #8 but I have simple text only cells.
I found a workaround but not of its impact on anything else. I just commented out lines 175 and 176 of the helper class and it works fine.

https://github.com/ice3-software/i3-dragndrop/blob/master/Classes/I3DragBetweenHelper.m#L175

Any idea what the issue might be?

@SteveFortune
Copy link
Member

Ah right its because we're removing and then re-adding a view to the same superview. I think a potential fix/workaround could be to make another copy of the draggingView and add that to the superview instead. Again, I'll check it out when I get a spare sec.

@SteveFortune SteveFortune added this to the 2.0.0 milestone Sep 18, 2014
SteveFortune added a commit that referenced this issue Sep 19, 2014
… the bounds of a draggable item in a collection
@SteveFortune
Copy link
Member

See #29 for possible progress on this one.

@SteveFortune
Copy link
Member

See most recent comment on #29

@SteveFortune
Copy link
Member

Fixed for v2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants