i got following assertion failure :
Assertion failure in -[UITextFieldLabel setTextColor:], /SourceCache/UIKit_Sim/UIKit-1448.89/UILabel.m:314
at this line
[self.window makeKeyAndVisible];
in appDidFinishLaunching method.
Unhandled exception: Debug info are
Invalid parameter not satisfying: color
(
"4 libc++abi.dylib 0x991331fe _Z19safe_handler_callerPFvvE + 15",
"5 libc++abi.dylib 0x99133268 __cxa_bad_typeid + 0",
"6 libc++abi.dylib 0x991342a0 _Z23__gxx_exception_cleanup19_Unwind_Reason_CodeP17_Unwind_Exception + 0",
"7 libobjc.A.dylib 0x0167e416 __objc_personality_v0 + 0",
"8 CoreFoundation 0x0182cef8 +[NSException raise:format:arguments:] + 136"
)
Any help would be appreciated :)
Thanks in advance.
I had the same issue and I finally found the cause of the issue.
It looks as [UILabel setTextColor:] crashes on (only!) iOS 4.x when a nil color is passed as parameter. My app runs fine on iOS 5 and 6.
I am using a navigationBar, created with IB which has a UITextField in it (which is, as usual, a subview of an BarButtonItem). This TextField had a TextColor attribute left to it default value. For TextFields which are placed on a normal view, this works fine but not for my TextField in a navigationBar. Once I changed the TextColor to anything else (e.g. Dark Text Color) works fine and doesn't cause any further crash.
It was hard to track down this issue as it happens at App startup and by the time when all NIB files are loaded so debugging the code or exception breakpoints didn't work. Even the crash log didn't help as it just tells you that it happens while loading a NIB file but doesn't tell you which one. In my case, there a quite a few views being loaded at startup. I was finally able track down the issue by creating a class category of the UILabel Class and just added a -(void )setTextColor:(UIColor *)color method to this category. In this method, I was then able to set a breakpoint and found that the parameter was nil in only one case. In addition, I then added -(void )setText:(NSString *)text and watched which text was set for this particular UILabel where the color was previously set no nil. The text parameter finally pointed me to my UITextField in the navigationBar.
Maybe this helps in other cases, where this crash is not related to a UITextField in an UINavigationBar.
Related
In my project in cocoa have the same Problem as Can Poyrazoğlu in this Question:
Storyboard doesn't contain a controller with identifier 'MainWindow'
None of the advices help, included manually saving the project. It worked well - 3000 lines - until I began inserting code with NSTableView.
The behavior is odd:
I have some print statements in the TableView code for debugging.
After a change in the code, the app runs but nothing is shown in the TableView exept the above line appears, but the printing does not show up in the console. Running again mostly works. The error message now apears AFTER the print output.
Is this a timing issue?
Storyboard ID is set correctly, I think. In other projects I never had to set such an ID
Any help...
let mainViewController2 = self.storyboard?.instantiateViewController(withIdentifier: "mainview") as! mainview
in your case you forgot the class name so this error showing you.
Similarly to this website "Move From UITextField to UITextView When Return Pressed", my cursor appears one line below the intended line. I have tried to use this link as my reference but there didn't seem to be a finalised answer that I could use.
I have also tried
[self.memoTextView performSelector:#selector(becomeFirstResponder) withObject:nil afterDelay:0.0];
but weirdly it work for my simulator but not my device.
Using
[self.memoTextView performSelector:#selector(becomeFirstResponder) withObject:nil afterDelay:0.1];
I am able to navigate from UITextField to UITextView using the Return Key. The error was due to a delay of 0.1 when using the device.
This looks really strange to me
Once i add a NSPopover and it's contentVC to the Nib (file owner is set right to myVC) and right AFTER triggering
[self.sliderPopover showRelativeToRect:rect ofView:sender preferredEdge:NSMinYEdge];
All mi bindings and action bound to FileOwner(myVC) are (re)bound to the Popovers content VC and i'am getting lot's of
Could not connect the action testValueChanged: to target of class SliderPopoverViewController
As the Popovers contentVC, doesn't have the corresponding path
Why is this happening?
UPDATE:
when i do
- (void)awakeFromNib {
[self.sliderPopover.contentViewController view];
}
the same problem occurs, so it's definitely related to loading of the contentVC
UPDATE:
Changing the name from
SliderPopoverViewController.xib to __SliderPopoverViewController.xib did helpe, but i still don't understand why (and in second place, i don't understand, why the __SliderPopoverViewController was loaded after name change (as it doesn't match the name of the class))
So is this all some weird bug?
Must have been some bug, renaming the
SliderPopoverViewController.xib to __SliderPopoverViewController.xib did helped
I have a came across a rather annoying bug in one of my apps. In iOS7 when I hold down on a UITextView or UITextField to bring up the Magnifying Glass, nothing shows up in the magnified area. This problem is app wide and the only element that ever shows up in the circle area is the keyboard itself (when I drag my finger down to the top of it).
I have tried everything from View Controllers with only a single UITextView to UIWebView and the problem is app wide.
The magnifying glass works as expected on iOS6 devices, and the iOS7 simulator. But not on any of the devices I have tested it with running iOS7.
Any help would be greatly appreciated.
I fixed this by setting the windowLevel of my main window to a float value of 1.2 in appDelegate:
self.window.windowLevel = 1.2;
This is a sort of hack for iOS7 to raise the default level of your main window which is UIWindowLevelNormal (1.0) to 1.2
Had the same issue when using multiple windows at once. Setting correct .windowLevel value for each window for correct z-sorting solved the problem.
We have a similar problem where we were presenting a UIWindow over the top of the existing window and if they have the same windowLevel then the loupe displays the first window added.
example:
[applicationWindow (windowLevel = 0] <------------- [customWindow (windowLevel = 0)]
customWindow renders on top of applicationWindow just fine...but a loupe displayed over a textfield in custom window renders the contents of applicationWindow.
[applicationWindow (windowLevel = 1] <------------- [customWindow (windowLevel = 1)]
Same result. customWindow renders on top of applicationWindow just fine...but a loupe displayed over a textfield in custom window renders the contents of applicationWindow.
[applicationWindow (windowLevel = 0] <------------- [customWindow (windowLevel = 1.01)]
customWindow renders correctly, contents of loupe render correctly.
The way we solved it is by initing customWindow.windowLevel to be UIApplication sharedApplication].keyWindow.windowLevel + .01 (but this could be anything) before making our customWindow the keyWindow. Thanks #user2940692, your answer should probably be the accepted one... if you want it, i'll post our case as a question, you can answer it and I'll give you credit.
I had the same issue. I found that in Project -> Targets -> General that there was a nib listed in the "Main Interface". Once I removed that it works fine. I also tried setting the window level, and it worked, but it was just masking the true problem for me.
If you did not get any help from the above solutions, I found another problem which can cause this to happen. I had a UIWindow object in nib which was initialized in AppDelegate. That view had background color as [UIColor whiteColor]. Setting it to [UIColor clearColor] will resolve this problem.
I am having a trouble try to display a NSWindow with out using Interface Builder. The initialization of the window was quite confusing since I am more familiar with iPhone (which does not have an NSWindow equivalent). So I searched Google for some code and I eventually found this:
NSRect windowRect = NSMakeRect(10.0f, 10.0f, 800.0f, 600.0f);
NSWindow *window = [[NSWindow alloc] initWithContentRect:windowRect
styleMask:( NSResizableWindowMask | NSClosableWindowMask | NSTitledWindowMask)
backing:NSBackingStoreBuffered defer:NO];
[window makeKeyAndOrderFront:nil];
So I copied that code and placed it in the applicationDidFinishLaunching and thought all would be good. But all is not good. Xcode did not display any errors (or warnings) in the Build Results. But, I do get this message in the display log:
2010-06-26 13:33:47.170 FooApp[283:a0f] Could not connect the action buttonPressed: to target of class NSApplication
I don't know how to interpret this as Google has failed me on searching for a solution on this display log error. And, as far as I can tell, I have no actions at the moment including a buttonPressed one. As a side note: I do not know if this is relevant or not, but I deleted the Main Window.xib and its accompanying property in the info.plist.
Any help would be greatly appreciated.
UPDATE: I tried doing some printf debugging (never really bothered learning NSLog) and the thing won't even printf if the thing is at the very beginning of the appliactionDidFinishLaunching or even worst, at the start of main (before the return if incase some of you are tempted to ask me if I put the printf before or after the return statement).
MainWindow.xib is part of the iphone App template, isn't it? What exactly did you delete? You still have the MainMenu.xib, right?
As you have discovered, having a nib file is not optional for a Cocoa app. You must have at least one nib (or xib, for you youngsters) and it must have a main menu in it.