Re: operatingSystemVersionString replacement
Maybe I am too used to tackle cross-platform Objective-C. Whenever I am doing system detection now I do the following: uname() and dlsym(RTLD_DEFAULT, “UIApplicationMain”). This will reliably tell OS X (Darwin/NULL), iOS (Darwin/valid pointer), Linux+GNUstep (Linux/NULL) and Android+GNUstep(Linux/valid pointer) apart without making use of that variable that is not so reliable with GNUstep. Mapping kernel version back to OS version on iOS and OS X are trivial, as the rules of thumb: OS X 10.0 is NeXTSTEP 4, iOS 2.0 is Tiger. On Oct 25, 2013, at 14:46, Greg Parker wrote: > On Oct 24, 2013, at 10:36 PM, Maxthon Chan wrote: >> Well I prefer uname() as it is 1) POSIX standard, cross-platform method > > If you're already working around an OS bug then it should be acceptable to > use OS-specific means to do so. > > >> 2) more fine grained as it tells minor versions apart. (e.g. I can tell >> Mavericks DP4 apart from Mavericks DP7 from Mavericks GM from App Store >> release of Mavericks from Mavericks 10.9.1) > > If you look at the documentation of NSFoundationVersionNumber and > NSAppKitVersionNumber you'll see that they change in almost every release. > uname() gives you a kernel version number, which similarly changes in almost > every release but is not guaranteed to do so. > > > -- > Greg Parker gpar...@apple.com Runtime Wrangler > > signature.asc Description: Message signed with OpenPGP using GPGMail ___ 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: NSTextField, maximum string length, bindings and NSFormatter
Keary On 25 Oct 2013, at 00:21, Keary Suska wrote: > On Oct 24, 2013, at 9:01 AM, jonat...@mugginsoft.com wrote: > >> Have I missed something or is access to a decent NSFormatter subclass to >> handle NSTextField string length limiting troublesome? >> >> I am currently using the following. Comments, suggested improvements etc >> welcome. > > I recall that this can be tricky. Below is a method that I dug up from an old > NSFormatter subclass that handles both min/max lengths, non-stored delimiters > and filtering to acceptable characters, which I recall is also paste-proof. I > can send the whole class files if you care. > Your class method is obviously more fully featured than mine. Would you mind making the whole class available somehow? The more decent examples of how to do this the better. As you say this can be tricky to get right and yet it is rather fundamental. I still wonder why AppKit doesn't supply a concrete text formatting subclass. 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/archive%40mail-archive.com This email sent to arch...@mail-archive.com
[SOLVED] Re: Spotlight importer don't work anymore under Mavericks (sandbox error)
Hi, for the records (and future searchers): As per https://developer.apple.com/library/mac/qa/qa1773/_index.html (I should have read this one before) the importer have to be signed with the same identity and entitled for com.apple.security.app-sandbox. To check if the importer works you *must* move it in the /Applications folder (ie: executing the main app in the debugger is not enough). The main issue is that under Mavericks embedded spotlight importers not signed don’t work anymore (correctly, in a way). Il giorno 24/ott/2013, alle ore 23:12, Giacomo Tufano ha scritto: > Hi, I have a spotlight importer for a sandboxed coredata application, derived > directly from the Xcode 4.x template and working embedded in the app. > The importer works under OS X 10.7 and 10.8 but fails in allocating the > NSManagedModel from the storeURL located in the sandbox at > containerdir/Data/Library/CoreData/LocalConfig/.support/model.mom > > In console I see a related sandbox error at the same time of my error: > > 24/10/13 19:31:49,364 sandboxd[351]: ([2437]) mdworker(2437) deny > file-read-xattr > /Users/gt/Library/Containers/it.iltofa.Janus/Data/Library/CoreData/LocalConfig/.support/model.mom > (import fstype:hfs fsflag:480D000 flags:24005F diag:0 isXCode:0 > uti:it.iltofa.janus plugin:/Janus Notes.app/Contents/Library/Spotlight/Janus > NotesImporter.mdimporter - find suspect file using: sudo mdutil -t 22334033) > > The store is allocated in the “main” app with: > >NSURL *cacheDirectory = [[NSFileManager defaultManager] > URLForDirectory:NSLibraryDirectory inDomain:NSUserDomainMask > appropriateForURL:nil create:YES error:&localError]; >cacheDirectory = [cacheDirectory > URLByAppendingPathComponent:@"CoreData/LocalConfig/" isDirectory:YES]; >if(![[NSFileManager defaultManager] createDirectoryAtURL:cacheDirectory > withIntermediateDirectories:YES attributes:nil error:&localError]) { >ALog(@"Error creating %@: %@", cacheDirectory, [localError > description]); >assert(NO); >} >NSString *externalRecordsSupportFolder = [cacheDirectory path]; >NSDictionary *options = @{NSMigratePersistentStoresAutomaticallyOption: > @YES, > NSInferMappingModelAutomaticallyOption: @YES, > NSExternalRecordExtensionOption: @"janus", > NSExternalRecordsDirectoryOption: > externalRecordsSupportFolder, > NSExternalRecordsFileFormatOption: > NSXMLExternalRecordType > }; >_localStore = [_psc addPersistentStoreWithType:NSSQLiteStoreType > configuration:@“LocalConfig” URL:storeURL options:options error:&localError]; > > The failing call on the importer is: > _managedObjectModel = [[NSManagedObjectModel alloc] > initWithContentsOfURL:self.modelURL]; > > where self.modelURL is inited as: >NSDictionary *pathInfo = [NSPersistentStoreCoordinator > elementsDerivedFromExternalRecordURL:[NSURL fileURLWithPath:filePath]]; > >self.modelURL = [NSURL fileURLWithPath:[pathInfo > valueForKey:NSModelPathKey]]; > > IIRC this is the template code. > > I suspected a signing error, but the importer built with XCode 4 was not > signed at all, and it is signed on Xcode 5 with the same identity as the main > app. > The importer embedded in the app freshly downloaded from the App Store works > as intended under ML with no error at all and fails under Mavericks with the > error above. > > I was not able to find anything on the Internet and I’m out of ideas… It > seems strange to me that this is a bug because I think this is a very common > case (at least, I think that a core data app with a spotlight importer is not > *so* strange) > > any hint/suggestion will be appreciated… more code is available on request, > in case it will be useful. ___ 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
NSPopupButton and content values binding transformer
Value transformers applied to NSPopupButton have some idiosyncrasies. http://stackoverflow.com/questions/12505764/nspopupbutton-bindings-with-value-transformer I have applied a transformer to an NSPopupButton content values binding but the IB configured transformer does not seem to be applied. I am not alone in this: http://macscripter.net/viewtopic.php?id=39496 If I log the binding the transformer is present. However, if I enter an invalid transformer name the app does not raise (which it should). If I then log the binding with the invalid name then it does raise. Popup button bindings: { NSObservedKeyPath = "arrangedObjects.name"; NSObservedObject = "[object class: Data_PeriodType, number of selected objects: 1]"; NSOptions = { NSContentPlacementTag = 0; NSInsertsNullPlaceholder = 0; NSMultipleValuesPlaceholder = ""; NSNoSelectionPlaceholder = ""; NSNotApplicablePlaceholder = ""; NSNullPlaceholder = "No Value"; NSRaisesForNotApplicableKeys = 1; NSValueTransformer = ""; NSValueTransformerName = PeriodTypeTransformer; }; } 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/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: operatingSystemVersionString replacement
Not to say using the OS version number is right in your case, but when I need a parseable OS version number without relying upon Gestalt, I get the ProductVersion key from /System/Library/CoreServices/SystemVersion.plist and parse that into an NSIndexPath, which works great with encapsulating 10.8.5, 10.9, 10.7.5.12, etc. If there's a need for knowing the build version and doing a similar comparison (not to say this applies for you), you could parse the number, letter, and number from the key ProductBuildVersion into corresponding values and store those in another NSIndexPath. -- Gary L. Wade http://www.garywade.com/ On 10/24/2013 8:49 PM, "Gerriet M. Denkmann" wrote: >The documentation tells me that NSProcessInfo >operatingSystemVersionString "is human readable, localized, and is >appropriate for displaying to the user. This string is not appropriate >for parsing." > >Ok. So what do I use for parsing? > >like: if ( current_os_x_version < 10.9 ) then do something... > >Once there was Gestalt, but this is deprecated since 10.8. > >Gerriet. ___ 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: operatingSystemVersionString replacement
On Fri, 25 Oct 2013 06:02:23 -0700, Gary L. Wade said: >Not to say using the OS version number is right in your case, but when I >need a parseable OS version number without relying upon Gestalt, I get the >ProductVersion key from /System/Library/CoreServices/SystemVersion.plist >and parse that into an NSIndexPath, which works great with encapsulating >10.8.5, 10.9, 10.7.5.12, etc. I agree with others that NSAppKitVersionNumber and friends are usually preferable, but sometimes it is useful/required to get the actual numbers "10", "8", and "5" in a parseable/non-localized way. Parsing uname results is fragile. operatingSystemVersionString is localized. Assuming /System/Library/CoreServices/SystemVersion.plist will always be at that path is fragile. Can you even read it when sandboxed? Gestalt(), despite being deprecated, is the safest way: Gestalt (gestaltSystemVersionMajor, &major); Gestalt (gestaltSystemVersionMinor, &minor); Gestalt (gestaltSystemVersionBugFix, &fix); IMHO, it was deprecated prematurely, without a replacement for uses like this. Cheers, -- Sean McBride, B. Eng s...@rogue-research.com Rogue Researchwww.rogue-research.com Mac Software Developer Montréal, Québec, Canada ___ 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 wrt Cassowary
There have been numerous posts on the internet saying that Apple used Cassowary as the basis of Autolayout. If so, then why isn't there any mention of this in the Autolayout document. Or was this a white room re-write? Cassowary is open source and as far as I can tell requires no attribution, so its quite possible Apple did leverage it. David ___ 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: operatingSystemVersionString replacement
For any Apple people who care, there's now rdar://15320964 to help with this conundrum. For anyone else, feel free to file your bugs. -- Gary L. Wade http://www.garywade.com/ On 10/25/2013 8:53 AM, "Sean McBride" wrote: >On Fri, 25 Oct 2013 06:02:23 -0700, Gary L. Wade said: > >>Not to say using the OS version number is right in your case, but when I >>need a parseable OS version number without relying upon Gestalt, I get >>the >>ProductVersion key from /System/Library/CoreServices/SystemVersion.plist >>and parse that into an NSIndexPath, which works great with encapsulating >>10.8.5, 10.9, 10.7.5.12, etc. > >I agree with others that NSAppKitVersionNumber and friends are usually >preferable, but sometimes it is useful/required to get the actual numbers >"10", "8", and "5" in a parseable/non-localized way. Parsing uname >results is fragile. operatingSystemVersionString is localized. Assuming >/System/Library/CoreServices/SystemVersion.plist will always be at that >path is fragile. Can you even read it when sandboxed? > >Gestalt(), despite being deprecated, is the safest way: > > Gestalt (gestaltSystemVersionMajor, &major); > Gestalt (gestaltSystemVersionMinor, &minor); > Gestalt (gestaltSystemVersionBugFix, &fix); > >IMHO, it was deprecated prematurely, without a replacement for uses like >this. > >Cheers, > >-- > >Sean McBride, B. Eng s...@rogue-research.com >Rogue Researchwww.rogue-research.com >Mac Software Developer Montréal, Québec, Canada > > ___ 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 wrt Cassowary
I believe there are other fora for shooting the breeze. — F NOTE: BELOW IS NOT A TECHNICAL POST PER SE - WILL BE LAST ONE FROM ME I hope this doesn't waste anyone else's time. This is absolutely technical in the sense that if so, it provides another resource to better understand the techology we use. I look over and see Brad Cox's original book on ObjectiveC in my bookcase. That he as the originator was stated in the Apple docs at least a long time ago (probably not now). Reading that book did enhance my understanding of ObjectiveC - YMMV. I like many others here spend 100% of my time working on Apple technology. Often, we all end up being proxies for Apple - at my company everyone comes to me with complaints or praise of iOS7, why did Apple do such and such, etc etc. So I'm hyping autolayout to some other engineers, when whack, they tell me "Apple didn't invent that - they took it from Cassowary" (google autolayout Cassowary). I sort of felt blindsided, YMMV. It sure looks likely that either it came from there or heavily affected Apple's design. I entered a bug report on Autolayout documentation, rdar://15298919, asking that a reference to Cassowary be added if applicable. After all, in the Concurrency Guide, you will find this: "The term thread is used to refer to a separate path of execution for code. The underlying implementation for threads in OS X is based on the POSIX threads API." No one NEEDS to know that, right, to use NSThreads? If anyone from Apple cares to take this up they can, I won't waste any more electrons. It seems petty to me to not give credit where credit is due. PS: Note that the original Cassowary paper (http://www.cs.washington.edu/research/constraints/cassowary/cassowary-tr.pdf) lists some 20 sources that affected its design. ___ 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
NSTableview row-based, not redrawing on 10.9
Dear list, I have a view-based tableview. In the row views there are some textfields which are a subclass of NSTextField. Since moving to 10.9, the textfields which are in rows which are out of view when the table loads are rendered all black when those rows are scrolled into view. This is new behaviour. Is this supposed to happen? In other words, did I miss some changes in the release notes which indicate I should do things differently now? Clicking in the offending textfields causes them to then draw properly. The reason I have subclassed NSTextField is because I draw them in different colours depending on the colour of the row background they are embedded in. My drawRect: is below, in case there is something fishy in there that might be causing this. Any one else seen this behaviour? Thanks, Martin - (void)drawRect:(NSRect)dirtyRect { NSView *superview = [self superview]; [self setTextColor:[NSColor blackColor]]; if ([superview respondsToSelector:@selector(startingColor)]) { NSColor *c = [superview performSelector:@selector(startingColor)]; [self setTextColor:[c contrastingLabelColor]]; [self setDrawsBackground:NO]; NSBezierPath *path = [NSBezierPath bezierPathWithRoundedRect:NSInsetRect([self bounds], 0.5, 0.5) xRadius:5.0 yRadius:5.0]; [[c shadowWithLevel:0.1] set]; [path stroke]; if (mouseOver) { [[c highlightWithLevel:0.2] set]; [path fill]; } if ([[self currentEditor] respondsToSelector:@selector(setInsertionPointColor:)]) { [[self currentEditor] performSelector:@selector(setInsertionPointColor:) withObject:[c contrastingLabelColor]]; } } [super drawRect:dirtyRect]; } ___ 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 wrt Cassowary
David, I’m a new cocoa dev. You inspired me to watch WWDC 2011, Session 103 - Cocoa Autolayout. The final minute of this video drops a shout-out and big "Thank You" to the two folks at the Computer Science department at Washington for their work on Cassowary. To others out there: are there other supplementary videos from other WWDCs that I should watch post-2011? I’ve read that Autolayout has much-improved in the last two years. Where are these changes best addressed? Best, Caylan On Oct 25, 2013, at 12:19 PM, David Hoerl wrote: > There have been numerous posts on the internet saying that Apple used > Cassowary as the basis of Autolayout. If so, then why isn't there any mention > of this in the Autolayout document. > > Or was this a white room re-write? > > Cassowary is open source and as far as I can tell requires no attribution, so > its quite possible Apple did leverage it. > > David > ___ > > 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/i%40caylan.net > > This email sent to i...@caylan.net ___ 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
core data merge errors on 10.9
Dear list, I have two different core data apps, both of which are exhibiting similar behaviour in that they sometimes (for some changes in some properties) can’t save the MOC. Here is an example error I get when using [moc save:error] Error Domain=NSCocoaErrorDomain Code=133020 "Could not merge changes." UserInfo=0x7feb8e2edf90 {conflictList=( "NSMergeConflict (0x7feb8e2d68b0) for NSManagedObject (0x7feb8e07d610) with objectID '0x54000ab ' with oldVersion = 22 and newVersion = 23 and old object snapshot = {\ncolor = <62706c69 73743030 d4010203 04050615 16582476 65727369 6f6e5824 6f626a65 63747359 24617263 68697665 72542474 6f701200 0186a0a3 07080f55 246e756c 6cd3090a 0b0c0d0e 554e5352 47425c4e 53436f6c 6f725370 61636556 24636c61 73734f10 28302e37 30353838 32333730 3520302e 31313736 34373035 39332030 2e303339 32313536 38373636 00100180 02d21011 12135a24 636c6173 736e616d 65582463 6c617373 6573574e 53436f6c 6f72a212 14584e53 4f626a65 63745f10 0f4e534b 65796564 41726368 69766572 d1171854 726f6f74 80010811 1a232d32 373b4148 4e5b628d 8f9196a1 aab2b5be d0d3d800 00010100 1900 da>;\nname = Discussion;\n} and new cached row = {\ncolor = <62706c69 73743030 d4010203 04050615 16582476 65727369 6f6e5824 6f626a65 63747359 24617263 68697665 72542474 6f701200 0186a0a3 07080f55 246e756c 6cd3090a 0b0c0d0e 554e5352 47425c4e 53436f6c 6f725370 61636556 24636c61 73734f10 28302e37 30353838 32333730 3520302e 31313736 34373035 39332030 2e303339 32313536 38373636 00100180 02d21011 12135a24 636c6173 736e616d 65582463 6c617373 6573574e 53436f6c 6f72a212 14584e53 4f626a65 63745f10 0f4e534b 65796564 41726368 69766572 d1171854 726f6f74 80010811 1a232d32 373b4148 4e5b628d 8f9196a1 aab2b5be d0d3d800 00010100 1900 da>;\nname = Discussion;\n}" )} Both apps are fairly bog-standard core data shoe box apps which have been working fine since 10.6. These problems just started to appear on 10.9. Any ideas what I can try or what might have changed to cause these problems? Many thanks, Martin ___ 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: NSTableview row-based, not redrawing on 10.9
I believe you need to implement a new delegate method for this table: +(BOOL) isCompatibleWithResponsiveScrolling { return NO; } https://developer.apple.com/library/prerelease/mac/releasenotes/AppKit/RN-AppKit/index.html#//apple_ref/doc/uid/TP3741-CH2-SW28 Michael On Oct 25, 2013, at 12:41 PM, Martin Hewitson wrote: > Dear list, > > I have a view-based tableview. In the row views there are some textfields > which are a subclass of NSTextField. Since moving to 10.9, the textfields > which are in rows which are out of view when the table loads are rendered all > black when those rows are scrolled into view. This is new behaviour. Is this > supposed to happen? In other words, did I miss some changes in the release > notes which indicate I should do things differently now? Clicking in the > offending textfields causes them to then draw properly. The reason I have > subclassed NSTextField is because I draw them in different colours depending > on the colour of the row background they are embedded in. My drawRect: is > below, in case there is something fishy in there that might be causing this. > > Any one else seen this behaviour? > > Thanks, > > Martin > > > - (void)drawRect:(NSRect)dirtyRect > { > NSView *superview = [self superview]; > [self setTextColor:[NSColor blackColor]]; > if ([superview respondsToSelector:@selector(startingColor)]) { > NSColor *c = [superview > performSelector:@selector(startingColor)]; > [self setTextColor:[c contrastingLabelColor]]; > [self setDrawsBackground:NO]; > NSBezierPath *path = [NSBezierPath > bezierPathWithRoundedRect:NSInsetRect([self bounds], 0.5, 0.5) xRadius:5.0 > yRadius:5.0]; > [[c shadowWithLevel:0.1] set]; > [path stroke]; > if (mouseOver) { > [[c highlightWithLevel:0.2] set]; > [path fill]; > } > if ([[self currentEditor] > respondsToSelector:@selector(setInsertionPointColor:)]) { > [[self currentEditor] > performSelector:@selector(setInsertionPointColor:) withObject:[c > contrastingLabelColor]]; > } > } > [super drawRect:dirtyRect]; > } > ___ > > 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/mcinkosky%40thirdstreetsoftware.com > > This email sent to mcinko...@thirdstreetsoftware.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
Re: Not documented: NSArray responds to -allObjects
On 2013 Oct 24, at 09:18, Andy Lee wrote: > Might be worth filing a Radar requesting that method be made official > published API like it is for the other collection classes… Well, I did a document feedback, but not on NSArray. Instead I suggested adding text like the following to the Discussion of -respondsToSelector: in the "NSObject Protocol Reference": "Also, be careful not to infer from the result of this message that the receiver is or is not of a certain class. Your code, included libraries, or undocumented methods in Cocoa may implement the subject slector in unexpected classes. For example, in recent versions of Mac OS X, Cocoa silently implements -allObjects in NSArray.” ___ 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: NSTableview row-based, not redrawing on 10.9
Implementing this doesn’t seem to make any difference. I checked that it is called. In any case, the release notes say that responsive scrolling is not active if you link against 10.7, which I do. Martin On 25 Oct 2013, at 08:47 pm, Michael Cinkosky wrote: > I believe you need to implement a new delegate method for this table: > > +(BOOL) isCompatibleWithResponsiveScrolling { > return NO; > } > > https://developer.apple.com/library/prerelease/mac/releasenotes/AppKit/RN-AppKit/index.html#//apple_ref/doc/uid/TP3741-CH2-SW28 > > Michael > > > > > On Oct 25, 2013, at 12:41 PM, Martin Hewitson > wrote: > >> Dear list, >> >> I have a view-based tableview. In the row views there are some textfields >> which are a subclass of NSTextField. Since moving to 10.9, the textfields >> which are in rows which are out of view when the table loads are rendered >> all black when those rows are scrolled into view. This is new behaviour. Is >> this supposed to happen? In other words, did I miss some changes in the >> release notes which indicate I should do things differently now? Clicking in >> the offending textfields causes them to then draw properly. The reason I >> have subclassed NSTextField is because I draw them in different colours >> depending on the colour of the row background they are embedded in. My >> drawRect: is below, in case there is something fishy in there that might be >> causing this. >> >> Any one else seen this behaviour? >> >> Thanks, >> >> Martin >> >> >> - (void)drawRect:(NSRect)dirtyRect >> { >> NSView *superview = [self superview]; >> [self setTextColor:[NSColor blackColor]]; >> if ([superview respondsToSelector:@selector(startingColor)]) { >> NSColor *c = [superview >> performSelector:@selector(startingColor)]; >> [self setTextColor:[c contrastingLabelColor]]; >> [self setDrawsBackground:NO]; >> NSBezierPath *path = [NSBezierPath >> bezierPathWithRoundedRect:NSInsetRect([self bounds], 0.5, 0.5) xRadius:5.0 >> yRadius:5.0]; >> [[c shadowWithLevel:0.1] set]; >> [path stroke]; >> if (mouseOver) { >> [[c highlightWithLevel:0.2] set]; >> [path fill]; >> } >> if ([[self currentEditor] >> respondsToSelector:@selector(setInsertionPointColor:)]) { >> [[self currentEditor] >> performSelector:@selector(setInsertionPointColor:) withObject:[c >> contrastingLabelColor]]; >> } >> } >> [super drawRect:dirtyRect]; >> } >> ___ >> >> 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/mcinkosky%40thirdstreetsoftware.com >> >> This email sent to mcinko...@thirdstreetsoftware.com > Martin Hewitson Albert-Einstein-Institut Max-Planck-Institut fuer Gravitationsphysik und Universitaet Hannover Callinstr. 38, 30167 Hannover, Germany Tel: +49-511-762-17121, Fax: +49-511-762-5861 E-Mail: martin.hewit...@aei.mpg.de WWW: http://www.aei.mpg.de/~hewitson ___ 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
MKLaunchOptionsMapTypeKey in OS X Mavericks
In OS X Mavericks, has anyone used MKLaunchOptionsMapTypeKey to open a map in Hybrid mode, for example: NSDictionary *options = @{MKLaunchOptionsMapTypeKey: [NSNumber numberWithUnsignedInteger:MKMapTypeHybrid]}; followed by openInMapsWithLaunchOptions: ? The map opens in Hybrid mode, however in order to set it into Standard mode (in the Maps application), you need to select Hybrid mode (or Satellite mode), and then set it to Standard mode. Also, the view menu shows no selection when you initially go into the Maps application. Is this a bug or is there something else that needs to be done in order to make this work correctly? Thanks, Jim Merkel ___ 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 wrt Cassowary
WWDC 2012 offered three good sessions on auto layout. The first one, Introduction to Auto Layout for iOS and OS X also has a link to the Cassowary article. WWDC 2013 session 406 has an update to Auto Layout in Xcode 5 which is much improved. You should watch this. Although Apple quite naturally does not mention this as a fact, Auto Layout is obviously the key to any updated hardware with new screen sizes. So the best way to spend the time post iOS 7 adaption to WWDC 2014 is to anticipate the new and make your apps as hardware independent as possible. Regards, Bertil > I’m a new cocoa dev. You inspired me to watch WWDC 2011, Session 103 - Cocoa > Autolayout. The final minute of this video drops a shout-out and big "Thank > You" to the two folks at the Computer Science department at Washington for > their work on Cassowary. > > To others out there: are there other supplementary videos from other WWDCs > that I should watch post-2011? I’ve read that Autolayout has much-improved > in the last two years. Where are these changes best addressed? ___ 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
OBJC_PRINT_REPLACED_METHODS logs a lot of noise?
On 2013 Oct 24, at 10:35, Sean McBride wrote: > You could also set OBJC_PRINT_REPLACED_METHODS=YES in the environment. > That's how I originally discovered my firstObject NSArray category method > wasin conflict. I tried it. When I launch my app with that I get 100 log entries, but they all seem to indicate that Apple is replacing Cocoa implementations from a dynamic library in /usr/lib with implementations from /System/Library/Frameworks. I’ve pasted in the first 6 below. I then tried it on a new empty Cocoa app target and there were fewer, only 28. Is there anything to worry about here? I’ve read a few blog posts and threads, and surprisingly no one mentioned this as an expected result. objc[45391]: REPLACED: -[NSObject description] by category NSObject (IMP was 0x7fff8b7da294 (/usr/lib/libobjc.A.dylib), now 0x7fff9040bb30 (/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation)) objc[45391]: REPLACED: -[NSObject methodSignatureForSelector:] by category NSObject (IMP was 0x7fff8b7da203 (/usr/lib/libobjc.A.dylib), now 0x7fff903d8af0 (/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation)) objc[45391]: REPLACED: -[NSObject doesNotRecognizeSelector:] by category NSObject (IMP was 0x7fff8b7da02a (/usr/lib/libobjc.A.dylib), now 0x7fff904a6220 (/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation)) objc[45391]: REPLACED: +[NSObject init] by category NSObject(IMP was 0x7fff8b7da4b8 (/usr/lib/libobjc.A.dylib), now 0x7fff904a65a0 (/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation)) objc[45391]: REPLACED: +[NSObject dealloc] by category NSObject (IMP was 0x7fff8b7da4c0 (/usr/lib/libobjc.A.dylib), now 0x7fff904a6650 (/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation)) objc[45391]: REPLACED: +[NSObject description] by category NSObject (IMP was 0x7fff8b7da291 (/usr/lib/libobjc.A.dylib), now 0x7fff903fe330 (/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation)) ___ 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
Allowing users to customize keyboard shortcuts
I’m working on a complex app with lots of commands. I’m considering eventually allowing users to customize the keyboard shortcuts they use. I don’t want to build all that UI now, but I thought it might make sense to build in the underpinnings now. What techniques do people use to implement this capability? I’ll have both menu shortcuts, which I presume are modified by getting at the NSMenu instances and changing them, and shortcuts for other operations that don’t appear in the menus (some of my main views and controllers will handle keystrokes). For those I can build my own mapping system, but I was curious what others had done, or if there’s some nice framework out there already. Googling didn’t turn up much. -- Rick signature.asc Description: Message signed with OpenPGP using GPGMail ___ 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: Allowing users to customize keyboard shortcuts
> On Oct 25, 2013, at 18:37, "Rick Mann" wrote: > > I’m working on a complex app with lots of commands. I’m considering > eventually allowing users to customize the keyboard shortcuts they use. I > don’t want to build all that UI now, but I thought it might make sense to > build in the underpinnings now. > > What techniques do people use to implement this capability? I’ll have both > menu shortcuts, which I presume are modified by getting at the NSMenu > instances and changing them, and shortcuts for other operations that don’t > appear in the menus (some of my main views and controllers will handle > keystrokes). For those I can build my own mapping system, but I was curious > what others had done, or if there’s some nice framework out there already. > Googling didn’t turn up much. The app at my last job was pretty complex and had a couple different modes, so two commands could share the same key equiv and never conflict. I basically kept a list of OSType commands, which mode the command was good for (e.g. object mode or text mode), and the key equiv. The equivs got installed at app init time, every time the mode switched, and after editing the equivs. It's actually a pretty simple mechanism to do. Steve via iPad ___ 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: operatingSystemVersionString replacement
On Oct 25, 2013, at 10:53 AM, Sean McBride wrote: > I agree with others that NSAppKitVersionNumber and friends are usually > preferable, but sometimes it is useful/required to get the actual numbers > "10", "8", and "5" in a parseable/non-localized way. Parsing uname results > is fragile. operatingSystemVersionString is localized. Assuming > /System/Library/CoreServices/SystemVersion.plist will always be at that path > is fragile. Can you even read it when sandboxed? > > Gestalt(), despite being deprecated, is the safest way: > > Gestalt (gestaltSystemVersionMajor, &major); > Gestalt (gestaltSystemVersionMinor, &minor); > Gestalt (gestaltSystemVersionBugFix, &fix); > > IMHO, it was deprecated prematurely, without a replacement for uses like this. Here's a little Gestalt replacement I wrote for myself a while back: https://gist.github.com/ccgus/6384865 It uses SystemVersion.plist, but I'm pretty that's not going to be moved around anytime soon. -gus ___ 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