I tried to create a UICollectionView using the Flow Layout.
The cells are simply text labels for the time being.
The first screen of cells is displayed just fine, but when I try to scroll, the simulator crashes.
The debugger shows the following messages:
(lldb) thread backtrace
* thread #1: tid = 0x39235a, 0x008440b2 libobjc.A.dylib`objc_msgSend + 14, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0xa000000c)
* frame #0: 0x008440b2 libobjc.A.dylib`objc_msgSend + 14
frame #1: 0x01ab9b30 UIKit`-[UICollectionView _createPreparedCellForItemAtIndexPath:withLayoutAttributes:applyAttributes:] + 257
frame #2: 0x01abb775 UIKit`-[UICollectionView _updateVisibleCellsNow:] + 4730
frame #3: 0x01abf65f UIKit`-[UICollectionView layoutSubviews] + 265
frame #4: 0x014e2964 UIKit`-[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 355
frame #5: 0x0084682b libobjc.A.dylib`-[NSObject performSelector:withObject:] + 70
frame #6: 0x0280e45a QuartzCore`-[CALayer layoutSublayers] + 148
frame #7: 0x02802244 QuartzCore`CA::Layer::layout_if_needed(CA::Transaction*) + 380
frame #8: 0x028020b0 QuartzCore`CA::Layer::layout_and_display_if_needed(CA::Transaction*) + 26
frame #9: 0x027687fa QuartzCore`CA::Context::commit_transaction(CA::Transaction*) + 294
frame #10: 0x02769b85 QuartzCore`CA::Transaction::commit() + 393
frame #11: 0x0276a258 QuartzCore`CA::Transaction::observer_callback(__CFRunLoopObserver*, unsigned long, void*) + 92
frame #12: 0x02bd936e CoreFoundation`__CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 30
frame #13: 0x02bd92bf CoreFoundation`__CFRunLoopDoObservers + 399
frame #14: 0x02bb7254 CoreFoundation`__CFRunLoopRun + 1076
frame #15: 0x02bb69d3 CoreFoundation`CFRunLoopRunSpecific + 467
frame #16: 0x02bb67eb CoreFoundation`CFRunLoopRunInMode + 123
frame #17: 0x05f5b5ee GraphicsServices`GSEventRunModal + 192
frame #18: 0x05f5b42b GraphicsServices`GSEventRun + 104
frame #19: 0x01473f9b UIKit`UIApplicationMain + 1225
frame #20: 0x0002423c 8actions`main(argc=1, argv=0xbfffe610) + 156 at main.mm:15
I am using the latest version of rubymotion and the IOS Simulator set to iPhone 4 Inch with IOS 7.1.
The code I am using can be found here:
https://gist.github.com/jhmegorei/42c15038a34971ac5e8e
Note: I did not want to use a CollectionViewController, as I require the collection View to be just another view element that can be added to a normal UIView.
I would be glad if there is anyone who could help me investigate the root cause of this crash :)
There is no "MemoListViewDelegate.rb" in the gist. Did you mean "MemoListDataSource.rb" ?
Also, I assume you mean you changed
list_view.dataSource = MemoListDatasource.new
to
list_view.dataSource = self
as well as moving the data source methods in there.
Did you make any other changes to get it to work?
Related
My project was working absolutely fine, until the upgrade to 9.3. Right after the upgrade I started seeing the EXC_BAD_ACCESS error at my AppDelegate class.
I'm new to IOS development and this is my first Xcode update, are there any steps that I'm supposed to do to make sure my projects don't break like this on every update?
I'm using the Spotify API to mimic an instagram like feed and play songs from spotify on each post. Here is the bt
2018-04-04 22:32:08.479489-0400 Project2[43968:2765723] CreateMetadataFromXMPBufferInternal:566: Threw error #201 (XML parsingfailure)
(lldb) bt
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x0)
frame #0: 0x0000000109f772cf libswiftCore.dylib`swift_getObjectType +47
frame #1: 0x0000000104b38e58 Project2`#objcAppDelegate.application(_:open:sourceApplication:annotation:) at AppDelegate.swift:0
frame #2: 0x0000000107adc33f UIKit`__58-[UIApplication_applicationOpenURLAction:payload:origin:]_block_invoke + 1037
frame #3: 0x0000000107adbc31 UIKit`-[UIApplication _applicationOpenURLAction:payload:origin:] + 652
frame #4: 0x0000000107ae8eff UIKit`-[UIApplication_handleNonLaunchSpecificActions:forScene:withTransitionContext:completion:] + 4851
frame #5: 0x0000000107e9466d UIKit`-[__UICanvasLifecycleMonitor_CompatabilityactivateEventsOnly:withContext:completion:] + 1641
frame #6: 0x00000001088054d4 UIKit`__82-[_UIApplicationCanvas_transitionLifecycleStateWithTransitionContext:completion:] _block_invoke + 299
frame #7: 0x000000010880536e UIKit`-[_UIApplicationCanvas_transitionLifecycleStateWithTransitionContext:completion:] + 433
frame #8: 0x00000001084e962d UIKit`__125- [_UICanvasLifecycleSettingsDiffAction performActionsForCanvas:withUpdatedScene:settingsDiff: fromSettings:transitionContext:]_block_invoke + 221
frame #9: 0x00000001086e4387UIKit`_performActionsWithDelayForTransitionContext + 100
frame #10: 0x00000001084e94f7 UIKit`- [_UICanvasLifecycleSettingsDiffAction performActionsForCanvas:withUpdatedScene:settingsDiff:fromSettings:transitionContext:] + 223
frame #11: 0x0000000108265fb0 UIKit`-[_UICanvas scene:didUpdateWithDiff:transitionContext:completion:] + 392
frame #12: 0x00000001080a2f89 UIKit`-[UIApplicationSceneClientAgentscene:handleEvent:withCompletion:] + 502
frame #13: 0x000000011094ed2d FrontBoardServices`__80-[FBSSceneImpl updater:didUpdateSettings:withDiff:transitionContext:completion:]_block_invoke.362 + 198
frame #14: 0x000000010ac2c848 libdispatch.dylib`_dispatch_client_callout + 8
frame #15: 0x000000010ac31e14 libdispatch.dylib`_dispatch_block_invoke_direct + 592
frame #16: 0x0000000110982470 FrontBoardServices`__FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__ + 24
frame #17: 0x000000011098212e FrontBoardServices`-[FBSSerialQueue _performNext] + 439
frame #18: 0x000000011098268e FrontBoardServices`-[FBSSerialQueue _performNextFromRunLoopSource] + 45
frame #19: 0x0000000106944bb1 CoreFoundation`__CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
frame #20: 0x00000001069294af CoreFoundation`__CFRunLoopDoSources0 +271
frame #21: 0x0000000106928a6f CoreFoundation`__CFRunLoopRun + 1263
frame #22: 0x000000010692830b CoreFoundation`CFRunLoopRunSpecific + 635
frame #23: 0x000000010da7aa73 GraphicsServices`GSEventRunModal + 62
frame #24: 0x0000000107ad30b7 UIKit`UIApplicationMain + 159
* frame #25: 0x0000000104b393f7 Project2`main at AppDelegate.swift:12
frame #26: 0x000000010aca9955 libdyld.dylib`start + 1
(lldb)
Can someone help please? Has anyone seen anything of this sort?
I am using pdfTron with iOS. I have successfully integrated PDFTron with my iOS application.
Now I am facing an issue where in if an already made annotation is selected and I try to go back from the view, the application is crashing with EXC_BAD_ACCESS error. I am able to see the previous screen while going back. After the previous screen appears, then the app gets crashed in main. This does not happen when I come back without the annotation being selected.
* thread #1: tid = 0x14c78, 0x0281b3f6 myProject`___lldb_unnamed_symbol40638$$myProject + 22, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x800000a0)
frame #0: 0x0281b3f6 myProject`___lldb_unnamed_symbol40638$$myProject + 22
frame #1: 0x0250ce31 myProject`___lldb_unnamed_symbol28291$$myProject + 49
frame #2: 0x01bf03f8 myProject`TRN_AnnotIsValid + 40
frame #3: 0x01afd0ba myProject`ObjCPP_PTAnnot_IsValid + 34
frame #4: 0x01a80e0a myProject`-[PTAnnot IsValid] + 32
frame #5: 0x0199d062 myProject`-[AnnotEditTool deselectAnnotation] + 66
frame #6: 0x0198e96b myProject`-[AnnotEditTool willMoveToSuperview:] + 91
frame #7: 0x066e21ce UIKit`__UIViewWillBeRemovedFromSuperview + 305
frame #8: 0x066e1ee3 UIKit`-[UIView(Hierarchy) removeFromSuperview] + 99
frame #9: 0x019a0c09 myProject`-[ToolManager dealloc] + 73
frame #10: 0x06ef413d UIKit`-[UIView(UIKitManual) release] + 142
frame #11: 0x01a7acae myProject`-[PTPDFViewCtrl dealloc] + 588
frame #12: 0x06ef413d UIKit`-[UIView(UIKitManual) release] + 142
frame #13: 0x08e0ca57 CoreFoundation`CFRelease + 727
frame #14: 0x08e2285e CoreFoundation`-[__NSArrayM dealloc] + 142
frame #15: 0x08966060 libobjc.A.dylib`objc_object::sidetable_release(bool) + 238
frame #16: 0x08965361 libobjc.A.dylib`objc_release + 65
frame #17: 0x0896652d libobjc.A.dylib`(anonymous namespace)::AutoreleasePoolPage::pop(void*) + 371
frame #18: 0x08e2d508 CoreFoundation`_CFAutoreleasePoolPop + 24
frame #19: 0x08e65cdc CoreFoundation`__CFRunLoopRun + 2364
frame #20: 0x08e650e6 CoreFoundation`CFRunLoopRunSpecific + 470
frame #21: 0x08e64efb CoreFoundation`CFRunLoopRunInMode + 123
frame #22: 0x0a49a664 GraphicsServices`GSEventRunModal + 192
frame #23: 0x0a49a4a1 GraphicsServices`GSEventRun + 104
frame #24: 0x0662bbfa UIKit`UIApplicationMain + 160
* frame #25: 0x0013c23c myProject`main(argc=1, argv=0xbffaa928) + 140 at main.m:16
frame #26: 0x09e6ca21 libdyld.dylib`start + 1
The first thing that Annot::IsValid does is check if the pointer is null or not. So if IsValid is crashing, then this means the underlying PDFDoc object has been destroyed, or the underlying pointer is not valid somehow.
First thing to check is if the PDFDoc object is alive or not. If it is destroyed then no objects associated with it should be used.
Or, you deleted the Annotation object earlier somehow, or its underlying pointer got changed. Object references should not be kept around in case they do get moved/deleted. If you want to retain annotations for long term, please see this post.
Sometime after writing code to my project, I noticed the debugger would pause my application and put lldb in the console and couldn't let me continue. I used NSZombies and I got this message : "-[NSThread threadDictionary]: message sent to deallocated instance". I have looked around but couldn't find any help what is causing this. When I print the backtrace I get:
thread #17: tid = 0x7886f, 0x0000000180f7ab40 CoreFoundation`___forwarding___ + 700, stop reason = EXC_BREAKPOINT (code=1, subcode=0x180f7ab40)
frame #0: 0x0000000180f7ab40 CoreFoundation`___forwarding___ + 700
frame #1: 0x0000000180e78c5c CoreFoundation`_CF_forwarding_prep_0 + 92
frame #2: 0x00000001860536dc UIFoundation`+[NSStringDrawingTextStorageSettings threadSpecificStringDrawingTextStorageSettings:] + 64
frame #3: 0x000000018604900c UIFoundation`+[NSString(NSStringDrawing) typesetterBehavior] + 32
frame #4: 0x000000018604a6d4 UIFoundation`__NSStringDrawingEngine + 244
frame #5: 0x000000018604a4d0 UIFoundation`-[NSString(NSExtendedStringDrawing) drawWithRect:options:attributes:context:] + 176
frame #6: 0x00000001860eb564 UIKit`-[UILabel _drawTextInRect:baselineCalculationOnly:] + 3856
frame #7: 0x000000018615e8f0 UIKit`-[UILabel drawTextInRect:] + 544
frame #8: 0x000000018615e678 UIKit`-[UIView(CALayerDelegate) drawLayer:inContext:] + 368
frame #9: 0x0000000183a92230 QuartzCore`-[CALayer drawInContext:] + 260
frame #10: 0x0000000183a7c8b4 QuartzCore`CABackingStoreUpdate_ + 2432
frame #11: 0x0000000183b94360 QuartzCore`___ZN2CA5Layer8display_Ev_block_invoke + 52
frame #12: 0x0000000183a7ba90 QuartzCore`CA::Layer::display_() + 1368
frame #13: 0x0000000183a5d7b0 QuartzCore`CA::Layer::display_if_needed(CA::Transaction*) + 228
frame #14: 0x0000000183a5d49c QuartzCore`CA::Layer::layout_and_display_if_needed(CA::Transaction*) + 44
frame #15: 0x0000000183a5cac0 QuartzCore`CA::Context::commit_transaction(CA::Transaction*) + 252
frame #16: 0x0000000183a5c820 QuartzCore`CA::Transaction::commit() + 500
frame #17: 0x0000000183a8bbd4 QuartzCore`CA::Transaction::release_thread(void*) + 236
frame #18: 0x0000000180bda1e0 libsystem_pthread.dylib`_pthread_tsd_cleanup + 584
frame #19: 0x0000000180bd9d58 libsystem_pthread.dylib`_pthread_exit + 136
frame #20: 0x0000000180bd953c libsystem_pthread.dylib`_pthread_wqthread + 1296
frame #21: 0x0000000180bd9020 libsystem_pthread.dylib`start_wqthread + 4
Any help to find out whats going on will help tremendously!
Found out the problem was I had a label with a weak reference. I was hiding it for to long and it seems the garbage collection cleaned in up. So when I tried to send data to it, it was already dealloc.
Somewhere you are calling an instance method of any class and class object is nil.
I am getting a EXC_BAD_ACCESS error every time I trigger a certain segue in my app. Thanks to these two links, I learned you can trouble shoot EXC_BAD_ACCESS easier after enabling NSZombies.
How do I set up NSZombieEnabled in Xcode 4?
http://www.touch-code-magazine.com/how-to-debug-exc_bad_access/
I am using this app adhoc and testing it adhoc. http://www.raywenderlich.com/13511/how-to-create-an-app-like-instagram-with-a-web-service-backend-part-12
When the app loads, a UIScrollView with pictures are shown. When you tap a picture, a push segue is triggered to the fullscreen shot of that picture. The app runs perfectly on iPad but on my iPhone 4 it crashes every time before the push segue. Ive been stuck on this for a week. I just found out what NSZombies are and how to enable them: after I enable them the dubber reads as follows:
2015-07-03 22:26:36.170 iReporter[1878:60b] *** -[CFNumber retain]: message sent to deallocated instance 0x172e6210
After learning how to input 'bt' into the debugger out put to get more info, this is what the debugger reads now;
* thread #1: tid = 0x7246e, 0x2f1e515c CoreFoundation`___forwarding___ + 540, queue = 'com.apple.main-thread', stop reason = EXC_BREAKPOINT (code=EXC_ARM_BREAKPOINT, subcode=0xdefe)
* frame #0: 0x2f1e515c CoreFoundation`___forwarding___ + 540
frame #1: 0x2f134768 CoreFoundation`_CF_forwarding_prep_0 + 24
frame #2: 0x2f11e5a8 CoreFoundation`+[__NSDictionaryM __new:::::] + 536
frame #3: 0x2f1212f0 CoreFoundation`-[__NSPlaceholderDictionary initWithObjects:forKeys:count:] + 240
frame #4: 0x2f125dcc CoreFoundation`+[NSDictionary dictionaryWithObjectsAndKeys:] + 372
frame #5: 0x000c96a4 iReporter`-[StreamPhotoScreen viewDidLoad](self=0x172e7560, _cmd=0x32053af3) + 256 at StreamPhotoScreen.m:20
frame #6: 0x31a044aa UIKit`-[UIViewController loadViewIfRequired] + 518
frame #7: 0x31a04268 UIKit`-[UIViewController view] + 24
frame #8: 0x31b9036a UIKit`-[UINavigationController _startCustomTransition:] + 634
frame #9: 0x31aadd62 UIKit`-[UINavigationController _startDeferredTransitionIfNeeded:] + 418
frame #10: 0x31aadb6c UIKit`-[UINavigationController __viewWillLayoutSubviews] + 44
frame #11: 0x31aadb04 UIKit`-[UILayoutContainerView layoutSubviews] + 184
frame #12: 0x319ffd58 UIKit`-[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 380
frame #13: 0x3167d62a QuartzCore`-[CALayer layoutSublayers] + 142
frame #14: 0x31678e3a QuartzCore`CA::Layer::layout_if_needed(CA::Transaction*) + 350
frame #15: 0x31678ccc QuartzCore`CA::Layer::layout_and_display_if_needed(CA::Transaction*) + 16
frame #16: 0x316786de QuartzCore`CA::Context::commit_transaction(CA::Transaction*) + 230
frame #17: 0x316784ee QuartzCore`CA::Transaction::commit() + 314
frame #18: 0x31a033e0 UIKit`_UIApplicationHandleEventQueue + 8232
frame #19: 0x2f1ae20a CoreFoundation`__CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 14
frame #20: 0x2f1ad6da CoreFoundation`__CFRunLoopDoSources0 + 206
frame #21: 0x2f1abece CoreFoundation`__CFRunLoopRun + 622
frame #22: 0x2f116ebe CoreFoundation`CFRunLoopRunSpecific + 522
frame #23: 0x2f116ca2 CoreFoundation`CFRunLoopRunInMode + 106
frame #24: 0x3401c662 GraphicsServices`GSEventRunModal + 138
frame #25: 0x31a6314c UIKit`UIApplicationMain + 1136
frame #26: 0x000c699c iReporter`main(argc=1, argv=0x27d44cec) + 108 at main.m:16
(lldb)
If i need to post more code/info it might be this: (section of code that the editor highlights on crash sometimes as well telling me its EXC_BAD_ACCESS_)
[api commandWithParams:[NSMutableDictionary dictionaryWithObjectsAndKeys:#"stream", #"command", IdPhoto,#"IdPhoto", nil] onCompletion:^(NSDictionary *json) {
All I am trying to do is call the above data using j son and load it via a push segue. It works absolutely fine on iPad but crashes every time on iPhone 4?
Find the NSNumber property declaration,and check if you have wrongly give a type of assign.
I'm working on a universal app and the iPhone version works just fine. I created a new nib for iPad and set the files owner to be the viewcontroller class. The I connected all the IBOutlets and IBActions. When I run the app on an iPad (and in the iPad simulator) it crashes when I touch any of the controls. I tried setting break points in the IBActions for each but it doesn't even make it to those before the crash happens. What's going on?
Backtrace:
* thread #1: tid = 0x1f03, 0x0189809b libobjc.A.dylibobjc_msgSend + 15, stop reason = EXC_BAD_ACCESS (code=2, address=0x15)
frame #0: 0x0189809b libobjc.A.dylibobjc_msgSend + 15
frame #1: 0x0020f14e UIKit-[UIApplication sendAction:to:from:forEvent:] + 96
frame #2: 0x0020f0e6 UIKit-[UIApplication sendAction:toTarget:fromSender:forEvent:] + 61
frame #3: 0x002b5ade UIKit-[UIControl sendAction:to:forEvent:] + 66
frame #4: 0x002b5fa7 UIKit-[UIControl(Internal) _sendActionsForEvents:withEvent:] + 503
frame #5: 0x002b5b13 UIKit-[UIControl sendActionsForControlEvents:] + 48
frame #6: 0x00304462 UIKit-[UISegmentedControl _setSelectedSegmentIndex:notify:] + 684
frame #7: 0x00305dd0 UIKit-[UISegmentedControl touchesBegan:withEvent:] + 1026
frame #8: 0x002342cf UIKit-[UIWindow sendTouchesForEvent:] + 272
frame #9: 0x002345e6 UIKit-[UIWindow sendEvent:] + 273
frame #10: 0x0021adc4 UIKit-[UIApplication sendEvent:] + 464
frame #11: 0x0020e634 UIKit_UIApplicationHandleEvent + 8196
frame #12: 0x021c0ef5 GraphicsServicesPurpleEventCallback + 1274
frame #13: 0x012a1195 CoreFoundation__CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 53
frame #14: 0x01205ff2 CoreFoundation_CFRunLoopDoSource1 + 146
frame #15: 0x012048da CoreFoundation__CFRunLoopRun + 2218
frame #16: 0x01203d84 CoreFoundationCFRunLoopRunSpecific + 212
frame #17: 0x01203c9b CoreFoundationCFRunLoopRunInMode + 123
frame #18: 0x021bf7d8 GraphicsServicesGSEventRunModal + 190
frame #19: 0x021bf88a GraphicsServicesGSEventRun + 103
frame #20: 0x0020c626 UIKitUIApplicationMain + 1163
frame #21: 0x00001d8d gravity`main + 141 at main.m:16
Turns out the view controller wasn't being retained due to ARC. So when I went back to send messages to it it crashed.