Newbie question - core data
Hi, I'm learning Cocoa / Objective-C. Right now I'm trying to build a simple Core Data application. I've built a helper app to read in CSV and populate an XML core data store. That works fine. I have seen lots of examples of binding a view to core data entities so that the contents of the store are loaded into the view when the application runs. I'm comfortable with how this works. However, I want my application to start with an empty view, then have the user enter a search string, and only then display the data that matches the search string. I know I can use NSPredicate to filter the data but don't know how to hook it up in this way. I've read through the Core Data Programming guide, had a look through Marcus Zarra's book, but I just can't get my head around how this should work. Is this something that I can / should do with Core Data? How do I filter the data before displaying anything in the view? If anyone could point me at some sample code / articles etc. that might help fill in the blanks I would appreciate it. Regards Darren. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Examples of MVC pattern with Core Data
Hi, I've been Googling and searching the XCode docs for good examples of using the MVC pattern with Core Data, but not had a lot of success. Can anyone suggest some good examples? I'm learning Cocoa at the moment, and while I'm happy with the MVC pattern (and design patterns in general), I'd like to validate my understanding by seeing some real code example of an MVC app that uses Core Data. Thanks Darren. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
EXC_BAD_ACCESS when calling NSOpenPanel
Hi, I have the following code as the action from a button click: - (IBAction)chooseFile:(id)sender; { NSOpenPanel *openPanel = [NSOpenPanel openPanel]; [openPanel setCanChooseDirectories:NO]; [openPanel setCanCreateDirectories:NO]; [openPanel beginSheetForDirectory:nil file:nil types:[NSArray arrayWithObject:@"txt"] modalForWindow:window modalDelegate:self didEndSelector:@selector(fileOpenDidEnd:returnCode:context:) contextInfo:nil]; } - (void)fileOpenDidEnd:(NSOpenPanel*)openPanel returnCode:(NSInteger)code context:(void*)context { if (code == NSCancelButton) return; [self setFilePath:[openPanel filename]]; [filePathField setStringValue:[openPanel filename]]; } On my 10.6.2 iMac running XCode 3.2.1 it builds and runs fine. On my MacBook Pro with exactly the same OS version (10.6.2) and XCode version I get a crash - EXC_BAD_ACCESS when I run it. The file open dialog pops up for a second but then disappears before I can click on anything. The fileOpenDidEnd method does not get called. Any idea why identical code built with the same version of XCode running on the same version of Snow Leopard works on one machine and crashes on another? Both are clean builds of Snow Leopard rather than upgrades. Regards Darren. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: EXC_BAD_ACCESS when calling NSOpenPanel
The only difference between the two machines is that the working machine has DefaultFolderX installed on it. As a test I installed Default Folder X on the MBP as well. The code now runs without error. So, why would Default Folder X be masking the problem (it overloads the file open/save dialog to add functionality such as favourite folders)? Cheers Darren. On 24/11/2009 00:51, Darren Wheatley wrote: Hi, I have the following code as the action from a button click: - (IBAction)chooseFile:(id)sender; { NSOpenPanel *openPanel = [NSOpenPanel openPanel]; [openPanel setCanChooseDirectories:NO]; [openPanel setCanCreateDirectories:NO]; [openPanel beginSheetForDirectory:nil file:nil types:[NSArray arrayWithObject:@"txt"] modalForWindow:window modalDelegate:self didEndSelector:@selector(fileOpenDidEnd:returnCode:context:) contextInfo:nil]; } - (void)fileOpenDidEnd:(NSOpenPanel*)openPanel returnCode:(NSInteger)code context:(void*)context { if (code == NSCancelButton) return; [self setFilePath:[openPanel filename]]; [filePathField setStringValue:[openPanel filename]]; } On my 10.6.2 iMac running XCode 3.2.1 it builds and runs fine. On my MacBook Pro with exactly the same OS version (10.6.2) and XCode version I get a crash - EXC_BAD_ACCESS when I run it. The file open dialog pops up for a second but then disappears before I can click on anything. The fileOpenDidEnd method does not get called. Any idea why identical code built with the same version of XCode running on the same version of Snow Leopard works on one machine and crashes on another? Both are clean builds of Snow Leopard rather than upgrades. Regards Darren. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/darren%40tenjinconsulting.co.uk This email sent to dar...@tenjinconsulting.co.uk ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Encrypting data in a Core Data SQL store for a Mac desktop app
Hi, Can anyone give me a pointer on how to encrypt (and use) the data in the Core Data sql store of my Mac desktop app? My application has a data store that on its own has a value, and I would like to provide at least a basic level of protection / deterrent before I release it. I've Googled for this, and while I find lots of information on encrypting Core Data stores for iPhone apps, I can't find a solution for Mac applications. Any pointers would be very much appreciated. Regards Darren. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Encrypting data in a Core Data SQL store for a Mac desktop app
Hi, I'd assumed (possibly incorrectly?) that the iPhone encryption was hardware and/or iOS4 dependent. Is that not the case? Cheers Darren. On 18/07/2010 19:25, Jerry Krinock wrote: On 2010 Jul 18, at 03:42, Darren Wheatley wrote: Can anyone give me a pointer on how to encrypt (and use) the data in the Core Data sql store of my Mac desktop app? I've Googled for this, and while I find lots of information on encrypting Core Data stores for iPhone apps, I can't find a solution for Mac applications. Why does the iPhone information you found not apply to Mac apps? ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/darren%40tenjinconsulting.co.uk This email sent to dar...@tenjinconsulting.co.uk ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Query core data store based on a transient calculated value
Hi, I'm fairly new to the more complex parts of Core Data. My application has a core data store with 15K rows. There is a single entity. I need to display a subset of those rows in a table view filtered on a calculated search criteria, and for each row displayed add a value that I calculate in real time but don't store in the entity. The calculation needs to use a couple of values supplied by the user. A hypothetical example: Entity: contains fields "id", "first", and "second" User inputs: 10 and 20 Search Criteria: only display records where the entity field "id" is a prime number between the two supplied numbers. (I need to build some sort of complex predicate method here I assume?) Display: all fields of all records that meet the criteria, along with a derived field (not in the the core data entity) that is the sum of the "id" field and a random number, so each row in the tableview would contain 4 fields: "id", "first", "second", -calculated value- >From my reading / Googling it seems that a transient property might be the way to go, but I can't work out how to do this given that the search criteria and the resultant property need to calculate based on user input. Could anyone give me any pointers that will help me implement this code? I'm pretty lost right now, and the examples I can find in books etc. don't match my particular needs well enough for me to adapt them as far as I can tell. Thanks Darren. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Core Data bindings question
Hi, I have a Core Data app that displays data in a tableView with each column bound to a field in a core data entity. One field is called "active", and is of type BOOL I box the BOOL for insertion into the Core Data store using [NSNumber numberWithBool]; In the TableView I would like to bind the "enabled" property of each cell to the "active" variable, so that if a record has "active" set to NO all of the fields become read only. When I try to bind the enabled property I get the following error: "cannot create BOOL from object of class __NSArray0" Does anyone have any idea how I can achieve the desired result? Regards Darren. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Core Data, NSTableView, Bindings, in code update problem
Hi, I have a simple Core Data app with one entity. I display the content of the core data store (SQL) in an NSTableView, binding the columns to fields in an NSArrayController, which is itself bound to the core data stack. I then have a "data inspector" panel, which is populated when the user clicks on a row in the NSTableView. Essentially this is a set of text fields also bound to the NSArrayController. When I manually update the fields in the data inspector pane they are automatically updated in the NSTableView and when I save, the Core Data store is updated. This all works as planned. However, at certain points I need the application to update the values in the data inspector panel on the users behalf. I have some code that does this update, but the changes are not mirrored in the main NSTableView, and are also not saved to the Core Data store. I'm assuming that this is a KVO-type issue, in that the code update of the fields in the data inspector is not notifying the appropriate objects? I've Googled and looked in my books etc but I'm clearly missing something. I'm feeling my way along this application, so this is all new stuff. If anyone could point me in the right direction I would appreciate it. Regards Darren. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
WebKit - javascript / DOM listeners only fire once
Hi, I have a Mac client application written in Cocoa / Objective-C that presents the user with a list of html documents in a table (master view), and when the user clicks on a row it loads the selected HTML page into a WebView (detail view). Every HTML page has a listener on "click" that calls an Objective-C method. When the application runs and the user clicks on the first row, everything works fine. The "click" event is trapped, and my Objective-C method is successfully called. However, when the user clicks on a second (or subsequent) record and then a new HTML page is loaded in to the same WebView the listener on "click" never fires. If the selected record is the first to be loaded it always works fine, so the problem is not one of bad HTML files. FYI, all files are largely identical. I've boiled the problem down in a simple test application. It can be downloaded here - http://dl.dropbox.com/u/160638/Work/TCL/MapTest2.zip NOTE: The test application outputs a message to the standard log, so you will need to check either the log window in Xcode or Console.app to see the Objective-C method call working (or not). The buttons along the top are in pairs, loading first from a local file, then an HTML page as a string, then pulling an HTML page from a web site. From extensive searching I'm guessing that when I load the second HTML page into the WebView the previous page is retained somehow, and the two listeners on "click" are clashing in some way? Is that possible? Can anyone recommend a way to load HTML pages in a WebView such that subsequent loads will work? Is there a way to ensure that any pages previously loaded into a WebView are fully unloaded before I load the second page? Any suggestions you could make would be appreciated. Regards Darren. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: could not locate an NSManagedObjectModel
Hi, Just to ask the obvious question, but you've created the persistentStoreCoordinator and the managedObjectModel and hooked them all up right? I've been having similar problems this weekend, and running Instruments with Zombies enable has been a great help. It help me pin point the problem area in my app. HTH Darren. On 20/02/2011 21:23, "Shane" wrote: >Trying to learn core data and I have added it to my application while >swapping out my old ways. So I have this initially ... > >@synthesize managedCoreDataObjectContext; > >- (void) awakeFromNib >{ >... >[self setManagedCoreDataObjectContext:[[NSManagedObjectContext alloc] >init]]; >} > >- (void) applicationDidFinishLaunching:(NSNotification *) aNotification >{ >NSManagedObjectContext *context = [self managedCoreDataObjectContext]; > >// error is happening on this next line >network = [NSEntityDescription >insertNewObjectForEntityForName:@"Network" >inManagedObjectContext:context]; >} > > +entityForName: could not locate an NSManagedObjectModel for entity >name 'Network' > >Network is a class that is subclassed from NSManagedObject, and >included in my project. My *.xcdatamodel file is also included in this >project. > >Any help much appreciated. >___ > >Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) > >Please do not post admin requests or moderator comments to the list. >Contact the moderators at cocoa-dev-admins(at)lists.apple.com > >Help/Unsubscribe/Update your Subscription: >http://lists.apple.com/mailman/options/cocoa-dev/darren%40tenjinconsulting >.co.uk > >This email sent to dar...@tenjinconsulting.co.uk ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Count of records in an NSArrayController when associated NSTableView is filtered
Hi, I have an NSTableView bound to an NSArrayController. I would like to have a dashboard onscreen that shows counts of the data based on field values in the entity, e.g.: all records records with active = Y records with updated = Y records with updated = N Is it possible to bind these values individually to the same NSArrayController? FYI, I have a set of filters on fields on the NSTableView that filter out some of the records for the user. If not, could anyone tell me how I can implement the type of real time counts described above please? I have Googled and read my books but can't work out the answer. Thanks Darren. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Sorting NSTableView + CoreData - odd behaviour
Hi, I have an NSTableView bound to a core data-backed NSArrayController. The columns are numbers, strings, and BOOLs. The application works fine, but sorting is broken. I assumed that sorting worked "out of the box" but when I click a column header in the table the rows are reorganised but in a random order. I have noticed that they are mixed up to the point where one row is being written on top of another, resulting in rubbish text in that row. Confusingly, when I click on a row the sorting is instantly fixed and the contents of all rows switches to what it should be. However, this is only true for the records visible at the time; if I scroll further down the table the bad rows are still present. Any ideas what might be causing this behaviour? I've Googled, but can't find anything. Not sure what search terms to use for this TBH. Is my assumption that sorting works "out of the box" incorrect? I thought I only had to implement something if I wanted a custom sort order. Thanks Darren. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
TableView / ArrayController sorting not updating the tableview
Hi, I have an NSTableView bound to a core-data-backed NSArrayController by binding individual columns to arraycontroller.arrangedObjects. I have the default out-of-the-box sorting working, but when I click one of the column headers to sort the table I have problems. Basically the display of the table gets messed up: rows get duplicated, and the sort order is all over the place. However, when I click on a row the TableView redraws and everything looks fine. So, it looks like the sorting is working properly, but it is not being reflected in the display of the tableview until I click on a row. Can anyone tell me why my tableview isn't updating properly when I sort? I have Googled this extensively, looked in the docs, and tried everything I can think of in the code but can't work out what is happening. Thanks Darren. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Duplicate records adding to an NSTableView + NSArrayController
Hi, I have an NSTableView bound to an NSArrayController, itself bound to a Core Data store. The app is working as expected, with two exceptions: 1. Duplicate records: I have an "add" button bound to arraycontroller.insert I have created a newObject method to allow me to define default values, which works fine. When I click add a new record gets inserted, but it appears twice in the NSTableView. However, if I save the moc, close and reopen the application only one record is present. So although it looks like two duplicate records are added, only one is actually present. Can anyone tell me why two records are visible when I add a new record, but not on subsequent runs of the application? 2. Calculating max records Within my "newObject" method I perform a fetch on the moc to determine the MAX value for the "ID" field. This works fine, but the @max.id value is not updated unless I save the MOC after adding each new record. If I don't save the moc the max: function returns the same value as for the previous run. Unless I am missing something obvious all of my objects use the same moc (defined centrally, and then passed around). Can anyone suggest why the max: function is only working properly after a moc save? Thanks in advance Darren. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Calculating the max value for a core data attribute
Hi, I need to find out the maximum value of an attribute of a core data entity. I'm still in the Cocoa learning curve, and this is a simple test app that I'm using to learn. The app imports fortunes from a text file and displays a table on the screen. The imports are done in a separate, background thread. I found this code online, which I have attempted to get working: - (double)getMaxID { NSLog(@"in getMaxID"); // debug // Use a new moc with the original persistentStoreCoordinator to ensure thread safety NSManagedObjectContext *moc = [[NSManagedObjectContext alloc] init]; [moc setPersistentStoreCoordinator:[[self delegate] persistentStoreCoordinator]]; // Create fetch NSFetchRequest *fetch = [[NSFetchRequest alloc] init]; [fetch setEntity:[NSEntityDescription entityForName:@"Fortune" inManagedObjectContext:moc]]; [fetch setResultType:NSDictionaryResultType]; // Expression for Max ID NSExpression *keyPathExpression = [NSExpression expressionForKeyPath:@"id"]; NSExpression *minExpression = [NSExpression expressionForFunction:@"max:" arguments:[NSArray arrayWithObject:keyPathExpression]]; NSExpressionDescription *expressionDescription = [[NSExpressionDescription alloc] init]; [expressionDescription setName:@"maxID"]; [expressionDescription setExpression:minExpression]; [expressionDescription setExpressionResultType:NSDoubleAttributeType]; [fetch setPropertiesToFetch:[NSArray arrayWithObject:expressionDescription]]; // Execute the fetch. double theID = 0; NSError *error = nil; NSArray *objects = nil; objects = [moc executeFetchRequest:fetch error:&error]; if (objects && ([objects count] > 0)) { NSLog(@"query successful"); // debug theID = [((NSNumber *)[[objects objectAtIndex:0] valueForKey:@"maxID"]) doubleValue]; } else { NSLog(@"Setting default value for theID"); // debug theID = 0; } return(theID); } My entity is called "Fortune" and the attribute is called "id" (a Double). When the code runs it crashes when the fetch request is executed. The console shows this: 2009-12-18 00:53:42.777 FortunesHelperMVC[4027:1703] -[NSCFNumber count]: unrecognized selector sent to instance 0x1004d7b10 2009-12-18 00:53:42.778 FortunesHelperMVC[4027:1703] An uncaught exception was raised 2009-12-18 00:53:42.778 FortunesHelperMVC[4027:1703] -[NSCFNumber count]: unrecognized selector sent to instance 0x1004d7b10 2009-12-18 00:53:42.779 FortunesHelperMVC[4027:1703] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSCFNumber count]: unrecognized selector sent to instance 0x1004d7b10' *** Call stack at first throw: ( 0 CoreFoundation 0x7fff83ed9444 __exceptionPreprocess + 180 1 libobjc.A.dylib 0x7fff85fbb0f3 objc_exception_throw + 45 2 CoreFoundation 0x7fff83f321c0 +[NSObject(NSObject) doesNotRecognizeSelector:] + 0 3 CoreFoundation 0x7fff83eac08f ___forwarding___ + 751 4 CoreFoundation 0x7fff83ea81d8 _CF_forwarding_prep_0 + 232 5 Foundation 0x7fff88a5609e +[_NSPredicateUtilities max:] + 46 6 Foundation 0x7fff8893ce72 -[NSFunctionExpression expressionValueWithObject:context:] + 530 7 CoreData0x7fff8613b5b1 -[NSMappedObjectStore executeFetchRequest:withContext:] + 2081 8 CoreData0x7fff8613ad10 -[NSMappedObjectStore executeRequest:withContext:] + 80 9 CoreData0x7fff86108900 -[NSPersistentStoreCoordinator(_NSInternalMethods) executeRequest:withContext:] + 688 10 CoreData0x7fff8610621b -[NSManagedObjectContext executeFetchRequest:error:] + 267 11 FortunesHelperMVC 0x00011d9d -[ImportOperation getMaxID] + 572 12 FortunesHelperMVC 0x00011f95 -[ImportOperation main] + 330 13 Foundation 0x7fff888f406d -[__NSOperationInternal start] + 681 14 Foundation 0x7fff888f3d23 startOperations_block_invoke_2 + 99 15 libSystem.B.dylib 0x7fff86a98ce8 _dispatch_call_block_and_release + 15 16 libSystem.B.dylib 0x7fff86a77279 _dispatch_worker_thread2 + 231 17 libSystem.B.dylib 0x7fff86a76bb8 _pthread_wqthread + 353 18 libSystem.B.dylib 0x7fff86a76a55 start_wqthread + 13 ) terminate called after throwing an instance of 'NSException' Any ideas why this isn't working? Thanks Darren. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post
NSExpressionForFunction - only works with NSSQLiteStoreType?
Hi, I've been following the example NSExpression + core data code in the "Fetching Managed Objects" section of the "Core Data Programming Gudie" on the Apple Developer site: http://developer.apple.com/mac/library/documentation/cocoa/Conceptual/CoreData/Articles/cdFetching.html The sample code for pulling out a mininum or maximum entity value only seems to work if the core data store is set to NSSQLiteStoreType. If the core data store type is set to XML I get errors. Is this correct, or should I be doing something different for XML stores? Regards Darren. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Mapping APIs for use in Cocoa app
Hi, I'm building a Mac / iPad app that displays simple maps to the user (map with location pin, allowing the user to pan and zoom). This is pretty easy to do with Google Maps, but AFAIK the API Ts&Cs prevent use in a commercial application unless a Google Premier API licence is purchased (£Ks). The cost of this means I can't use Google Maps in my application. Can anyone suggest an alternative mapping API for my app please (or correct my understanding of the Google Ts&Cs if I'm wrong)? Regards Darren. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Mapping APIs for use in Cocoa app
Hi, Since my original posting I have found (as you note) that there are two sets of Ts&Cs: one for (iPhone / Map Kit) and one for other apps. The restrictions appear different, and so I have emailed the Google Premier API team for guidance. My interpretation of the terms for non-iphone apps is that if the use of mapping functionality is withheld from certain users (e.g. by the charging of a fee, or if one were to distribute internally within an organisation and not publically) then a Premier API licence is required. The terms don't appear to treat web apps and desktop apps differently (see http://code.google.com/apis/maps/faq.html - Can I use Google Maps in my non-Web application?). This is only my interpretation and not legal advice. For reference: http://code.google.com/apis/maps/terms.html <http://www.google.com/url?sa=D&q=http://code.google.com/apis/maps/terms.html&usg=AFQjCNEiVPhQzTs1BSZaKX-oLPUKDSrFHw> vs http://code.google.com/apis/maps/iphone/terms.html <http://www.google.com/url?sa=D&q=http://code.google.com/apis/maps/iphone/terms.html&usg=AFQjCNEtYTNeO0OY6t_2dAB1YGs11qASRg> I'll post to the list if and when I get advice from the Google Premier API team. Thanks for taking the time to post. Regards Darren. On 26/10/2010 16:28, Conrad Shultz wrote: Can you show where in the iOS API agreement this is stated? There would be many apps that violate it by using MapKit, I would think, if that is the case. While certain activities (e.g. geocoding and route finding) have special restrictions, the controlling section would appear to be 10.4: "Except as explicitly permitted in Section 7, you must not (nor may you permit anyone else to)... charge users or any other third party any incremental fee solely for the use of the Maps API Implementation, the Service, or the Content, unless you have entered into a separate written agreement with Google or obtained Google's written permission <http://www.google.com/enterprise/maps/> to do so (but if you are a consultant who creates or hosts Maps API Implementations for third party customers, you may charge such customers a fee for your consulting or hosting services)" That certainly doesn't sound like it forbids all commercial applications, but then again I am not a lawyer (and this is not legal advice). I also note that you are evidently based in the UK, so there may be rules of which I am unaware. That said, there are significant wording changes in the non-iOS terms (http://code.google.com/apis/maps/terms.html) that may well restrict commercial use. However, I get the impression that these are designed for web apps/sites, not desktop apps, so you might want to ask Google (developer relations, not the search engine). In particular, I'm curious how they handle something like a free application that displays a pin on a map to show a house you have purchased. Such would not charge for access, but use is contingent on having paid an unrelated fee. But this is now quite far afield from cocoa-dev. -- Conrad Shultz www.synthetiqsolutions.com <http://www.synthetiqsolutions.com> On Oct 26, 2010, at 3:10, Darren Wheatley mailto:dar...@tenjinconsulting.co.uk>> wrote: Hi, I'm building a Mac / iPad app that displays simple maps to the user (map with location pin, allowing the user to pan and zoom). This is pretty easy to do with Google Maps, but AFAIK the API Ts&Cs prevent use in a commercial application unless a Google Premier API licence is purchased (£Ks). The cost of this means I can't use Google Maps in my application. Can anyone suggest an alternative mapping API for my app please (or correct my understanding of the Google Ts&Cs if I'm wrong)? ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Mapping APIs for use in Cocoa app
Hi, I have received some additional guidance from the Google Enterprise Sales team: "...Unfortunately I have to reiterate, if there is any payment for any aspect of a service which involves maps, then this requires a license..." However, this *appears* not to be the case for iOS applications. Again, this is just my interpretation and should not be taken as legal advice. I'm going to switch to a Cloud Made solution. Regards Darren. On 26/10/2010 18:51, Darren Wheatley wrote: Hi, Since my original posting I have found (as you note) that there are two sets of Ts&Cs: one for (iPhone / Map Kit) and one for other apps. The restrictions appear different, and so I have emailed the Google Premier API team for guidance. My interpretation of the terms for non-iphone apps is that if the use of mapping functionality is withheld from certain users (e.g. by the charging of a fee, or if one were to distribute internally within an organisation and not publically) then a Premier API licence is required. The terms don't appear to treat web apps and desktop apps differently (see http://code.google.com/apis/maps/faq.html - Can I use Google Maps in my non-Web application?). This is only my interpretation and not legal advice. For reference: http://code.google.com/apis/maps/terms.html <http://www.google.com/url?sa=D&q=http://code.google.com/apis/maps/terms.html&usg=AFQjCNEiVPhQzTs1BSZaKX-oLPUKDSrFHw> vs http://code.google.com/apis/maps/iphone/terms.html <http://www.google.com/url?sa=D&q=http://code.google.com/apis/maps/iphone/terms.html&usg=AFQjCNEtYTNeO0OY6t_2dAB1YGs11qASRg> I'll post to the list if and when I get advice from the Google Premier API team. Thanks for taking the time to post. Regards Darren. On 26/10/2010 16:28, Conrad Shultz wrote: Can you show where in the iOS API agreement this is stated? There would be many apps that violate it by using MapKit, I would think, if that is the case. While certain activities (e.g. geocoding and route finding) have special restrictions, the controlling section would appear to be 10.4: "Except as explicitly permitted in Section 7, you must not (nor may you permit anyone else to)... charge users or any other third party any incremental fee solely for the use of the Maps API Implementation, the Service, or the Content, unless you have entered into a separate written agreement with Google or obtained Google's written permission <http://www.google.com/enterprise/maps/> to do so (but if you are a consultant who creates or hosts Maps API Implementations for third party customers, you may charge such customers a fee for your consulting or hosting services)" That certainly doesn't sound like it forbids all commercial applications, but then again I am not a lawyer (and this is not legal advice). I also note that you are evidently based in the UK, so there may be rules of which I am unaware. That said, there are significant wording changes in the non-iOS terms (http://code.google.com/apis/maps/terms.html) that may well restrict commercial use. However, I get the impression that these are designed for web apps/sites, not desktop apps, so you might want to ask Google (developer relations, not the search engine). In particular, I'm curious how they handle something like a free application that displays a pin on a map to show a house you have purchased. Such would not charge for access, but use is contingent on having paid an unrelated fee. But this is now quite far afield from cocoa-dev. -- Conrad Shultz www.synthetiqsolutions.com <http://www.synthetiqsolutions.com> On Oct 26, 2010, at 3:10, Darren Wheatley <mailto:dar...@tenjinconsulting.co.uk>> wrote: Hi, I'm building a Mac / iPad app that displays simple maps to the user (map with location pin, allowing the user to pan and zoom). This is pretty easy to do with Google Maps, but AFAIK the API Ts&Cs prevent use in a commercial application unless a Google Premier API licence is purchased (£Ks). The cost of this means I can't use Google Maps in my application. Can anyone suggest an alternative mapping API for my app please (or correct my understanding of the Google Ts&Cs if I'm wrong)? ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/darren%40tenjinconsulting.co.uk This email sent to dar...@tenjinconsulting.co.uk ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators a
Disable (grey out) main menu when displaying modal window?
Hi, I load a custom file import window in my Cocoa app using: [NSApp runModalForWindow:window]; The window displays just fine, and is modal. However, the application main menu is still active (e.g. File menu and items), which is making the modal display redundant. I've googled this and searched the docs, but can't find a way to turn the menu off. Someone suggested using this: NSModalSession session = [NSApp beginModalSessionForWindow:window]; [NSApp runModalSession]; - but that doesn't seem to work either. Again, the window displays but the main menu is still active. Can anyone suggest how I turn the main menu off (grey out all menu items) when displaying a modal window please? Thanks Darren. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Disable (grey out) main menu when displaying modal window?
Hi, The answer is to implement the NSUserInterfaceValidations protocol. The one method I needed to implement was: - (BOOL)valildateUserInterfaceItem: Returning NO disables the referenced menu item. All works fine now. Darren. On 25/01/2011 08:45, "Darren Wheatley" wrote: >Hi, > >I load a custom file import window in my Cocoa app using: > >[NSApp runModalForWindow:window]; > >The window displays just fine, and is modal. > >However, the application main menu is still active (e.g. File menu and >items), which is making the modal display redundant. > >I've googled this and searched the docs, but can't find a way to turn the >menu off. > >Someone suggested using this: > >NSModalSession session = [NSApp beginModalSessionForWindow:window]; >[NSApp runModalSession]; > >- but that doesn't seem to work either. Again, the window displays but the >main menu is still active. > >Can anyone suggest how I turn the main menu off (grey out all menu items) >when displaying a modal window please? > >Thanks > >Darren. > > >___ > >Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) > >Please do not post admin requests or moderator comments to the list. >Contact the moderators at cocoa-dev-admins(at)lists.apple.com > >Help/Unsubscribe/Update your Subscription: >http://lists.apple.com/mailman/options/cocoa-dev/darren%40tenjinconsulting >.co.uk > >This email sent to dar...@tenjinconsulting.co.uk ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Screen capture on OS X
Hi, I have a Mac app that loads a Leaflet.js map into a web view. I've written a screenshot method to grab the map for inclusion in a print view. This is largely based on the examples here: http://stackoverflow.com/questions/11948241/cocoa-how-to-render-view-to-image I'm writing my app on 10.8 and targeting 10.7 and above. I've tried the three methods shown in the SO post, and only the CGWindowListCreateImage works correctly in my app. The problem I have is that the quality of the resultant image is poor, which is exacerbated when the image is resized for printing. By comparison, if I run my app, display the map, and then take a screenshot with Realmac's Littlesnapper app, the resultant image is of a much higher quality, and looks good on screen and printed. This isn't resized though, so not a direct comparison. Can anyone suggest an alternative approach for grabbing screenshots? I've spent a lot of time Googling for tips, and trying out different code snippets, but nothing has dramatically improved the image quality. For reference, what I am doing is essentially: 1. Work out the rect of the map view 2. Call CGWindowListCreateImage CGImageRef cgimg = CGWindowListCreateImage(rect, kCGWindowListOptionIncludingWindow, (CGWindowID)[[aView window] windowNumber], kCGWindowImageDefault); 3. Create an NSImage: return [[[NSImage alloc] initWithCGImage:cgimg size:[aView bounds].size] autorelease]; 4. Add the image to the print view. I tried dataWithPDFInsideRect: and bitmapImageRepForCachingDisplayInRect: but both produced blank screenshots. Thanks Darren. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
How can I get data from a javascript function in a WebView into the enclosing Cocoa App?
Hi, I'm writing an application that renders a web page in a web view. The web page contains an image that the user can click on. There are Javascript events that get called when the user clicks on the image. These events contain the coordinates of the point the user clicked on. I need to be able to get the coordinates out of the web view and back into the enclosing Cocoa application. Is this possible, and if so, could anyone suggest how this could be done? Thanks Darren. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
How to change highlight colour on NSTableView row
Hi, I have a custom subclass of NSTableView in my app. I would like to change the highlight colour displayed when the user clicks on a row, and have the colour maintained when the NSTableView subclass loses focus. I have changed the subclass to ensure that the table is never first responder, and so the user only ever sees the "lost focus" highlight colour (gray by default). This maintains the same highlight colour when the table has focus, and when it doesn't. I would now like to change the default gray colour to a custom colour. My tableview is currently cell-based. I am targeting 10.7+ so I could switch to view-based if that would give me more options? Can anyone suggest a method that will allow me to set a custom highlight colour on on a row when the user clicks on it? I've Googled for a solution, but haven't been able to find anything that works. Thanks Darren. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: How to change highlight colour on NSTableView row
Hi, Thanks for the reply. I tried the code sample you suggested but can't get it to work. When running the default highlighting is being layered on top of this custom highlighting (I can see part of the custom highlighting where the rects are not quite overlapping). Do you know how I prevent the standard formatting from being displayed? Also, (might be a symptom of the above) the custom highlighting is not always removed when I click on a new row. If I scroll those rows off the screen and back on the highlighting is fixed, so there is some sort of display refresh problem. I have tried standard and source list highlighting (set in the xib), and both display the same behaviour. Do you know what might be going on here, or anything I should check in my code? Any suggestions you could make would be very much appreciated. FYI, I am developing on 10.8.5 and targeting 10.7. Regards Darren. On 21 Oct 2013, at 17:23, wrote: > On 21 Oct 2013, at 16:19, Darren Wheatley > wrote: > >> Hi, >> >> I have a custom subclass of NSTableView in my app. >> >> Can anyone suggest a method that will allow me to set a custom highlight >> colour on on a row when the user clicks on it? >> >> I've Googled for a solution, but haven't been able to find anything that >> works. >> >> > For cell based tables try: > > - (void)highlightSelectionInClipRect:(NSRect)clipRect > > There is a sample implementation at > http://stackoverflow.com/questions/7038709/change-highlighting-color-in-nstableview-in-cocoa. > You may need to set selectionHighlightStyle to > NSTableViewSelectionHighlightStyleSourceList > > Note: This method should not be subclassed or overridden for a view-base > table view. Instead, row drawing customization should be done by subclassing > NSTableRowView. > > Jonathan > > > ___ > > Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) > > Please do not post admin requests or moderator comments to the list. > Contact the moderators at cocoa-dev-admins(at)lists.apple.com > > Help/Unsubscribe/Update your Subscription: > https://lists.apple.com/mailman/options/cocoa-dev/darren%40tenjinconsulting.co.uk > > This email sent to dar...@tenjinconsulting.co.uk ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: How to change highlight colour on NSTableView row
Hi, Thanks for the reply. I tried the code sample you suggested but can't get it to work. When running the default highlighting is being layered on top of this custom highlighting (I can see part of the custom highlighting where the rects are not quite overlapping). Do you know how I prevent the standard formatting from being displayed? Also, (might be a symptom of the above) the custom highlighting is not always removed when I click on a new row. If I scroll those rows off the screen and back on the highlighting is fixed, so there is some sort of display refresh problem. I have tried standard and source list highlighting (set in the xib), and both display the same behaviour. Do you know what might be going on here, or anything I should check in my code? Any suggestions you could make would be very much appreciated. FYI, I am developing on 10.8.5 and targeting 10.7. Regards Darren. On 21 Oct 2013, at 17:23, wrote: > On 21 Oct 2013, at 16:19, Darren Wheatley > wrote: > >> Hi, >> >> I have a custom subclass of NSTableView in my app. >> >> Can anyone suggest a method that will allow me to set a custom highlight >> colour on on a row when the user clicks on it? >> >> I've Googled for a solution, but haven't been able to find anything that >> works. >> >> > For cell based tables try: > > - (void)highlightSelectionInClipRect:(NSRect)clipRect > > There is a sample implementation at > http://stackoverflow.com/questions/7038709/change-highlighting-color-in-nstableview-in-cocoa. > You may need to set selectionHighlightStyle to > NSTableViewSelectionHighlightStyleSourceList > > Note: This method should not be subclassed or overridden for a view-base > table view. Instead, row drawing customization should be done by subclassing > NSTableRowView. > > Jonathan > > > ___ > > Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) > > Please do not post admin requests or moderator comments to the list. > Contact the moderators at cocoa-dev-admins(at)lists.apple.com > > Help/Unsubscribe/Update your Subscription: > https://lists.apple.com/mailman/options/cocoa-dev/darren%40tenjinconsulting.co.uk > > This email sent to dar...@tenjinconsulting.co.uk ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: How to change highlight colour on NSTableView row
Hi, Thanks for the post. I've tried your suggestion but it doesn't change the default rendering I'm afraid. Here's what I did: - created an NSTextFieldCell subclass - Added the method you suggested - changed the table cells in the NSTableView defined in IB to use my new subclass Was that the correct approach? Regards Darren. On 22/10/2013 21:06, Corbin Dunn wrote: On Oct 22, 2013, at 5:36 AM, Darren Wheatley wrote: Hi, Thanks for the reply. I tried the code sample you suggested but can't get it to work. When running the default highlighting is being layered on top of this custom highlighting (I can see part of the custom highlighting where the rects are not quite overlapping). Do you know how I prevent the standard formatting from being displayed? Your cell is drawing that part; Override: - (NSColor *)highlightColorWithFrame:(NSRect)cellFrame inView:(NSView *)controlView; and return nil as an easy work around. Also, (might be a symptom of the above) the custom highlighting is not always removed when I click on a new row. If I scroll those rows off the screen and back on the highlighting is fixed, so there is some sort of display refresh problem. If you are drawing outside of the “normal” highlight area, then you are responsible for invalidating it when selection changes. corbin I have tried standard and source list highlighting (set in the xib), and both display the same behaviour. Do you know what might be going on here, or anything I should check in my code? Any suggestions you could make would be very much appreciated. FYI, I am developing on 10.8.5 and targeting 10.7. Regards Darren. On 21 Oct 2013, at 17:23, wrote: On 21 Oct 2013, at 16:19, Darren Wheatley wrote: Hi, I have a custom subclass of NSTableView in my app. Can anyone suggest a method that will allow me to set a custom highlight colour on on a row when the user clicks on it? I've Googled for a solution, but haven't been able to find anything that works. For cell based tables try: - (void)highlightSelectionInClipRect:(NSRect)clipRect There is a sample implementation at http://stackoverflow.com/questions/7038709/change-highlighting-color-in-nstableview-in-cocoa. You may need to set selectionHighlightStyle to NSTableViewSelectionHighlightStyleSourceList Note: This method should not be subclassed or overridden for a view-base table view. Instead, row drawing customization should be done by subclassing NSTableRowView. Jonathan ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/darren%40tenjinconsulting.co.uk This email sent to dar...@tenjinconsulting.co.uk ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/corbind%40apple.com This email sent to corb...@apple.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Autolayout error with NSSplitView When Divider Programmatically Moved
I have a 10.7 app built on 10.9. I'm debugging on 10.9. My main view has a splitView with two panes: a webview in one, and an NSScrollView in the other. When the app starts I programmatically move the divider to the right to hide the right-hand pane and the enclosed NSScrollView. When this happens I get this warning in the console: “"Layout still needs update after calling -[NSScrollView layout]. NSScrollView 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.”" This only happens when the view is first loaded when the app starts. Switching away to a new view, and back, is fine. I think the problem is that the scroll view is still being drawn when I move the splitView divider, causing the scrollview to be dirtied. If I comment out the line that moves the divider I do not see the message. FYI, I did not get the error when building / debugging on 10.8. From Googling around the consensus seems to be that this is a bug in 10.9 and can be ignored, but I don't like to leave my code with warnings so I am keen to find a solution. Does anyone know how I can fix this? I’m assuming I need to move the code that moves the divider to a point AFTER the view has been fully drawn, but I’m stuck for the right way to do it. Thanks Darren. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Autolayout error with NSSplitView When Divider Programmatically Moved
Hi, After your reply I went back to the code and picked through everything again step by step. Looking into it I found I still had the base SDK set to 10.8 on one of the projects in the workspace. I fixed that, and manually wiped the Derived Data folder, and now it works fine. No code changes. Thanks for taking the time to look into this for me. Regards Darren. On 10/11/2013 02:54, Kyle Sluder wrote: On Nov 9, 2013, at 4:04 PM, Darren Wheatley wrote: I have a 10.7 app built on 10.9. I'm debugging on 10.9. My main view has a splitView with two panes: a webview in one, and an NSScrollView in the other. When the app starts I programmatically move the divider to the right to hide the right-hand pane and the enclosed NSScrollView. When this happens I get this warning in the console: “"Layout still needs update after calling -[NSScrollView layout]. NSScrollView 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.”" This only happens when the view is first loaded when the app starts. Switching away to a new view, and back, is fine. I think the problem is that the scroll view is still being drawn when I move the splitView divider, causing the scrollview to be dirtied. In Cocoa, “still being drawn” is synonymous with “inside -drawRect: or a method that is called by it,” so the only way that drawing could be at fault here is if you are somehow triggering your split view adjustment from some view’s -drawRect:, which has always been an error. Are you sure the scroll view that is complaining is the one you created, and not the one embedded in the WebView? --Kyle Sluder -- Darren Wheatley Director Tenjin Consulting Limited (06148745) PO Box 3230, Swindon, Wiltshire, SN5 5US Email: dar...@tenjinconsulting.co.uk Tel: +44 7796 124 328 Fax: +44 7092 000 711 Registered Address: 43-45 Devizes Road, Swindon, Wiltshire, SN1 4BG ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com