I have found one bug that causes the cocos2d view to stop rendering its contents. The bug can be reproduced using the example project found in Jpsarda's post about integration between UIKit and cocos2d-x.
The link to the website is: http://jpsarda.tumblr.com/post/24983791554/mixing-cocos2d-x-uikit and the link to the project is: http://dl.dropbox.com/u/12856650/Cocos2dxOnUikit.zip.
To reproduce the bug it is sufficient to trigger several times between uikit views and cocos2d views by pressing repeatedly the "Cocos2d-x GO!" button on the first view followed by the "Close" button on the second view. I have also done a video that shows how to reproduce the bug: http://youtu.be/EIvf-Ao6u5I. The bug occurs only on a real device and not on the simulator. Because of this bug it is pretty difficult to create applications that allow the user to switch frequently between cocos2d views and uikit views such the one on which I am working. For the moment I can't understand the root cause and I haven't received a reply on the forum yet. Is there anyone that have an idea/intution/suggestion about the possible cause?
I found the reason. EAGLView is never released and this causes a leak of resources. To resolve the bug in JPSARDA's example it is sufficient to add the following line:
[[EAGLView sharedEGLView] release];
at the end of CCEGELView::release method. This will solve JPSARDA's ( and my application :D ) issues but it is likely that this solution won't work in projects that handle EAGLView's lifecycle in a different way
Related
I'm experiencing weird crash in NSOutlineView: when i click "collapse" button, app crashes immediately and even "exception breakpoint" doesn't help to see where the problem is.
I've tried to run app without debugger, and reproduced the problem. Once app crashed, i've got OSX crash window and was able to extract crash message from there:
The window has been marked as needing another Update Constraints in Window pass, but it has already had more Update Constraints in Window passes than there are views in the window
there also call stack, but it won't help since crash happening inside libsystem_c.dylib, so i'm not posting it here.
It seems there is something wrong going with auto layout. Absolutely have no idea about next steps. Please give me an advice!
Also, one more thing, that began only after update to OSX Mojave.
After hours of debugging and testing, i noticed that that message is caused by "infinite layout loop".
Different code, related to outline view was causing NSSplitView to layout. And delegate method - (CGFloat) splitView:(NSSplitView*)sender constrainMinCoordinate:(CGFloat)proposedMinimumPosition ofSubviewAt:(NSInteger)dividerIndex has been called about 200 times prior to crash.
It's hard to catch this bcs it's not actually infinite recursion, so just debugger doesnt help a lot.
I just added simple code that helped me to identify the issue:
static int a = 0;
NSLog(#"Layout: %d", a++);
Hope my experience will help somebody else!
For anyone who is having the problem in Xcode 14 and macOS using SwiftUI:
I just had the same crash by hiding a view with an animation. My main view contains two views, one view contained an empty ScrollView, which didn't cause a problem by itself, but by changing it's size it crashed. Just adding a basic Text within the ScrollView solved my problem and the app doesn't crash anymore.
I updated my build to IOS 14 and Mac OS 20.15.6 and the error went away.
try turning off 'Use Auto Layout' checkbox in nib (in File Inspector tab).
May have to disable it for each and every view.
Also, unrelated, but Mojave forces you to use Core Animation.
Most of my nibs have 'set wants layer' turned off.
However, in one of my nibs I had a stray setWantsLayer checkbox checked.
when I unchecked it, the view (NSSearchField) drew properly
I am writing Xcode UI test cases for a tableview. My code (Objective-C) is something like this
XCUIElement *elementCell = app.cells[#"AccessibilityIdentifierOfTheCell"];
XCTAssertTrue(elementCell.exists); // this assert passed
[elementCell tap]; // !!!??? crashed here
The testing crashes at the "tap" method.
I also tried Xcode's "Recode UI Test" to see how Xcode would catch the "tapping" behaviour in UI testing but, unfortunately, when I tapped on the cell the testing crashed as well and Xcode popped up this:
I got stuck here for quite a while and it will be highly appreciated if anyone can help me out.
Right after the question was posted I went back and tried again and, weirdly, it worked. I changed nothing. It may be that Xcode UI testing functionality is not steady yet.
Sorry for that.
I am building a cocoa application where required to invoke xib. I tried with several codes but seems making mistake somewhere due to the reason the xib comes behind every window. Thank you in advance.
I have also faced the same problem and #jigs helped me with a good solution.My problem was with storyboard but ii will work for xibs also. Try this, it might be helpful to you also.
tested solution
Just got this error in our error logging system, been searching hi and low and can't seem to find any solution. Any help is appreciated. Here is the stacktrace.
May be in your XCODE log you might have encountered this message
"Presenting view controllers on detached view controllers is
discouraged ".
If yes then then try
[self.view.window.rootViewController presentViewController:myVC];
if this fails then make sure you call presentViewController:myVC on immediate presenting ViewController i.e. in your case what I see from trace - CalendarEventDetailViewController.
If that too fail then go backward - from where you are invoking VC which in turn use presentViewController, in iOS8 presentation layer has changed specially WRT UIAlert/UIActionSheet, and UIPopovers,
if you are using any of these, create UIAlertController as a separate code track for iOS8 and use presentViewController:myVC on presenting ViewController.
I was facing similar issue where presentViewController: not working at all or disrupting presenting VC contents, in some situations dismissViewController was crashing. Using this approach I could fix it.
I am getting a warning I do not fully understand every time I run my app:
Layout still needs update after calling -[WebHTMLView layout]. WebHTMLView or one of its superclasses may have overridden -layout without calling super. Or, something may have dirtied layout in the middle of updating it. Both are programming errors in Cocoa Autolayout. The former is pretty likely to arise if some pre-Cocoa Autolayout class had a method called layout, but it should be fixed.
(I've seen this related question, yet the answer provided solves some other issue, thus my question.) The warning appears as soon as I add a web view to my app. What does it mean, and how should I fix the issue?
It appears that - (void)layout is implemented in WebHTMLView. The source for WebKit is available on Apple's open source page to review.
http://www.opensource.apple.com/source/WebKit/WebKit-7534.53.11/mac/WebView/WebHTMLView.mm
In the Auto Layout documentation, it states that you only need to implement "layout" if you need custom logic to layout subviews while using Auto Layout. It goes on to say that you should always call [super layout] in your custom implementation. That is not happening with WebHTMLView.
https://developer.apple.com/library/mac/#documentation/Cocoa/Reference/ApplicationKit/Classes/NSView_Class/Reference/NSView.html%23//apple_ref/occ/instm/NSView/layout
This message can probably be safely ignored for your project. The same thing happens for me on a blank new project.
Besides the noted NSTableView with dragging I found out that if you open the NSFontManager this will always show this message. Not only with Swift but also with Apple's own demo program CoreTextArcCocoa. So it's definitely some bug in Apple's guts.