Is there a way to use the WebKit web inspector from a Cocoa WebView object?

A REALLY easy way to do it… is in the terminal…. ⌘ ⬆ ☺ defaults write com.yourcompany.yourbundleid WebKitDeveloperExtras TRUE (With OSX 10.8, use defaults write com.yourcompany.yourbundleid WebKitDeveloperExtras -bool true instead). NOTE: You MUST change com.yourcompany.yourbundleid to YOUR specific “apps” (or whatever company’s app bundle ID it may be) before this will work!** The nice thing … Read more

NSString to NSDate

You can’t invent format string syntax and expect it to work; you need to actually use a documented format. (Seriously, “MM” meaning “month”, “minute” and “GMT offset minutes” all at the same time?) As the documentation points out, the 10.4 formatters use Unicode format strings. Try “yyyy-MM-dd HH:mm:ss ZZZ” instead. Also, Objective-C source is ASCII. … Read more

How to show alert pop-up in in Cocoa on macOS?

You can use NSAlert in cocoa. This is same as UIAlertView in ios. you can pop-up alert by this NSAlert *alert = [NSAlert alertWithMessageText:@”Alert” defaultButton:@”Ok” alternateButton:@”Cancel” otherButton:nil informativeTextWithFormat:@”Alert pop up displayed”]; [alert runModal]; EDIT: This is the latest used method as above method is deprecated now. NSAlert *alert = [[NSAlert alloc] init]; [alert setMessageText:@”Message text.”]; … Read more

Does NSView have anything analogous to UIView’s setNeedsLayout/layoutSubviews methods?

As of OSX 10.7: – (void)layout is equivalent to layoutSubviews There is now an identical setNeedsLayout. Override this method if your custom view needs to perform custom layout not expressible using the constraint-based layout system. In this case you are responsible for calling setNeedsLayout: when something that impacts your custom layout changes. You may not … Read more

Core Data -existingObjectWithID:error: causes error 133000

The problem is that NSManagedObjectID you pass is temporary. You can check it by calling NSManagedObjectID‘s isTemporaryID method. From docs: Returns a Boolean value that indicates whether the receiver is temporary. Most object IDs return NO. New objects inserted into a managed object context are assigned a temporary ID which is replaced with a permanent … Read more

How to let NSTextField grow with the text in auto layout?

The method intrinsicContentSize in NSView returns what the view itself thinks of as its intrinsic content size. NSTextField calculates this without considering the wraps property of its cell, so it will report the dimensions of the text if laid out in on a single line. Hence, a custom subclass of NSTextField can override this method … Read more

How do I make an NSView move to the front of all NSViews

Here’s another way to accomplish this that’s a bit more clear and succinct: [viewToBeMadeForemost removeFromSuperview]; [self addSubview:viewToBeMadeForemost positioned:NSWindowAbove relativeTo:nil]; Per the documentation for this method, when you use relativeTo:nil the view is added above (or below, with NSWindowBelow) all of its siblings.

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)