Understanding accessibility
I’ve create a custom view controller, and am trying to make it accessible, bot not really getting much luck. The view hierarchy is fairly involved, with multiple levels of stack views and buttons and/or custom views nested within those. From my reading of Apple’s docs on supporting accessibility I’d say that views containing other views do not need to be marked as accessible, as long as the ‘end point’ views are accessible.But maybe I’m misunderstanding Maybe an example will be clearest: Let’s say I have a stack view that’s nested in a stack view. The nested stack view has a row that contains a UIButton. I want the button to be accessible. E.g. with VoiceOver on I want to be able to tap the button to activate it and get audible feedback about it. What are the steps I need to take to achieve this? Thanks, António ___ 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: PDFKit on 10.12
On 04 Oct 2016, at 14:26, Jonathan Mitchell wrote: > > PDFKit seems a bit disturbed on Sierra. > The 10.12 beta 3 seems to improve things but there are still some rendering > stutters etc. 1. Why are you referring to a beta, when 10.12 has been out for weeks now? > Has PDFKit been reworked - there doesn’t seem to be any mention of it in the > release notes? > If so it might be a question of waiting for the internal gremlins to be > hunted down rather than me wasting too much time on this. Whatever is going on with PDFKit, it’s not good. At least, it wasn’t for 10.11 and 10.12. PDFKit developed some serious flaws in 10.11, and despite my bug reporting these issues did not get fixed. It’s even so bad that in a 10.12 beta I reported how one of those bugs was affecting the Preview app, and in the next beta issue was fixed in Preview, but not in PDFKit. Which leads me to believe that Preview may no longer be using PDFKit, or at least not its public API in places. And no acknowledgement from Apple whatsoever about any of the PDFKit related bug reports. The issues concerning rendering in PDFKit since 10.11 cripple such a significant part of my software’s functionality, without the possibility of a workaround, that I had to decide to EOL my software, now that it is clear that they won’t be fixed in 10.12. At the moment I cannot recommend the use of PDFKit for third party developers. -António ___ 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
Responsive scrolling: prepareContentInRect: not called
Hi, Wondering if anyone has an idea of why prepareContentInRect: is not called for a view when responsive scrolling is enabled. We are using an NSScrollView subclass that overrides prepareContentInRect:. When I turn on View Debugging->Show Responsive Scrolling Status during a debug session, the scrollview area is tinted green indicating that everything is (or should be) in place for responsive scrolling. When the app is run and loads and displays a window, I can see, in the debugger, the document view’s drawRect: method being called repeatedly with dirty rects that suggest the overdraw regions are steadily being built. However, prepareContentInRect: is never called. To the best of my knowledge it should be. At least that is how I understand fit from the docs and from WWDC’14 Session 215 on responsive scrolling. An online search for issues with prepareContentInRect: did not turn up any results, suggesting that this may not be a common issue, and therefore that I may be missing some required implementation detail. Does anyone know what might be causing prepareContentInRect: not to be called when responsive scrolling does appear to be active? Anything obvious I should look for? (I have tried overriding prepareContentInRect: in the NSScrollView’s subclass, as well as in the view that serves as the scroll view’s document view. Neither of these methods gets called though.) -António Energy is like a muscle, it grows stronger through being used. ___ 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: Responsive scrolling: prepareContentInRect: not called
On 08 Oct 2014, at 01:41, Ken Thomases wrote: >> Wondering if anyone has an idea of why prepareContentInRect: is not called >> for a view when responsive scrolling is enabled. >> >> We are using an NSScrollView subclass that overrides prepareContentInRect:. > > I would not expect -prepareContentInRect: to be called on the scroll view. > It would be called on the document view (and its subviews?). The purpose is > to allow the document view to prepare itself for the requests to draw the > overdraw region. The scroll view itself is not drawn in the overdraw region. > Likewise, I would not expect the scroll view's -drawRect: to be called for > overdrawing. Thanks for your suggestions Ken, Indeed we do not ‘drawRect:’ anything in the scroll view. :-) >> (I have tried overriding prepareContentInRect: in the NSScrollView’s >> subclass, as well as in the view that serves as the scroll view’s document >> view. Neither of these methods gets called though.) > > I would double-check that, in the occasions when you overrode > -prepareContentInRect: in the document view, you didn't also accidentally > disable responsive scrolling. Also, make sure your override calls through to > super and doesn't unintentionally stop AppKit from further extending the > overdraw region by passing the same rect in successive calls. Turns out the problem is a different, and of course, almost embarrassingly silly one. I misspelled the method name: prepareContentInrect rather than prepareContentInRect. Now that I’ve caught that and corrected it, the method is called. Thanks for you effort anyway. -António ___ 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
rangeOfString with .RegularExpressionSearch not matching begin and end of line (Swift)
Hi, I a trying to find a line within a string. When I write: let match = crashReport.rangeOfString("\nIdentifier:.*\n", options: .RegularExpressionSearch) …I get a match. However, when I write let match = crashReport.rangeOfString(“^Identifier:.*$", options: .RegularExpressionSearch) …which would seem more to the point, no match is returned. Shouldn’t this work, if the above works? Am I overlooking something obvious? -António ___ 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
Translate curl command to NSURLRequest
I have the following curl command to a web api, which retrieves some info: curl -X GET -H 'Authorization: Basic blabla' -H 'Content-Type: application/xml; charset=utf-8' -H 'Accept-Language: en' -d "y...@example.comSomePassWord" 'https://example.com/api/v1/endpoint The -d and xml-string are mandatory for this GET command. I haven’t been able to translate this into an equivalent NSURLRequest that gets accepted by the server. I tried this: NSURLCredential *credential = [[WRTSServerEngine sharedServerEngine] savedCredentialsForHost:@“example.com" port:0 protocol:@"https" realm:@“SomeRealm"]; NSMutableURLRequest *request = [[NSMutableURLRequest alloc] initWithURL:[NSURL URLWithString:@"https://example.com/api/v1/endpoint";]]; NSString *authStr = [NSString stringWithFormat:@"%@:%@", credential.user, credential.password]; NSData *authData = [authStr dataUsingEncoding:NSUTF8StringEncoding]; NSString *authValue = [NSString stringWithFormat: @"Basic %@",[authData base64EncodedStringWithOptions:0]]; [request setValue:authValue forHTTPHeaderField:@"Authorization"]; NSString *infoAsXMLString = @""; infoAsXMLString = [infoAsXMLString stringByAppendingString:@""]; infoAsXMLString = [infoAsXMLString stringByAppendingFormat:@"%@", credential.user]; infoAsXMLString = [infoAsXMLString stringByAppendingFormat:@"%@", credential.password]; infoAsXMLString = [infoAsXMLString stringByAppendingString:@""]; infoAsXMLString = [infoAsXMLString stringByAppendingString:@""]; [request setHTTPBody:[infoAsXMLString dataUsingEncoding:NSUTF8StringEncoding]]; NSURLSessionConfiguration *sessionConfig = [NSURLSessionConfiguration defaultSessionConfiguration]; sessionConfig.allowsCellularAccess = YES; [sessionConfig setHTTPAdditionalHeaders:@{@"Accept": @"application/xml"}]; NSURLSession *session = [NSURLSession sessionWithConfiguration:sessionConfig]; self.task = [session dataTaskWithRequest:request completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) { NSLog(@"%@", error); }]; [self.task resume]; This results in the following error: Error Domain=NSURLErrorDomain Code=-1005 "The network connection was lost." UserInfo=0x7ffd0b5f7a00 {NSUnderlyingError=0x7ffd0b58be50 "The operation couldn’t be completed. (kCFErrorDomainCFNetwork error -1005.)", NSErrorFailingURLStringKey=https://staging.wrts.nl/api/v1/existing_user, NSErrorFailingURLKey=https://staging.wrts.nl/api/v1/existing_user, _kCFStreamErrorDomainKey=4, _kCFStreamErrorCodeKey=-4, NSLocalizedDescription=The network connection was lost.} If I do not set an HHTPBody on the request, I get a 500 error (which makes sense, since the server is expecting a payload in the body). Is there a way to see exactly what the request looks like when it goes out? Is there a way to create the request such that it is equivalent to the curl command at the top of this post? Thanks, António ___ 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: Translate curl command to NSURLRequest
Thanks for the pointer to macnetworkprog Jerry, and for the link to Charles. I should probably have mentioned in my post that this is an iOS app, not a Mac app. Would that matter for macnetworkprog, or is the list appropriate for iOS too? António > On 04 Jul 2015, at 13:59, Jerry Krinock wrote: > > >> On 2015 Jul 04, at 02:52, Antonio Nunes wrote: >> >> Is there a way to see exactly what the request looks like when it goes out? > > Search for “OS X Packet Sniffer” and you will find many apps for this, and > even some stuff built into OS X, which are quite fun to use. My favorite > (because it can also decode https secure traffic) has been Charles: > > http://www.charlesproxy.com > > Also, a better list to discuss such issues is: Mac Network Programming: > macnetworkp...@lists.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/devlists%40sintraworks.com > > This email sent to devli...@sintraworks.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: Translate curl command to NSURLRequest
Ugh, I’ve corrected the headers. But it doesn’t make a difference regarding the result. -António > On 04 Jul 2015, at 19:04, Rick Mann wrote: > > FWIW, you're setting the Accept header, not Content-Type (nor > Accept-Language). > >> On Jul 4, 2015, at 02:52 , Antonio Nunes wrote: >> >> I have the following curl command to a web api, which retrieves some info: >> curl -X GET -H 'Authorization: Basic blabla' -H 'Content-Type: >> application/xml; charset=utf-8' -H 'Accept-Language: en' -d >> "y...@example.comSomePassWord" >> 'https://example.com/api/v1/endpoint >> >> The -d and xml-string are mandatory for this GET command. I haven’t been >> able to translate this into an equivalent NSURLRequest that gets accepted by >> the server. >> >> I tried this: >> NSURLCredential *credential = [[WRTSServerEngine sharedServerEngine] >> savedCredentialsForHost:@“example.com" >> >> port:0 >> >> protocol:@"https" >> >>realm:@“SomeRealm"]; >> >> NSMutableURLRequest *request = [[NSMutableURLRequest alloc] >> initWithURL:[NSURL URLWithString:@"https://example.com/api/v1/endpoint";]]; >> >> NSString *authStr = [NSString stringWithFormat:@"%@:%@", credential.user, >> credential.password]; >> NSData *authData = [authStr dataUsingEncoding:NSUTF8StringEncoding]; >> NSString *authValue = [NSString stringWithFormat: @"Basic %@",[authData >> base64EncodedStringWithOptions:0]]; >> [request setValue:authValue forHTTPHeaderField:@"Authorization"]; >> >> NSString *infoAsXMLString = @""; >> infoAsXMLString = [infoAsXMLString >> stringByAppendingString:@""]; >> infoAsXMLString = [infoAsXMLString >> stringByAppendingFormat:@"%@", credential.user]; >> infoAsXMLString = [infoAsXMLString >> stringByAppendingFormat:@"%@", credential.password]; >> infoAsXMLString = [infoAsXMLString >> stringByAppendingString:@""]; >> infoAsXMLString = [infoAsXMLString stringByAppendingString:@""]; >> [request setHTTPBody:[infoAsXMLString >> dataUsingEncoding:NSUTF8StringEncoding]]; >> >> NSURLSessionConfiguration *sessionConfig = [NSURLSessionConfiguration >> defaultSessionConfiguration]; >> sessionConfig.allowsCellularAccess = YES; >> [sessionConfig setHTTPAdditionalHeaders:@{@"Accept": @"application/xml"}]; >> NSURLSession *session = [NSURLSession >> sessionWithConfiguration:sessionConfig]; >> self.task = [session dataTaskWithRequest:request >> completionHandler:^(NSData *data, NSURLResponse >> *response, NSError *error) { >> NSLog(@"%@", error); >> }]; >> [self.task resume]; >> >> This results in the following error: >> Error Domain=NSURLErrorDomain Code=-1005 "The network connection was lost." >> UserInfo=0x7ffd0b5f7a00 {NSUnderlyingError=0x7ffd0b58be50 "The operation >> couldn’t be completed. (kCFErrorDomainCFNetwork error -1005.)", >> NSErrorFailingURLStringKey=https://staging.wrts.nl/api/v1/existing_user, >> NSErrorFailingURLKey=https://staging.wrts.nl/api/v1/existing_user, >> _kCFStreamErrorDomainKey=4, _kCFStreamErrorCodeKey=-4, >> NSLocalizedDescription=The network connection was lost.} >> >> If I do not set an HHTPBody on the request, I get a 500 error (which makes >> sense, since the server is expecting a payload in the body). >> >> Is there a way to see exactly what the request looks like when it goes out? >> Is there a way to create the request such that it is equivalent to the curl >> command at the top of this post? >> >> Thanks, >> António >> ___ >> >> 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/rmann%40latencyzero.com >> >> This email sent to rm...@latencyzero.com > > > -- > Rick Mann > rm...@latencyzero.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: Translate curl command to NSURLRequest
> On 05 Jul 2015, at 00:45, Michael David Crawford wrote: > > Would it work to use libcurl instead? > > I dont know but would be unsurprised were that to be what NSURLRequest > actually does. Probably, but this is on iOS, so I would have to package a libcurl build into the app, adding a few MBs to the app. I’’d rather not if I can avoid it. -António They deem me mad because I will not sell my days for gold; And I deem them mad because they think my days have a price. --Kahlil Gibran --- ___ 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: Translate curl command to NSURLRequest
On 04 Jul 2015, at 22:03, Jens Alfke wrote: > > (Sending a GET request with a body is pretty unusual, but I assume that’s > what the server wants since you say the curl command works…) Yes, I’m not happy about this, and I think this is also what is causing the issue, since it looks like the body is not being sent along with the GET request. (Although I would expect the server to send a 500 error then, rather than dropping the connection, as it does when not sending the body through the curl command.) -António ___ 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
Swift: 'If' statement needing parentheses on closure return value property access?
In Swift 2.0 I can write this: repeat { … } while reminder.exclusions.filter { $0.spansTime(t) }.count > 0 but I can’t write this: if reminder.exclusions.filter { $0.spansTime(t) }.count > 0 { … } which gives an error about consecutive statements on a line needing a “;” If have to write this: if (reminder.exclusions.filter { $0.spansTime(t) }.count > 0) { … } Any ideas why? -António ___ 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: Swift: 'If' statement needing parentheses on closure return value property access?
> On 19 Aug 2015, at 07:42, Quincey Morris > wrote: > > Clearly it’s a “more ambiguous” context than the while case, which prevents > the compiler from realizing that there is an alternative analysis that works. > In that case, it’s the error message that’s at fault, since it doesn’t really > tell you what’s wrong. In fact, this “consecutive statements” error almost > never gives any help, but I guess the compiler is reluctant just to admit it > has no clue. > > On Aug 18, 2015, at 23:04 , Antonio Nunes wrote: > >>if (reminder.exclusions.filter { $0.spansTime(t) }.count > 0) >> { > > It might be clearer to write: > >> if reminder.exclusions.filter ({ $0.spansTime(t) }).count > 0 { > Thanks Quincy that’s what I went with. Now to write up a bug report explaining the issue and hoping for at least a better error message… :-) Cheers, -António ___ 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 determine if a PDFPage is image based? (A scanned page)
On 13 Sep 2009, at 13:01, DairyKnight wrote: Is there a way to determine if a PDFPage contains only a picture? There seems to be plenty of routines for rendering/drawing in Core Graphics, but none for extracting PDF information? You need to parse and analyse the page streams. Look up the documentation on CGPDFScanner (which is used for extracting PDF information), and of course the PDF reference. - António --- Touch is a language without words --- ___ 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
[iPhone] Authentication failing on device after changing registration data
In the app I'm developing I connect to a server, to request some data. This works fine. An authentication challenge is received and processed, and the connection performs beautifully. If however I then change the username/password, and attempt to connect again, the authentication is refused by the server, but only when running on the device (iPhone/iPod Touch); when running in the simulator changing to another account works just fine. This problem persists between subsequent runs of the app. The only way to be able to change to a new account on the device, is to delete the app completely from the device, and then install it anew. In the simulator however, I can change accounts and successfully connect to the sever as often as I want, including within the same app session. I verified the password and username are always correct when authenticating. This is how I handle the challenge: = - (void)connection:(NSURLConnection *)connection didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge { NSString *username = [[NSUserDefaults standardUserDefaults] objectForKey:userEmailAddressKey]; NSString *password = [[NSUserDefaults standardUserDefaults] objectForKey:uUserPasswordKey]; NSInteger failureCount = challenge.previousFailureCount; if (failureCount == 0 && username && password) { self.credential = [NSURLCredential credentialWithUser:username password:password persistence:NSURLCredentialPersistenceForSession]; [[NSURLCredentialStorage sharedCredentialStorage] setDefaultCredential:self.credential forProtectionSpace:[(MyAppDelegate *)[[UIApplication sharedApplication] delegate] myProtectionSpace]]; [[challenge sender] useCredential:self.credentialforAuthenticationChallenge:challenge]; } else { [[challenge sender] continueWithoutCredentialForAuthenticationChallenge:challenge]; } } = The protection space is created when the app starts: = self.myProtectionSpace = [[[ NSURLProtectionSpacealloc] initWithHost:@"www.some.url" port:80 protocol:@"http" realm:nil authenticationMethod:NSURLAuthenticationMethodDefault] autorelease]; = The connection is created thus: = -(void)fetchURL { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; NSMutableURLRequest *theRequest = [NSMutableURLRequest requestWithURL:[NSURLURLWithString:self.urlString]]; switch (method) { case GET: [theRequest setHTTPMethod:@"GET"]; break; case POST: [theRequest setHTTPMethod:@"POST"]; [theRequest setValue:[NSString stringWithFormat:@"%d", [self .postDatalength]] forHTTPHeaderField:@"Content-Length"]; [theRequest setValue:@"application/xml" forHTTPHeaderField:@"Content-Type"]; [theRequest setHTTPBody:self.postData]; break; } [[NSURLConnection alloc] initWithRequest:theRequest delegate:self]; [[NSRunLoop currentRunLoop ] runUntilDate:[NSDate dateWithTimeIntervalSinceNow:60]]; [pool release]; } = Any ideas as to why I can't change accounts on the device, not even after exiting and restarting the app? Since the code works in the simulator, and I can't myself find anything wrong with it, it looks like a bug in the iPhone OS, which I should file with Apple. Is anyone familiar with an issue like this, and/or does anyone have a workaround so that we can change accounts without having to delete and re-install the app? -António --- And could you keep your heart in wonder at the daily miracles of your life, your pain would not seem less wondrous than your joy. --Kahlil Gibran --- There is a world of difference between searching for happiness and choosing to be happy. ___ 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 ar
Re: [iPhone] Authentication failing on device after changing registration data
On 12 Nov 2009, at 08:43, Roland King wrote: > are you definitely receiving a challenge the *second* time you run the app? > It is possible that the server sends a cookie representing the login which > the phone has now cached and is sending along with the request > (automatically) which is failing the login. Yes, I receive the challenge. In fact, after initially spotting the problem, I implemented: - (BOOL)connectionShouldUseCredentialStorage:(NSURLConnection *)connection { return NO; } so in fact, I'm now seeing the challenge on each login attempt. > One thing you could try to see if it's that is to find the cookie storage on > startup and clean it out explicitly. That might then make the server do the > challenge again. When I try: NSArray *cookies = [[NSHTTPCookieStorage sharedHTTPCookieStorage] cookiesForURL:[NSURL URLWithString:@"www.some.url"]]; at application startup I receive an empty array, so it doesn't look like any cookies are being stored. ... Hmmm, and now I can change accounts without problems. I'll test some more, but the most likely scenario is I was cooked when I was recently testing this. Thanks for the suggestions Roland. I wasn't aware of NSHTTPCookie and NSHTTPCookieStorage, so at least I picked up some new info. If I run into trouble again with this, I'll follow up on this thread. Cheers, António It is better to light a candle than to curse the darkness ___ 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: Creating a PDFSelection...
On 26 May 2010, at 03:01, Matthew Weinstein wrote: > The PDFSelection class as far as I can tell basically supports what in > Preview.app is the "text" tool on the toolbar. The selection tool in > Preview.app selects an arbitrary rectangle, even if there's no text behind > the image. > > So, is there some way of changing the behavior of the given PDFSelection, or > do I have to "hand code" this (using the Cropped image example code, for > instance)? The selection tool in Preview just creates a snapshot of the selection. A TIFF image. This has nothing to do with PDFSelection. PDFSelections deal only with text, so I think they are not rich enough for your purposes. I guess you may have to delve deeper; parsing the page streams (you can use Quartz for that), and rolling your own selections. Not a quick and easy task. António --- And you would accept the seasons of your heart, even as you have always accepted the seasons that pass over your field. --Kahlil Gibran --- ___ 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
Problem getting correct file URL in NSTask process
Hi, I have a daemon that spawns NSTasks on request. A task is passed a number of paths to process. These paths are pased correctly to the task, and in the task I can correctly extract the path string from optarg. When I try to turn the path into a file url however, the resulting URL is not correct. For instance: I create a string from the argument: NSString *path = [[[NSString alloc] initWithBytes:(UInt8 *)optarg length:strlen(optarg) encoding:NSMacOSRomanStringEncoding] stringByExpandingTildeInPath]; At this point path is "/Volumes/MyDisk/Users/sonata/Desktop/Stash/BPSystemStartup.pdf" When I subsequently call [NSURL fileURLWithPath:path] the result is "%20%22/Volumes/MyDisk/Users/sonata/Desktop/Stash/BPSystemStartup.pdf%22 -- /Volumes/MyDisk/Users/sonata/Documents/Xcode Projects/builds/Debug/" The task launched by NSTask is a command line app that works just fine when run on its own (e.g. from the terminal). The issue only happens when launching the command line app through NSTask. Any pointers to why this happens? António --- Don't believe everything you think --- ___ 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: Problem getting correct file URL in NSTask process
On 27 May 2010, at 11:52, Ken Thomases wrote: >> I have a daemon that spawns NSTasks on request. A task is passed a number of >> paths to process. These paths are pased correctly to the task, and in the >> task I can correctly extract the path string from optarg. > > No, they aren't and no you can't, according to what you write below. Thanks so much for the elaborate and pertinent answer Ken. You are right. I was not passing the arguments correctly to the task. I was creating the arguments like this: [args addObject:[NSString stringWithFormat:@"-f \"%...@\"", [[sourceDirectoryURL path] stringByAppendingPathComponent:sourceFileName]]]; Whereas, I now understand (hopefully correctly), I should have been creating them like this: [args addObject:[NSString stringWithFormat:@"-f%@", [[sourceDirectoryURL path] stringByAppendingPathComponent:sourceFileName]]]; > Why do you think the string is in Mac Roman encoding? It probably isn't. In > fact, I happen to know that NSTask converts all of its arguments to "file > system representation". Even if I didn't know that, that's the only correct > thing to assume. So, you should use the following to construct an NSString > from optarg: > > NSString* path = [[NSFileManager > defaultManager]stringWithFileSystemRepresentation:optarg > length:strlen(optarg)]; It's been a while since I wrote the original code for this, but if memory serves me correctly, I modelled this after some sample code, and since it worked, I did not question it. I have adjusted the path extraction to use the more correct stringWithFileSystemRepresentation: call instead. > You are almost certainly confused about the need to quote and escape things > for the shell. The shell needs to take what it receives as a single command > string and break it up into its component parts. That's what introduces the > need to quote whitespace and escape special characters when working in the > shell. > > By contrast, NSTask is handed its arguments already neatly separated out into > individual elements. Plus, it doesn't have any special characters -- it just > treats all of its arguments literally. Thus, it does not require that its > arguments be quoted or escaped. Indeed, if you try to do so, those > characters are just passed along to the new process. Confused I was indeed (although I did not know it). This is new territory for me, so I'm not surprised I stumble a bit as I plod through it. :-) > So, I guess that you have taken a file path string in the parent process and, > while attempting to pass it through to a subprocess verbatim, you've done > exactly the wrong thing. You've modified it, putting quote marks around it > and, apparently, a space before it. If you had done nothing with the string > but pass it in as one of the task's arguments, _that_ would have gotten it to > the subprocess verbatim. Yes. Now that I pass the option's identifier with its parameter appended snugly to it (without quotes and separating space char) the URL is created correctly. Kind regards, António Disapprove of sin but not of the sinner ___ 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: Problem getting correct file URL in NSTask process
On 27 May 2010, at 13:15, Ken Thomases wrote: > If, in a shell, you were to invoke a command like: > > /path/to/some/command -f /path/to/file > > Then the program would receive "-f" and "/path/to/file" as separate > arguments. To achieve the same thing with NSTask, you'd pass @"-f" and > @"/path/to/file" as two separate elements of the argument array. > > You've now switched to the equivalent of: > > /path/to/some/command -f/path/to/file > > That works in this case, but relies on the program you're invoking parsing > apart the option switch from its value. Apparently, that assumption holds > for the program in question. I just wanted to make sure you understood how > to replicate the original form using NSTask. Thanks, I wondered about that actually, but had not tried sending the arguments separately yet. I'll make these changes, as you have made it clear that that is a more robust way to pass the arguments. Best, António Disapprove of sin but not of the sinner ___ 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
Notification of file system modification arrives too early?
Hi, My app is set to observe a folder for changes to its contents (using UKKQueue. Thanks Uli! :-)). When files are dropped into the folder the app is notified and processes the files. This works well, except for one catch: sometimes we receive the notification and spawn the worker thread, and trying to load the file fails ( [[PDFDocument alloc] initWithURL:sourceURL] returns nil). This seems to happen predominantly with large files. I get the impression the notification happens as soon as the file transfer into the watched directory begins, and my worker thread is ready and starts loading the file before it has been fully transferred. Hence the failure to create a PDFDocument from the file. Is there a way to check whether the file has been fully transferred, or, even better, to get notified only when the file transfer has been completed? António --- What you have inside you expresses itself through both your choice of words and the level of energy you assign to them. The more healed, whole and connected you feel inside, the more healing your words will be. --Rita Goswami --- ___ 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: Notification of file system modification arrives too early?
On 28 May 2010, at 11:30, Uli Kusterer wrote: > The heuristic most people use is to wait a little time (a few seconds is > usually enough) and only start processing a file if a new write notification > hasn't arrived in the meantime. I usually use my UKPushbackMessenger for that > purpose (see > http://github.com/uliwitness/UliKit/blob/master/UKPushbackMessenger.h > andhttp://github.com/uliwitness/UliKit/blob/master/UKPushbackMessenger.m). Gruezi Uli, I was hoping the system would provide something better for this. Looks like an enhancement request is in order. Since PDF documents can potentially be huge, and I need to keep performance as good as possible, I need something more robust than waiting a few seconds. I am now experimenting with trying to read in a PDFDocument from the url, and not spawn the worker thread until this succeeds. Initial results look promising. The thread that sets up the task waits until it can successfully read in a PDFDocument from the URL, then releases the document and launches the task. I find this a bit of a hack, but if it works, it works, and I think this provides tighter performance than waiting for a set number of seconds (which may in extreme cases not to be long enough anyway). Best, António --- Don't believe everything you think --- ___ 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: Notification of file system modification arrives too early?
On 28 May 2010, at 11:41, Antonio Nunes wrote: > I was hoping the system would provide something better for this. Looks like > an enhancement request is in order. Request filed. Bug ID# 8038793: "Need notification of file system modification after completion of the operation". Cheers, António There is nothing as strong as real gentleness, and there is nothing as gentle as real strength. ___ 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: Notification of file system modification arrives too early?
On 28 May 2010, at 12:15, Jean-Daniel Dupas wrote: > I hope you properly defined what you mean by "operation", because on a file > system point of view, this is already what kqueue does. > A copy is not one operation but a bunch of operations (open, lots of write, > close, set attrs, set xattrs, …), and kqueue already notify you each time an > operation is done. Hmm, I see, better have another good look at the notifications the I can choose to listen to. Thanks. Looks like an attribute change notification and a size increase notification might be useful candidates. I'll play with them and see what results I can get. António A merry heart does good like medicine ___ 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: Notification of file system modification arrives too early?
On 28 May 2010, at 12:07, Uli Kusterer wrote: > Are you doing this for Finder-originated copying only? In this case, you > could probably look at the file's OSType/creator. I believe they get set to > some special "busy"-values during copying, so if you get a write notification > and your file has that type, you *know* it's not intended to be processed yet. I expect many of the files will arrive in the watched folder either through user manipulation in the Finder or through scripts/automation. I don't think I can assume only Finder-originated copying. António - Perfume is the forgiveness that the trampled flower casts upon the heel that crushes it. - ___ 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: Notification of file system modification arrives too early?
On 30 May 2010, at 17:51, Jens Alfke wrote: >> When a change occurs, I attempt to open the file using the FS API specifying >> exclusive read + exclusive write access. If it fails, it's likely because >> some other process still has the file open. I delay a half second or so and >> try again. > > That sounds like a good approach, but it’s not 100% reliable. If the creating > process opened the file without requesting an exclusive lock, then your open > call will succeed even though the file is still open. > > Unfortunately you probably can’t do any better than that, since there’s no > cheap way to find out if another process has the file open. Thanks guys, that makes it sound like my previously mentioned solution/work-around of trying to create a PDFDocument from the URL is the safest solution. The attempt will fail until the file has been fully written, and I only need to read the data, not write to it. Also, as far as I can tell, reading a PDFDocument with initWithURL: (and immediately discarding it if it succeeds) is a fairly cheap operation. António - Forgiveness is not an occasional act; it is a permanent attitude. --Martin Luther King, Jr - ___ 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
Knowing when font panel is visible
Hi, I have a control that needs to be highlighted when the font panel is visible. This turns out not to be an easy task. I can't find any notifications that will be triggered whenever the font panel is shown or is hidden. windowDidUpdate: might do for discovering that the window is or has become visible, but it's a bit hawkish to use for this purpose. windowWillClose: only notifies if the panel gets closed, not if it is ordered out. I tried subclassing NSFontPanel by doing the following: - (void)applicationWillFinishLaunching:(NSNotification *)aNotification { [NSFontManager setFontPanelFactory:[MY_FontPanel class]]; } but it doesn't appear to work. The font panel returned by [NSFontPanel sharedFontPanel] continues to be NSFontPanel, not MY_FontPanel. What I want to do is override orderFront: and orderOut: in my subclass so that I can send out some notifications whenever one of these is called. Why does my call to setFontPanelFactory: not work, and how can I best achieve my stated goal? Kind Regards, António Nunes SintraWorks --- Touch is a language without words --- ___ 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: Knowing when font panel is visible
On 4 Sep 2011, at 10:39, Quincey Morris wrote: >> I have a control that needs to be highlighted when the font panel is >> visible. This turns out not to be an easy task. I can't find any >> notifications that will be triggered whenever the font panel is shown or is >> hidden. > > Why can't you use '[[NSFontPanel sharedFontPanel] isVisible]' (possibly > checking first with '[NSFontPanel sharedFontPanelExists]' so that you don't > unnecessarily create it)? > --- Some things have to be believed to be seen. --Ralph Hodgson --- ___ 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: Knowing when font panel is visible
On 4 Sep 2011, at 10:39, Quincey Morris wrote: >> I have a control that needs to be highlighted when the font panel is >> visible. This turns out not to be an easy task. I can't find any >> notifications that will be triggered whenever the font panel is shown or is >> hidden. > > Why can't you use '[[NSFontPanel sharedFontPanel] isVisible]' (possibly > checking first with '[NSFontPanel sharedFontPanelExists]' so that you don't > unnecessarily create it)? Because I need to know when the status changes, rather then simply whether it is visible. -António It is better to light a candle than to curse the darkness ___ 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: Knowing when font panel is visible
On 4 Sep 2011, at 11:05, jonat...@mugginsoft.com wrote: > FWIW On OS X 10.7.1 I couldn't successfully change the font panel class > either. Hm, probably time for a trip to the BugReporter. -António There is a world of difference between searching for happiness and choosing to be happy. ___ 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: Knowing when font panel is visible
On 4 Sep 2011, at 10:39, Quincey Morris wrote: > On Sep 4, 2011, at 00:40 , Antonio Nunes wrote: > >> I have a control that needs to be highlighted when the font panel is >> visible. This turns out not to be an easy task. I can't find any >> notifications that will be triggered whenever the font panel is shown or is >> hidden. > > Why can't you use '[[NSFontPanel sharedFontPanel] isVisible]' (possibly > checking first with '[NSFontPanel sharedFontPanelExists]' so that you don't > unnecessarily create it)? Well, that sent me into a direction that I'm happy with: User KVO to observe changes to the "visible" property of the font panel. 1. When my control gets created it sets itself up as an observer for the NSWindowDidUpdateNotification for only the font panel object: … [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(windowDidUpdate:) name:NSWindowDidUpdateNotification object:[NSFontPanel sharedFontPanel]]; … 2. When the font panel gets shown for the first time the selector is called, and we set ourselves up as an observer for the "visible" property. We also stop observing the NSWindowDidUpdateNotification, since we no longer need it. - (void)startObservingFontPanelVisibility { [[NSFontPanel sharedFontPanel] addObserver:self forKeyPath:@"visible" options:NSKeyValueObservingOptionNew context:nil]; } - (void)windowDidUpdate:(NSNotification *)notification { [self startObservingFontPanelVisibility]; [[NSNotificationCenter defaultCenter] removeObserver:self name:NSWindowDidUpdateNotification object:[NSFontPanel sharedFontPanel]]; } 3. When the visibility of the font panel changes, we now get called and can change the highlight of the control: - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context { [self setSelected:[[NSFontPanel sharedFontPanel] isVisible] forSegment:2]; } The only aspect that I'd like to improve is that the font panel gets created when the first document gets created, even though the user may never actually use it. I'd like to avoid creating the font panel unnecessarily but a satisfactory method to do that hasn't yet occurred to me. I could do something like observe the NSWindowDidUpdateNotification without narrowing it down to the font panel object and then: if ([NSFontPanel sharedFontPanelExists] && notification.object == [NSFontPanel sharedFontPanel]) { [self startObservingFontPanelVisibility]; [[NSNotificationCenter defaultCenter] removeObserver:self name:NSWindowDidUpdateNotification object:[NSFontPanel sharedFontPanel]]; } but that would entail that the method is called constantly when any of the app's windows is updated (until the font panel gets shown for the first time, if at all), which I think is a worse solution that what I did instead. -António - Forgiveness is not an occasional act; it is a permanent attitude. --Martin Luther King, Jr - ___ 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
Exception when entering too big value in text field (with number formatter)
Hi, I have an NSTextField with a number formatter and an NSStepper in a view that is used in an NSPopover. The values of both interface items are bound to an ivar of the view controller via an object controller. Both the text field and the stepper have a max value of 9. When I enter a value superior to that in the text field and tab out, or click another field, an exception is raised. The backtrace is pasted below. (Depending on my next action, or the way I exit the text field in the first place, one or two alert views may show with the 'Value "x" is too large' warning. The first alert has no title bar and can't be dismissed by clicking the discard or ok buttons, the other alert is a proper window that can be dismissed. I see these alerts also when the stepper is unbound, so the issue looks to be only with the text field. I'm not sure what, if anything, I'm doing wrong, and how to get this setup to function properly. I've done this type of binding before, but never in a popover window. Could it be a framework bug? Any ideas about what might be wrong with the setup, and/or how to solve the issue? -António == 2011-10-21 11:49:49.520 AwesomeApp[35994:707] -[NSPopoverFrame titlebarRect]: unrecognized selector sent to instance 0x1050e7a30 2011-10-21 11:49:49.521 AwesomeApp[35994:707] Exception detected while handling key input. 2011-10-21 11:49:49.521 AwesomeApp[35994:707] -[NSPopoverFrame titlebarRect]: unrecognized selector sent to instance 0x1050e7a30 2011-10-21 11:49:49.530 AwesomeApp[35994:707] ( 0 CoreFoundation 0x7fff892c1286 __exceptionPreprocess + 198 1 libobjc.A.dylib 0x7fff8d3ebd5e objc_exception_throw + 43 2 CoreFoundation 0x7fff8934d4ce -[NSObject doesNotRecognizeSelector:] + 190 3 CoreFoundation 0x7fff892ae133 ___forwarding___ + 371 4 CoreFoundation 0x7fff892f813d __forwarding_prep_1___ + 237 5 AppKit 0x7fff90082870 -[NSWindow(NSSheets) startRectForSheet:] + 151 6 AppKit 0x7fff900822d2 -[NSWindow(NSSheets) _positionSheet:constrained:andDisplay:] + 151 7 AppKit 0x7fff900813b2 -[NSMoveHelper(NSSheets) _moveParent:andOpenSheet:] + 774 8 AppKit 0x7fff90082e8f -[NSWindow(NSSheets) _orderFrontRelativeToWindow:] + 192 9 AppKit 0x7fff8fc222f2 -[NSWindow _reallyDoOrderWindow:relativeTo:findKey:forCounter:force:isModal:] + 1679 10 AppKit 0x7fff8fc21b7a -[NSWindow _doOrderWindow:relativeTo:findKey:forCounter:force:isModal:] + 807 11 AppKit 0x7fff8fddc5cb -[NSApplication _orderFrontModalWindow:relativeToWindow:] + 662 12 AppKit 0x7fff8fddc094 -[NSApplication _commonBeginModalSessionForWindow:relativeToWindow:modalDelegate:didEndSelector:contextInfo:] + 831 13 AppKit 0x7fff8fddc92e -[NSApplication beginSheet:modalForWindow:modalDelegate:didEndSelector:contextInfo:] + 134 14 AppKit 0x7fff8fdd008b -[NSAlert beginSheetModalForWindow:modalDelegate:didEndSelector:contextInfo:] + 295 15 AppKit 0x7fff8fddfdb0 -[NSApplication(NSErrorPresentation) presentError:modalForWindow:delegate:didPresentSelector:contextInfo:] + 446 16 AppKit 0x7fff90198893 -[NSValueBinder _presentDiscardEditingSheetWithError:discardEditingCallback:otherCallback:callbackContextInfo:relatedToBinding:] + 314 17 AppKit 0x7fff901991d8 -[NSValueBinder handleValidationError:description:inEditor:errorUserInterfaceHandled:] + 510 18 AppKit 0x7fff901d9180 -[_NSBindingAdaptor _handleValidationError:description:inEditor:errorUserInterfaceHandled:bindingAdaptor:] + 194 19 AppKit 0x7fff901d92a3 -[_NSBindingAdaptor handleValidationError:description:inEditor:errorUserInterfaceHandled:] + 280 20 AppKit 0x7fff8fe50d98 -[NSCell _validateEntryString:uiHandled:] + 455 21 AppKit 0x7fff900f4303 -[NSTextField textShouldEndEditing:] + 80 22 AppKit 0x7fff90155e68 -[NSTextView(NSSharing) resignFirstResponder] + 426 23 AppKit 0x7fff8fc43bf5 -[NSWindow makeFirstResponder:] + 429 24 AppKit 0x7fff901b214d -[NSWindow _makeParentWindowHaveFirstResponder:] + 48 25 AppKit 0x0
Re: Exception when entering too big value in text field (with number formatter)
On 21 Oct 2011, at 17:23, Nick Zitzmann wrote: >> 2011-10-21 11:49:49.520 AwesomeApp[35994:707] -[NSPopoverFrame >> titlebarRect]: unrecognized selector sent to instance 0x1050e7a30 > > …often happens when an object was deallocated, and then some other object was > allocated in its place, and then the original object was addressed after it > was deallocated & something else took its place. Try running your code using > Instruments' zombies template and then reproducing the problem. If it stops > due to a zombie access, and the trace shows the problem happened completely > within the AppKit, then it is a framework bug. Otherwise, your code most > likely over-released something. Thanks Nick, I fired up Zombies and it did not catch anything. I also had a close look at my code and, not only am I not deallocating anything, the whole view controller code doesn't even allocate any objects. Then I had a search on "titlebarRect" and found a cocoa-dev message from August where the author wrote: > I'm playing with popover too and noticed a problem when using formatters. If > there's a validation error, my application crashes when the framework try to > present a sheet displaying the error. > > -[NSPopoverFrame titlebarRect]: unrecognized selector sent to instance > 0x102075780 > > Of course, popovers don't have titlebars… Time to fire up the bug reporter I guess… -António --- And you would accept the seasons of your heart, even as you have always accepted the seasons that pass over your field. --Kahlil Gibran --- ___ 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: Exception when entering too big value in text field (with number formatter)
I looked a bit deeper and the problem seems to be, not so much with having a formatter attached to the field, but more essentially with returning no from the control:isValidObject: delegate method, when the text field's value is bound to an object controller. This causes the system to want to put up an alert and that appears to cause issues if the text field lives in a popover. I created a minimal project exhibiting the issue, and will submit it to the bug reporter. -António On 22 Oct 2011, at 07:27, Antonio Nunes wrote: > On 21 Oct 2011, at 17:23, Nick Zitzmann wrote: > >>> 2011-10-21 11:49:49.520 AwesomeApp[35994:707] -[NSPopoverFrame >>> titlebarRect]: unrecognized selector sent to instance 0x1050e7a30 >> >> …often happens when an object was deallocated, and then some other object >> was allocated in its place, and then the original object was addressed after >> it was deallocated & something else took its place. Try running your code >> using Instruments' zombies template and then reproducing the problem. If it >> stops due to a zombie access, and the trace shows the problem happened >> completely within the AppKit, then it is a framework bug. Otherwise, your >> code most likely over-released something. > > Thanks Nick, > > I fired up Zombies and it did not catch anything. I also had a close look at > my code and, not only am I not deallocating anything, the whole view > controller code doesn't even allocate any objects. > > Then I had a search on "titlebarRect" and found a cocoa-dev message from > August where the author wrote: > >> I'm playing with popover too and noticed a problem when using formatters. If >> there's a validation error, my application crashes when the framework try to >> present a sheet displaying the error. >> >> -[NSPopoverFrame titlebarRect]: unrecognized selector sent to instance >> 0x102075780 >> >> Of course, popovers don't have titlebars… > > Time to fire up the bug reporter I guess… > > -António > > --- > And you would accept the seasons of your > heart, even as you have always accepted > the seasons that pass over your field. > > --Kahlil Gibran > --- > > > > ___ > > 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/devlists%40sintraworks.com > > This email sent to devli...@sintraworks.com --- Don't believe everything you think --- ___ 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
Prevent side subviews of NSSplitView from resizing during window zoom
I use an NSSPlitView with three subviews. The general idea is that when the window is resized, only the middle view resizes. I have this working just fine when dragging the window frame. The split view consults the delegate with splitView:shouldAdjustSizeOfSubview:, and I return YES when the subview is the middle view, and NO when the subview is one of the other views. (It's slightly more complex, due to minimum widths, but that can be ignored here.) When I drag the window frame, the splitView:shouldAdjustSizeOfSubview: is constantly consulted for each view, for the duration of the drag. When zooming the window by clicking the zoom button though, all subviews are resized. The splitView:shouldAdjustSizeOfSubview: method is consulted only twice during the zoom and the split view goes off and does its own thing anyway. How can I make the split view behave correctly during window zoom (and entering/exiting full-screen, which shows the same issue)? -António It is better to light a candle than to curse the darkness ___ 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: Prevent side subviews of NSSplitView from resizing during window zoom
On 26 Oct 2011, at 17:46, Antonio Nunes wrote: > I use an NSSPlitView with three subviews. The general idea is that when the > window is resized, only the middle view resizes. I have this working just > fine when dragging the window frame. The split view consults the delegate > with splitView:shouldAdjustSizeOfSubview:, and I return YES when the subview > is the middle view, and NO when the subview is one of the other views. (It's > slightly more complex, due to minimum widths, but that can be ignored here.) > When I drag the window frame, the splitView:shouldAdjustSizeOfSubview: is > constantly consulted for each view, for the duration of the drag. > > > When zooming the window by clicking the zoom button though, all subviews are > resized. The splitView:shouldAdjustSizeOfSubview: method is consulted only > twice during the zoom and the split view goes off and does its own thing > anyway. > How can I make the split view behave correctly during window zoom (and > entering/exiting full-screen, which shows the same issue)? Figured it out: The split view was correctly honoring splitView:shouldAdjustSizeOfSubview:'s return value, but the logic within the method wasn't always yielding the correct results, due to unexpected behavior elsewhere. I am keeping a tab on how the window is being resized to decide what subviews can be resized. The window's delegate methods are not always called though at the time you'd expect, and not symmetrically. Particularly, I found that windowDidResize: can be called well before the zoom has finished, and that it is called once more often than windowWillResize:toSize:. Once I became aware of that, I was able to solve the issue. -António --- What you have inside you expresses itself through both your choice of words and the level of energy you assign to them. The more healed, whole and connected you feel inside, the more healing your words will be. --Rita Goswami --- ___ 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: Core Audio Help
On 23 Dec 2011, at 18:44, Phil Hystad wrote: > Yes, I know of that "promised" book. It seems to have been in the works for > a long time. I just checked Amazon and it says April 2012. Well, I think I > have seen such a release date before but it was probably a year or two ago. Go to Safari books online. You should be able to get access to the book now through the Rough Cuts option. http://my.safaribooksonline.com/9780321636973 -António Energy is like a muscle, it grows stronger through being used. ___ 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
Semi-Transient NSPopover disappearing when it shouldn't (10.7.3)
I have a few popovers that, as far as I'm aware of, were working fine up to 10.7.2. Now, in 10.7.3, when the popover appears, if a user clicks on it, it often disappears, whether the click is on the background or on a UI item. I haven't figured out the trick exactly of the way in which clicking makes the popover go away, but it appears to be sensitive to how you click. A popover should never go away though when it is clicked upon. I think this is a bug in 10.7.3. Various internet searches for this issue did not return any results, nor did searching Apple's developer forums. Any ideas what might be causing this, or how to work around the issue? Has anyone else even encountered this issue? -António - Accepting others as they are brings a wonderful freedom to your own mind. --The Peace Formula - ___ 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
Semi-Transient NSPopover disappearing when it shouldn't (10.7.3)
I have a few popovers that, as far as I'm aware of, were working fine up to 10.7.2. Now, in 10.7.3, when the popover appears, if a user clicks on it, it often disappears, whether the click is on the background or on a UI item. I haven't figured out the trick exactly of the way in which clicking makes the popover go away, but it appears to be sensitive to how you click. A popover should never go away though when it is clicked upon. I think this is a bug in 10.7.3. Various internet searches for this issue did not return any results, nor did searching Apple's developer forums. Any ideas what might be causing this, or how to work around the issue? Has anyone else even encountered this issue? -António - Accepting others as they are brings a wonderful freedom to your own mind. --The Peace Formula - ___ 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: Semi-Transient NSPopover disappearing when it shouldn't (10.7.3)
On 23 Feb 2012, at 21:52, Seth Willits wrote: >> I have a few popovers that, as far as I'm aware of, were working fine up to >> 10.7.2. Now, in 10.7.3, when the popover appears, if a user clicks on it, it >> often disappears, whether the click is on the background or on a UI item. > > Can you replicate this in a test project? I couldn't replicate it in Apple's sample "Popover" project, but since it had a somewhat different implementation than what I had devised, I changed my strategy to one more similar with that of the sample, and, for now, it looks like it fixed the issue. I had my popovers in separate nibs, which each had a popover and the file's owner was the popover view controller (not the one the IB automatically creates when you drag in a popover, since I needed the file's owner to be the popover controller, so I had deleted the one IB creates). Now I changed strategy to have one popover in the view controller that controls and displays the popovers, and the nibs have only the popover view controller and the the view. Now the popover is created on the fly in the parent view controller, instead of residing in the nib. This appears to work better in 10.7.3. -António There is nothing as strong as real gentleness, and there is nothing as gentle as real strength. ___ 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: Semi-Transient NSPopover disappearing when it shouldn't (10.7.3)
On 24 Feb 2012, at 16:55, Corbin Dunn wrote: >> I have a few popovers that, as far as I'm aware of, were working fine up to >> 10.7.2. Now, in 10.7.3, when the popover appears, if a user clicks on it, it >> often disappears, whether the click is on the background or on a UI item. I >> haven't figured out the trick exactly of the way in which clicking makes the >> popover go away, but it appears to be sensitive to how you click. A popover >> should never go away though when it is clicked upon. I think this is a bug >> in 10.7.3. Various internet searches for this issue did not return any >> results, nor did searching Apple's developer forums. >> >> Any ideas what might be causing this, or how to work around the issue? Has >> anyone else even encountered this issue? > > I don't believe we changed NSPopover in 10.7.3, but it is possible that > something else is affecting this. > > It sounds like something outside of the popover is becoming the first > responder, and that causes the popover to go away. It was a bit as if there was a prolonged period where the underlying window (or an element of it) was first responder. If we waited long enough before clicking anywhere on the popover, or if we pressed tab to activate another text field in the popover then clicking would function normally. As I wrote in answer to Seth Willis, I was able to fix the issue (the email still hasn't shown up on the list, so I'll repeat it here): > On 23 Feb 2012, at 21:52, Seth Willits wrote: > >>> I have a few popovers that, as far as I'm aware of, were working fine up to >>> 10.7.2. Now, in 10.7.3, when the popover appears, if a user clicks on it, >>> it often disappears, whether the click is on the background or on a UI item. >> >> Can you replicate this in a test project? > > I couldn't replicate it in Apple's sample "Popover" project, but since it had > a somewhat different implementation than what I had devised, I changed my > strategy to one more similar with that of the sample, and, for now, it looks > like it fixed the issue. > > I had my popovers in separate nibs, which each had a popover and the file's > owner was the popover view controller (not the one the IB automatically > creates when you drag in a popover, since I needed the file's owner to be the > popover controller, so I had deleted the one IB creates). > > Now I changed strategy to have one popover in the view controller that > controls and displays the popovers, and the nibs have only the popover view > controller and the the view. Now the popover is created on the fly in the > parent view controller, instead of residing in the nib. This appears to work > better in 10.7.3. -António I try to take one day at a time, but sometimes, several days attack me all at once! ___ 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: PDFDocument and CGPDFDocument
On 11 May 2011, at 03:59, Graham Cox wrote: > Are CGPDFDocument and PDFDocument toll-free bridged? If not, how can I get a > PDFDocument from a CGPDFDocumentRef? They are not toll-free bridged. > I need to use the lower level API to extract graphic entities from a PDF, but > I'd like to use PDFKit up-front to implement a page chooser. How about opening the document with PDFKit to start with, and then ask the obtained PDFDocument for its documentRef when you need to get submerged. I don't think you can go the other way. The 'documentRef' is in the PDFDocument header file. - (CGPDFDocumentRef) documentRef; I did not find it in the docs. Apple's doc team alerted. Best, António --- Touch is a language without words --- ___ 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: How to use PDFAnnotationStamp?
On 23 May 2011, at 19:26, Laurent Daudelin wrote: > I've been trying to use class "PDFAnnotationStamp" but it seems it's missing > something. Its superclass "PDFAnnotation" has a method called > "hasAppearanceStream" but there doesn't seem to be any way to set the > appearance stream, in "PDFAnnotation" or "PDFAnnotationStamp". Subclass PDFAnnotationStamp and in the subclass draw whatever you need to draw in: - (void) drawWithBox: (PDFDisplayBox) box That will cause it to have an appearance stream. -António - Perfume is the forgiveness that the trampled flower casts upon the heel that crushes it. - ___ 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
Animated Split View
Hi, I want a generic animated split view. So I had a rummage online, and couldn't find anyone who had prepared the wheel for me. Consequently I set out to create my own. I soon found that overriding setPosition:ofDividerAtIndex: and make it work correctly for split views with more than two views was not as simple as I expected it to be. Then I had a Bright Idea™ in realising that Apple have already done all the heavy lifting for me, and that I could use that to my advantage: I created a category on NSSplitView which adds exactly two methods: @interface NSSplitView (NSSplitView_Animation) - (CGFloat)catPositionOfDividerAtIndex:(NSInteger)index; - (void)catAnimateDividerAtIndex:(NSInteger)index toPosition:(CGFloat)newPosition; @end @implementation NSSplitView (NSSplitView_Animation) - (CGFloat)catPositionOfDividerAtIndex:(NSInteger)index { NSRect frame = [[self.subviews objectAtIndex:index] frame]; return self.isVertical ? NSMaxX(frame) : NSMaxY(frame); } - (void)catAnimateDividerAtIndex:(NSInteger)index toPosition:(CGFloat)newPosition { CGFloat currentPosition = [self catPositionOfDividerAtIndex:index]; NSUInteger numberOfSubviews = self.subviews.count; NSRect newRect[numberOfSubviews]; [self setPosition:newPosition ofDividerAtIndex:index]; for (NSUInteger i = 0; i < numberOfSubviews; i++) { newRect[i] = [[self.subviews objectAtIndex:i] frame]; } [self setPosition:currentPosition ofDividerAtIndex:index]; [NSAnimationContext beginGrouping]; { [[NSAnimationContext currentContext] setDuration:0.2]; for (NSUInteger i = 0; i < numberOfSubviews; i++) { [[[self.subviews objectAtIndex:i] animator] setFrame:newRect[i]]; } } [NSAnimationContext endGrouping]; } @end So, what am I doing: 1. Get the current divider position. 2. Set the new divider position. 3. Get the frames of all the splitview's subviews, which are now adjusted to their new values. 4. Reset the divider position to the original, to restore the original frame values of the subviews. 5. Animate the frames of all subviews to their new values. Why I am doing all this: I initially thought I would only need to change the values of the frames for the two views on either side of the affected divider. But it turns out that, when doing that, other views also magically resize. I don't know why. It is possible I made a mistake somewhere, but, having taken a thorough look at my own code, I don't think so. That's when the idea occurred to leverage what Apple have already provided, rather then possibly spending hours wrestling to get it right, maybe only to find later that there are subtleties that I had overlooked. As far as I know, changing the divider position initially without animation, and changing it back without animation, to obtain correct new values for all subview frames before performing the actual animation, should have no side effects, and be fairly efficient, making this a cheap and code-economic technique. I'm posting this for two reasons: 1. I want to ask if anyone thinks the technique used above has caveats or if anyone thinks the technique is inefficient and can think of a more efficient or better way to implement animation for NSSplitView. 2. It appears to work quite nicely for splitviews in either orientation, with any number of subviews, including sub-splitviews. If there is no solid reason to avoid this technique, it may be useful to others who are trying to do similar things with NSSplitView. Any comments appreciated. Oh, one last thing: anyone in favour of subclassing, rather than being categorical? Cheers, António --- And could you keep your heart in wonder at the daily miracles of your life, your pain would not seem less wondrous than your joy. --Kahlil Gibran --- ___ 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: Animating NSSplitPane position
On 16 Jun 2011, at 03:48, Graham Cox wrote: > I'm using -setPosition:ofDividerAtIndex: and I call this using the view's > animator: > > [[mySplitPane animator] setPosition:position ofDividerAtIndex:0]; > > But it doesn't animate and just jumps into position. I see other apps manage > this (e.g. Mail) so how's it done? Hi Graham, Having recently experienced the same limitation, I found we need to manually resize the subviews (through their animator). I posted a message here, on June 1st, titled "Animated Split View", in which I exposed a solution and asked for feedback on it (got none). Meanwhile I have improved the code, since I found the first iteration not to be robust enough. The new version follows: == @interface NSSplitView (NSSplitView_Animation) - (CGFloat)catPositionOfDividerAtIndex:(NSInteger)index; - (void)catAnimateDividerIndexes:(NSArray *)indexes toPositions:(NSArray *)newPositions; - (void)catAnimateDividerAtIndex:(NSInteger)index toPosition:(CGFloat)newPosition; @end @protocol NMD_AnimatingSplitViewDelegate @required @property (readwrite, assign) BOOL splitViewIsAnimating; @end == == @implementation NSSplitView (NSSplitView_Animation) - (CGFloat)catPositionOfDividerAtIndex:(NSInteger)index { NSRect frame = [[self.subviews objectAtIndex:index] frame]; return self.isVertical ? NSMaxX(frame) : NSMaxY(frame); } - (void)catAnimateDividerIndexes:(NSArray *)indexes toPositions:(NSArray *)newPositions { NSUInteger numberOfSubviews = self.subviews.count; NSAssert(indexes.count == newPositions.count, @"indexes and newPositions arrays must have same object count."); NSAssert(indexes.count < numberOfSubviews, @"Trying to move too many dividers"); NSRect newRect[numberOfSubviews]; for (NSUInteger i = 0; i < numberOfSubviews; i++) { newRect[i] = [[self.subviews objectAtIndex:i] frame]; } for (NSNumber *indexObject in indexes) { NSInteger index = [indexObject integerValue]; CGFloat newPosition = [[newPositions objectAtIndex:[indexes indexOfObject:indexObject]] doubleValue]; if (self.isVertical) { CGFloat oldMaxXOfRightHandView = NSMaxX(newRect[index + 1]); newRect[index].size.width = newPosition - NSMinX(newRect[index]); CGFloat dividerAdjustment = (newPosition < NSWidth(self.bounds)) ? self.dividerThickness : 0.0; newRect[index + 1].origin.x = newPosition + dividerAdjustment; newRect[index + 1].size.width = oldMaxXOfRightHandView - newPosition - dividerAdjustment; } else { CGFloat oldMaxYOfBottomView = NSMaxY(newRect[index + 1]); newRect[index].size.height = newPosition - NSMinY(newRect[index]); CGFloat dividerAdjustment = (newPosition < NSHeight(self.bounds)) ? self.dividerThickness : 0.0; newRect[index + 1].origin.y = newPosition + dividerAdjustment; newRect[index + 1].size.height = oldMaxYOfBottomView - newPosition - dividerAdjustment; } } if ([self.delegate respondsToSelector:@selector(splitViewIsAnimating)]) { ((id)self.delegate).splitViewIsAnimating = YES; } [CATransaction begin]; { [CATransaction setAnimationDuration:0.25]; [CATransaction setAnimationTimingFunction:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]]; [CATransaction setCompletionBlock:^{ if ([self.delegate respondsToSelector:@selector(splitViewIsAnimating)]) { ((id)self.delegate).splitViewIsAnimating = NO; } }]; for (NSUInteger i = 0; i < numberOfSubviews; i++) { [[[self.subviews objectAtIndex:i] animator] setFrame:newRect[i]]; } } [CATransaction commit]; } - (void)catAnimateDividerAtIndex:(NSInteger)index toPosition:(CGFloat)newPosition { NSUInteger numberOfSubviews = self.subviews.count; NSAssert(index < numberOfSubviews - 1, @"index should be less than number of subviews - 1"); [self catAnimateDividerIndexes:[NSArray arrayWithObject:[NSNumber numberWithInteger:index]] toPositions:[NSArray arrayWithObject:[NSNumber numberWithDouble:newPosition]]]; } @end == As you'll have noticed, I prefix all my category methods with "cat", in an attempt to be (OS X) future proof. Since the resize behaviour of the subviews for the project I'm working on is tightly controlled, I need to know if the splitview is animat
Re: pdfkit - changing background color
On 4 Feb 2010, at 18:50, Duke Normandin wrote: > is there a way to allow for the customization of the background color > while viewing a pdf document using pdfkit? Yes. Read the documentation on PDFView's "drawPage:" method. It makes it very clear what to do: subclass PDFView and override the method. António --- Touch is a language without words --- ___ 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: What's the point of @properties?
On 20 Sep 2010, at 11:47, Chris Hanson wrote: > GDB doesn’t support dot syntax for invoking property getters, so you just > need to use bracket syntax when doing it: Maybe Stefan meant rather that the ivars do not show up in the debugger window. It's a real pain to have to go to the console every time you want to know the value of an ivar, when stepping through your code. I was highly surprised by this behaviour when I first ran into it, and it is the single most important reason why I continue to declare ivars in the @interface block in projects where I otherwise would not have to. António --- Don't believe everything you think --- ___ 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: What's the point of @properties?
On 20 Sep 2010, at 19:27, Seth Willits wrote: > And Chris explained that properties don't necessarily *have* ivars for you to > look at anyway. If you want to see its value, then you need to run the > print/po command on the gdb command line. Fair enough. And what I would like to see, is the debugger window in code being smart enough to show the synthesised properties. Any chance of that ever happening? Cheers, António --- Some things have to be believed to be seen. --Ralph Hodgson --- ___ 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: What's the point of @properties?
On 20 Sep 2010, at 20:00, Kyle Sluder wrote: > Did you mean "synthesized ivars"? It is important you be precise. Yes that is what I meant. > Automatically showing synthesized properties—or any properties at > all—would be a bad idea, because methods have side effects, and even > calling simple accessors at the wrong time can be detrimental to your > program (remember, the debugger can be stopped anywhere; what if it's > in the middle of updating the method cache in objc_msgSend, and then > you go up a few frames into your own code?). > > Automatically showing synthesized ivars is a much safer operation, and > one I too would like to see in the debugger. Yes, that is what I'd like to see to. Hmmm, I guess this should really move over to xcode-users if we continue the thread. António - Forgiveness is not an occasional act; it is a permanent attitude. --Martin Luther King, Jr - ___ 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
System resources and number of operations on an NSOperationQueue
I'm developing a daemon to run tasks as files get dropped into a folder. When a new file is detected, a new operation gets put onto the daemon's operation queue. The operation launches a task and waits for it to finish, then the operation exits. The issue I am seeing is that the operation queue appears to indiscriminately run operations as they are added to the queue, regardless of system resources, thus bringing the whole system to a crawl. I thought, from reading the documentation, that the queue would be intelligent about how many operations it would have running at the same time, depending on system resources such as number of cores and available memory. Since this doesn't seem to be the case, I have to assume something is not quite right with my implementation. My question: how can I ensure that no more operations are launched at any one time than the system can handle? Also, is there a way to find out the number of cores on a machine so that I can set that as a hard limit of number of operations on an NSOperationQueue? The code is meant for 10.6.0 or higher and runs with garbage collection on. Here is an outline of how my code implements the daemon and the operations: All the daemon itself does, really, is to fire up a single directory watcher, which is where all the action takes place. It then waits until it is signaled for termination, at which point it tears down the directory watcher and exits. The crucial part of main() in the daemon: -- directoryWatcher = [[ANDirectoryWatcher alloc] initWithOptionsBlaBlaBla...]; [directoryWatcher start]; while (1) { [[NSRunLoop currentRunLoop] runUntilDate:[NSDate distantFuture]]; } // Should never get here [directoryWatcher stop]; -- The directory watcher owns a single operation queue, to which it adds operations as new files arrive in the folder it watches: -- -(void) handleNewFileFoundNotification:(NSNotification *)notification { NSString *sourcePath = [[notification userInfo] objectForKey:@"path"]; NSFileManager *localFileManager=[[NSFileManager alloc] init]; NSDirectoryEnumerator *dirEnum = [localFileManager enumeratorAtPath:sourcePath]; NSString *file; while (file = [dirEnum nextObject]) { if ([[file pathExtension] isEqualToString: @"ext"]) { NSString *filePath = [sourcePath stringByAppendingPathComponent:file]; // Process the document only if the path is new. Otherwise the document is already being processed. if ( ! [self previouslyKnownPath:filePath] ) { ANTaskLauncherOperation *operation = [[ANTaskLauncherOperation alloc] initWithSourceFileURL:[NSURL fileURLWithPath:filePath] ...other options...]; [self.operationInfo setValue:operation forKey:filePath]; [self.operationQueue addOperation:(NSOperation *)operation]; } } } } -- The task launcher operation contains only three methods: - An init method that is passed the required info and sets up essential instance variables based on the arguments. - The following two methods: -- - (void)completeOperation { [self willChangeValueForKey:@"isFinished"]; [self willChangeValueForKey:@"isExecuting"]; self.executing = NO; self.finished = YES; [self didChangeValueForKey:@"isExecuting"]; [self didChangeValueForKey:@"isFinished"]; } -(void)main { fprintf(stdout, "%s Received file: \"%s\"\n", ANTaskLauncherCurrentTimeString(), self.sourceFileURL.path.lastPathComponent.UTF8String); fflush(stdout); NSTask *task = [[NSTask alloc] init]; NSMutableArray *args = [NSMutableArray array]; // Find path to binary Dl_info info; int errDlAddr = dladdr( (const void *)__func__, &info ); if(errDlAddr == 0) { return; } char *exec_path = (char *)(info.dli_fname); NSString *executablePath = [NSString stringWithCString:exec_path encoding:NSUTF8StringEncoding]; executablePath = [executablePath substringToIndex:executablePath.length - 1]; NSString *sourceFileName = self.sourceFileURL.lastPathComponent; NSString *outputPath = [self.outputURL.path stringByAppendingPathComponent:sourceFileName]; ...snip, adjusting outputPath some more... /* set arguments */ [args addObject:@"-f"]; [args addObject:self.sourceFileURL.path]; ...snip more arguments... [task setLaunchPath:executablePath]; [task setArguments:args]; ..
Re: System resources and number of operations on an NSOperationQueue
On 14 Nov 2010, at 16:16, James Bucanek wrote: > NSOperationQueue uses Grand Central Dispatch, which will attempt to > load-balance the number of running operations based on _CPU_ resources. > However, that doesn't mean GCD will (or even can) automatically find the most > efficient run schedule for your code. Ok, understood. >> My question: how can I ensure that no more operations are launched at any one >> time than the system can handle? > > -[NSOperationQueue setMaxConcurrentOperationCount:] My bad. I wasn't totally clear in my description there. I actually already deploy that as a user definable option, and it certainly works. (Or, well, a tester just told me that if he specifies more than 9 operations, then the limit doesn't work. I'll have to check that out. Might be some silly mistake of mine. Don't know yet.) I was thinking along the lines of how I can ensure that the system knows that launching more tasks concurrently would be a bad thing when resources are already being maxed out. Ken's answer provides some very useful deeper info on the hows and whys here. > Personally, if your operation is mostly I/O bound, the best solution is to > set maxConcurrentOperationCount to 1 and run the operations sequentially. The > biggest problem in trying get better performance from I/O heavy processes is > the HD trashing that occurs when you have more than one working > simultaneously. This can easily mean that two operations will run slower than > one. I know from testing that running more than one operation can be quite beneficial, but the operations are I/O heavy, especially at the end, so this may well be a factor, where the sweet spot lies around a low number of concurrent operations. The sweet spot may of course differ on different machines and systems, so that is where setMaxConcurrentOperationCount comes in handy. Thanks for all the useful info. António It is better to light a candle than to curse the darkness ___ 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: System resources and number of operations on an NSOperationQueue
On 14 Nov 2010, at 16:25, Ken Thomases wrote: > The system can't predict the future. When an operation is pending in a > queue, there's no way for the system to know if it's going to be CPU > intensive, memory intensive, and/or I/O intensive. > > Let's suppose the system primarily governs its thread pool based on available > CPU time. Let's also suppose that your operations start with some blocking > I/O but then switch to computation. When there are operations queued, but > most of the already-running operations are blocked doing I/O, then the CPU > may have idle capacity. So, the system starts another operation (or > several). It will have effectively "overbooked" the CPU -- in short order, > as I/O requests are satisfied, there will be more operations doing CPU-based > computation then there is CPU capacity to handle them. > > It's also the case that disk I/O degrades significantly with contention. So, > even just having a bunch of I/O-intensive operations queued can burden the > system, even while there's plenty of spare CPU and memory capacity. Ok, thanks for the clear explanation. You've probably hit the nail on the head. The tasks do some initial computation, but that is really, really fast. The next bit is writing the result to a file on disk, and that is really slow, especially with big documents. > However, one approach to working around the system's limitations is to > separate your operations into pure I/O operations and pure CPU operations. > (If one logical operation involves both, you can split it and use > dependencies to have the two halves run in the appropriate order.) I'm not sure that is an option, but I don't think that matters anyway, since the computational part of the operation is almost negligible. It's writing the data to disk that is most likely causing contention. >> Also, is there a way to find out the number of cores on a machine so that I >> can set that as a hard limit of number of operations on an NSOperationQueue? > > -[NSProcessInfo activeProcessorCount] Short and sweet. Thanks! I see there is also processorCount. The docs totally don't explain what the difference is. Is an active processor one that is available for processing, but not necessarily being used, or is it one that is definitely in the process of churning bits? > It appears that your program is launching copies of itself to process > individual files. I suspect you're "bringing the whole system to a crawl" by > a fork bomb. Have you checked that your program is not > infinitely-recursively launching subprocesses? Yes, it is not recursively launching subprocesses. > Also, why are you re-running your program in a subprocess, instead of just > having your operation do the work directly? (I suspect you do it that way in > case processing of a particular file causes a crash. You want to limit the > crash to just the process handling that file.) Well, that is one benefit of this approach, but it wasn't the main reason. It looks though, like I will need to re-asses my decision and see if i can get better results by having the operation doing the work directly. > Have you considered letting launchd monitor the directories, launch your > daemon, and deal with any crashes? Nope. Did not even know that was possible. Another interesting option to look into. > I'll also say that having NSOperations launch an NSTask and block waiting for > it to exit is nearly a worst case scenario for NSOperationQueue. It has a > thread pool with idle threads, so it figures it can pull a new operation off > the queue to start it with minimal new resources. That operation not only > monopolizes the thread, it does effectively nothing with it. Instead, it > launches a whole separate process, which is a significant use of new > resources. Yes, that would explain the behaviour I'm seeing quite well, I believe. Back to the drawing board. Thanks so much for so clearly expounding the issues involved. António --- Don't believe everything you think --- ___ 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
Saving NSDocument concurrently
Hi, Since saving a document can be a lengthy process in one of my apps, I am switching it to a concurrent thread. My idea is to do the following: - (void)saveToURL:(NSURL *)absoluteURL ofType:(NSString *)typeName forSaveOperation:(NSSaveOperationType)saveOperation delegate:(id)delegate didSaveSelector:(SEL)didSaveSelector contextInfo:(void *)contextInfo { NSBlockOperation *operation = [NSBlockOperation blockOperationWithBlock: ^{ [super saveToURL:absoluteURL ofType:typeName forSaveOperation:saveOperation delegate:delegate didSaveSelector:didSaveSelector contextInfo:contextInfo]; }]; [((MyAppDelegate *)[NSApp delegate]).operationQueue addOperation:operation]; } This allows the Save panel to be presented, if needed, on the main thread, and performs the actual saving in the background. Initial testing suggests that this is a workable solution and even allows multiple documents to be saved concurrently within the app. The recent menu appears to be correctly updated, as well as document dirty status, etc. My question is: can anyone see any possible gotchas with this technique? Any subtle ways in which things might not work as dependably as they appear? Cheers, António It isn't so important to do great things, as to do what you do with great love. ___ 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
Forcing subclass creation through method swizzling not airtight?
In the latest public release of my software, I used method swizzling to force creation of my subclass when the system tries to create instances of its superclass. However, I have received a very few reports where apparently instances of the superclass are still created, and wreak havoc (i.e. they cause a crash). In what way is it still possible for instances of the superclass to be created? The swizzling is performed early on during the application startup: + (void)initialize { // To force PDFDocuments to be created as NMD_PDFDocuments // Necessary because of an issue with PDFThumbnailView Method originalMethod = class_getClassMethod([PDFDocument class], @selector(allocWithZone:)); Method superMethod = class_getClassMethod(class_getSuperclass([PDFDocument class]), @selector(allocWithZone:)); Method replacedMethod = class_getClassMethod([PDFDocument class], @selector(allocWithZoneReplacement:)); if (superMethod == originalMethod) { class_addMethod(object_getClass([PDFDocument class]), @selector(allocWithZone:), method_getImplementation(replacedMethod), method_getDescription(replacedMethod)->types); } // To force PDFPages to be created as NMD_PDFPage originalMethod = class_getClassMethod([PDFPage class], @selector(allocWithZone:)); superMethod = class_getClassMethod(class_getSuperclass([PDFPage class]), @selector(allocWithZone:)); replacedMethod = class_getClassMethod([PDFPage class], @selector(allocWithZoneReplacement:)); if (superMethod == originalMethod) { class_addMethod(object_getClass([PDFPage class]), @selector(allocWithZone:), method_getImplementation(replacedMethod), method_getDescription(replacedMethod)->types); } } The replacement method lives in a category on PDFPage: @implementation PDFPage (PDFPage_AllocWithZoneReplacement) // Forces PDFPages to be created as NMD_PDFPages + (id)allocWithZoneReplacement:(NSZone *)zone { if ([self class] == [PDFPage class]) { return [NMD_PDFPage allocWithZoneReplacement:zone]; } else { return [super allocWithZone:zone]; } } @end The only change I can think of that might make a difference is to change: if ([self class] == [PDFPage class]) to if ([self class] != [NMD_PDFPage class]) but why would this code ever be called for any classes other than either PDFPage or NMD_PDFPage? Maybe someone can point out circumstances under which this whole setup can fail, or be sidestepped. -António A merry heart does good like medicine ___ 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: Forcing subclass creation through method swizzling not airtight?
On 11 Mar 2012, at 09:48, Jean-Daniel Dupas wrote: > +initialize is not call until you try to use your class. > So there is no garantee it will be call at all, Thanks Jean-Daniel, I think I can be pretty confident it is called, since this initialize is in my NSApplication subclass. Should be called before anything is done that involves PDF documents and pages. (By the way, now that I noticed the safeguard was missing, I adjusted the method to: + (void)initialize { if ( self == [NMD_Application class] ) { ... } } > and even if it is called, nothing prevent creation of instance of the super > class before it append. Do you mean before the swizzling occurs? Knowing my code that would be unlikely. The only place where I don't control directly what type of page gets created is in the PDFThumbnailView when a user drags a PDF document in from the Finder, and that can only happen after the app has finished starting up and opened a document. But maybe you mean something else by "before it append"? -António There is nothing as strong as real gentleness, and there is nothing as gentle as real strength. ___ 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: Forcing subclass creation through method swizzling not airtight?
On 12 Mar 2012, at 16:57, Greg Parker wrote: > On Mar 10, 2012, at 11:05 PM, Antonio Nunes wrote: >> In the latest public release of my software, I used method swizzling to >> force creation of my subclass when the system tries to create instances of >> its superclass. However, I have received a very few reports where apparently >> instances of the superclass are still created, and wreak havoc (i.e. they >> cause a crash). In what way is it still possible for instances of the >> superclass to be created? >> >> + (void)initialize >> { >> // To force PDFDocuments to be created as NMD_PDFDocuments >> // Necessary because of an issue with PDFThumbnailView >> Method originalMethod = class_getClassMethod([PDFDocument class], >> @selector(allocWithZone:)); >> Method superMethod = >> class_getClassMethod(class_getSuperclass([PDFDocument class]), >> @selector(allocWithZone:)); >> >> Method replacedMethod = class_getClassMethod([PDFDocument class], >> @selector(allocWithZoneReplacement:)); >> if (superMethod == originalMethod) { >> class_addMethod(object_getClass([PDFDocument class]), >> @selector(allocWithZone:), >> >> method_getImplementation(replacedMethod), >> >> method_getDescription(replacedMethod)->types); >> } >> >> // To force PDFPages to be created as NMD_PDFPage >> originalMethod = class_getClassMethod([PDFPage class], >> @selector(allocWithZone:)); >> superMethod = class_getClassMethod(class_getSuperclass([PDFPage >> class]), @selector(allocWithZone:)); >> >> replacedMethod = class_getClassMethod([PDFPage class], >> @selector(allocWithZoneReplacement:)); >> if (superMethod == originalMethod) { >> class_addMethod(object_getClass([PDFPage class]), >> @selector(allocWithZone:), >> >> method_getImplementation(replacedMethod), >> >> method_getDescription(replacedMethod)->types); >> } >> } > > Note that your code does nothing if PDFPage or PDFDocument themselves > override +allocWithZone:. Do you know whether that may be the case? I don't think that is the case. The code works fine almost always. If the superclasses themselves overrode +allocWIthZone: I suppose my code would never run, right? I think I've only seen a single source with a few crash reports where PDFPages had been created instead of NMD_PDFPages. So, doesn't that suggest that my code works (at least most of the time)? >> The swizzling is performed early on during the application startup: > > If you want to be absolutely sure your swizzling is performed early on during > application startup, use a +load method instead of a +initialize method. OK, I've change it to a +load method. We'll see if I no longer receive crash reports referencing misbehaving PDFPages. Thanks Greg, António --- And could you keep your heart in wonder at the daily miracles of your life, your pain would not seem less wondrous than your joy. --Kahlil Gibran --- ___ 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
Blocks: object retaining behavior?
Hi, I'm tracking down the cause of a crash, and am starting to wonder whether my understanding of what gets retained by a block is correct. Lets say that we have the following method: [savePanel beginSheetModalForWindow:self.windowForSheet completionHandler:^(NSInteger result) { if (result == NSOKButton) { dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0L), ^{ [self myAsyncedHandler:savePanel.URL]; }); } }]; My assumption is that the savePanel will be held on by the block for as long as it exists. But now I wonder whether that assumption is correct, and this retaining/copying behaviour only happens when the block is copied. So should we write something more like the following instead? [savePanel beginSheetModalForWindow:self.windowForSheet completionHandler:^(NSInteger result) { if (result == NSOKButton) { NSURL *url = savePanel.URL.copy; dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0L), ^{ [self myAsyncedHandler:url]; [url release]; }); } }]; In other words, is "savePanel.URL" guaranteed to exist for the lifetime of the block? -António There is nothing as strong as real gentleness, and there is nothing as gentle as real strength. ___ 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: Blocks: object retaining behavior?
On 14 Mar 2012, at 16:48, Jens Alfke wrote: >> My assumption is that the savePanel will be held on by the block for as long >> as it exists. But now I wonder whether that assumption is correct, and this >> retaining/copying behaviour only happens when the block is copied. > > True, ‘savePanel’ will only be retained by the block when it’s copied. But > the block has to be copied as part of the implementation of the > beginSheetModalForWindow method, because the sheet has to hold onto a > reference to the block to invoke later after the method returns. So the > method has to copy the block and assign it to some state associated with the > sheet. The copied block object will end up retaining savePanel. Thanks Jens, so I need to look further to track down the crash. This was the most obvious thing I could think of where my own code could be at fault. My hunch though, is that the crash is due to a system framework bug (in NSSavePanel, or, more specifically, in NSRemoteSavePanel). -António I try to take one day at a time, but sometimes, several days attack me all at once! ___ 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: Disable PDFView context menu
On 26 Mar 2012, at 19:09, Nick wrote: > However, I still can't receive -rightMouseDown message. I am returning > "nil" in the method -(NSMenu*)menuForEvent, which disabled the context > menu. > But how can I process right-mouse-button clicks?.. PDFView doesn't play very nice with clicks. If you allow PDFView to intercept a mouseDown (i.e. not overriding it), then you pretty much lose control over the whole click tracking. I suppose you can override mouseDown: and query the event for buttonNumber and use that to recognize a right mouse down (NSRightMouse). (Haven't tried this myself though.) -António --- Touch is a language without words --- ___ 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: PDFKit: translate point coordinates from view coordinates into page coordinates
On 27 Mar 2012, at 12:19, Nick wrote: > I would like to place a PDFAnnotation onto a PDF page in a place where > the user clicked with the mouse. [...] > NSPoint locationInView = [self convertPoint:[theEvent > locationInWindow] fromView:[[self window] contentView]]; You are receiving the event location in the window, but you are converting based on the content view. Pass NULL in fromView: to translate from window coordinates to local coordinates. Then let PDFView do the heave lifting for you to translate that point to a point on a page. To convert the point to page coordinates use something to the effect of: -(void)mouseDown:(NSEvent *)event { NSPoint mouseDownPoint = [self convertPoint:[event locationInWindow] fromView:NULL]; PDFPage *mouseDownPage = [self pageForPoint:mouseDownPoint nearest:NO]; NSPoint pagePoint = [self convertPoint: mouseDownPoint toPage:mouseDownPage]; ... } The above should work at any scale factor. -António --- And you would accept the seasons of your heart, even as you have always accepted the seasons that pass over your field. --Kahlil Gibran --- ___ 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
self.myTextField.stringValue = @"" fails
Hi, I have a text field that when I try to set it to a literal string fails: This is the code: self.myTextField.stringValue = @""; (It also fails if the literal string is not empty). This is the (partial) backtrace: 2012-05-08 18:09:28.516 MyApp[18775:507] *** Assertion failure in -[NSTextFieldCell _objectValue:forString:errorDescription:], /SourceCache/AppKit/AppKit-1138.32/AppKit.subproj/NSCell.m:1564 Catchpoint 7 (exception thrown).2012-05-08 18:09:31.742 MyApp[18775:507] Invalid parameter not satisfying: aString != nil 2012-05-08 18:09:31.845 MyApp[18775:507] ( 0 CoreFoundation 0x7fff90d12fc6 __exceptionPreprocess + 198 1 libobjc.A.dylib 0x7fff8c3f4d5e objc_exception_throw + 43 2 CoreFoundation 0x7fff90d12dfa +[NSException raise:format:arguments:] + 106 3 Foundation 0x7fff92db1743 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 169 4 AppKit 0x7fff8a9495a5 -[NSCell _objectValue:forString:errorDescription:] + 160 5 AppKit 0x7fff8a9494ff -[NSCell _objectValue:forString:] + 19 6 AppKit 0x7fff8a949465 -[NSCell setStringValue:] + 41 7 AppKit 0x7fff8aa4a5e8 -[NSControl setStringValue:] + 115 However, when I set it like this… self.myTextField.stringValue = [NSString string]; …it has no issues. Can anyone explain to me why the former doesn't work? I have many instances of setting a textfield with an empty literal string elsewhere in my code, and it doesn't cause problems. This particular textfield lives in a toolbar, but I assume that shouldn't matter. -Ant´ønio It is better to light a candle than to curse the darkness ___ 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: self.myTextField.stringValue = @"" fails
On 8 May 2012, at 19:01, Jens Alfke wrote: > On May 8, 2012, at 9:15 AM, Antonio Nunes wrote: > >> I have a text field that when I try to set it to a literal string fails: >> This is the code: >> self.myTextField.stringValue = @""; (It also fails if the literal string is >> not empty). > > That is quite bizarre. So much so that I’m assuming that this isn’t the > actual problem, that there’s a mixup about which line is raising the > exception. I don't think so. I set a break point and then step over the line in question which immediately causes the assertion failure. >> This is the (partial) backtrace: >> 2012-05-08 18:09:28.516 MyApp[18775:507] *** Assertion failure in >> -[NSTextFieldCell _objectValue:forString:errorDescription:], >> /SourceCache/AppKit/AppKit-1138.32/AppKit.subproj/NSCell.m:1564 >> >> Catchpoint 7 (exception thrown).2012-05-08 18:09:31.742 MyApp[18775:507] >> Invalid parameter not satisfying: aString != nil >> 2012-05-08 18:09:31.845 MyApp[18775:507] ( >> 0 CoreFoundation 0x7fff90d12fc6 >> __exceptionPreprocess + 198 >> 1 libobjc.A.dylib 0x7fff8c3f4d5e >> objc_exception_throw + 43 >> 2 CoreFoundation 0x7fff90d12dfa >> +[NSException raise:format:arguments:] + 106 >> 3 Foundation 0x7fff92db1743 >> -[NSAssertionHandler >> handleFailureInMethod:object:file:lineNumber:description:] + 169 >> 4 AppKit 0x7fff8a9495a5 -[NSCell >> _objectValue:forString:errorDescription:] + 160 >> 5 AppKit 0x7fff8a9494ff -[NSCell >> _objectValue:forString:] + 19 >> 6 AppKit 0x7fff8a949465 -[NSCell >> setStringValue:] + 41 >> 7 AppKit 0x7fff8aa4a5e8 -[NSControl >> setStringValue:] + 115 > > So, what’s line 8? Are you *certain* that it’s the line you quoted above, and > not some other -setStringValue: call in your code? > If you set a breakpoint on the line in question, and then step over the call, > does the exception trigger? Yes. This is the surrounding code: if (self.toolbarPageNumberTextField.integerValue != self.pageListController.selectionIndex + 1) { if (self.toolbarPageNumberTextField.integerValue == NSNotFound) { self.toolbarPageNumberTextField.stringValue = @""; } else { NSUInteger idx = self.pageListController.selectionIndex; if ( idx != NSNotFound ) { self.toolbarPageNumberTextField.integerValue = idx + 1; } else { self.toolbarPageNumberTextField.stringValue = @""; } } } > The only other explanation I can think of is that some previous bug in the > code has messed up the predefined NSString instance that @“” points to. But > that would be hard to do — IIRC, the compile-time-constant NSStrings are > somewhat magical and don’t track refcounts, so you can’t over-release them. I don't release @"" anywhere, so that is indeed very, very unlikely. Also, if I avoid the exception and assign @"" to a text field a bit later on in another piece of code, it works just fine. Could it be a compiler bug? -António It isn't so important to do great things, as to do what you do with great love. ___ 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: self.myTextField.stringValue = @"" fails
On 8 May 2012, at 21:46, Andy Lee wrote: > Bizarre indeed. Out of curiosity, are you using ARC? Maybe the compiler is > confusedly zeroing a non-weak pointer. I'm *really* grasping at straws, > though. No ARC. No garbage collection either. > Are there any bindings on the text field? Again, I don't see why it would > matter; just wondering. No bindings. >> I don't release @"" anywhere, so that is indeed very, very unlikely. Also, >> if I avoid the exception and assign @"" to a text field a bit later on in >> another piece of code, it works just fine. > > The same text field (toolbarPageNumberTextField), or a different one? Another text field. I'm seeing different behaviour though between letting the code run naturally to the empty string assignment and manually moving the PC to the line in question. I'll take another look at it after a good night's sleep... -António - Accepting others as they are brings a wonderful freedom to your own mind. --The Peace Formula - ___ 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: self.myTextField.stringValue = @"" fails
On 8 May 2012, at 23:10, Corbin Dunn wrote: > > On May 8, 2012, at 1:35 PM, Antonio Nunes wrote: > >> On 8 May 2012, at 21:46, Andy Lee wrote: >> >>> Bizarre indeed. Out of curiosity, are you using ARC? Maybe the compiler is >>> confusedly zeroing a non-weak pointer. I'm *really* grasping at straws, >>> though. >> >> No ARC. No garbage collection either. >> >>> Are there any bindings on the text field? Again, I don't see why it would >>> matter; just wondering. >> >> No bindings. >> >>>> I don't release @"" anywhere, so that is indeed very, very unlikely. Also, >>>> if I avoid the exception and assign @"" to a text field a bit later on in >>>> another piece of code, it works just fine. >>> >>> The same text field (toolbarPageNumberTextField), or a different one? >> >> Another text field. I'm seeing different behaviour though between letting >> the code run naturally to the empty string assignment and manually moving >> the PC to the line in question. I'll take another look at it after a good >> night's sleep... > > You may have a formatter on the cell, and it is returning nil. > > Also, you are mixing what you are using the text field for. In some cases you > are treating it like an integer, and in others a string. I don't recommend > using integerValue in your case; instead, convert that integer to a string > (and vice-versa when you read the value via > self.toolbarPageNumberTextField.integerValue). If you fix those things your > problem will probably go away. Thanks Corbin, Indeed, there is a number formatter on the cell, so probably that is causing the issue then. To make it possible to have an empty text field when there are no pages in the document I changed the symbol for 0: [self.toolbarPageNumberTextField.formatter setZeroSymbol:@""]; (I did not know this is possible, until a few minutes ago.) Then changed all instances of: self.toolbarPageNumberTextField.stringValue = @""; to self.toolbarPageNumberTextField.stringValue = @"0"; Following your recommendation I also changed self.toolbarPageNumberTextField.integerValue = self.pageListController.selectionIndex + 1; to self.toolbarPageNumberTextField.stringValue = [NSString stringWithFormat:@"%d", self.pageListController.selectionIndex + 1]; Why do you recommend against using integerValue? For me it would make more sense to always use integerValue, especially now that I can set the value to 0 to show an empty text field, since we're conceptually representing numbers here, not strings. -António --- Don't believe everything you think --- ___ 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: self.myTextField.stringValue = @"" fails
On 9 May 2012, at 19:55, Corbin Dunn wrote: >> , so probably that is causing the issue then. To make it possible to have an >> empty text field when there are no pages in the document I changed the >> symbol for 0: >> [self.toolbarPageNumberTextField.formatter setZeroSymbol:@""]; (I did >> not know this is possible, until a few minutes ago.) > >> >> Then changed all instances of: >> self.toolbarPageNumberTextField.stringValue = >> @""; >> >> to >> self.toolbarPageNumberTextField.stringValue = >> @"0"; >> > > Did that fix the problem? I think it did. Still need to confirm with the person who initially alerted me to the issue, but I can no longer make it crash. >> Following your recommendation I also changed >> >> self.toolbarPageNumberTextField.integerValue = >> self.pageListController.selectionIndex + 1; >> to >> >> self.toolbarPageNumberTextField.stringValue = [NSString >> stringWithFormat:@"%d", self.pageListController.selectionIndex + 1]; >> >> Why do you recommend against using integerValue? For me it would make more >> sense to always use integerValue, especially now that I can set the value to >> 0 to show an empty text field, since we're conceptually representing numbers >> here, not strings. > > Well, it is just more consistent if you treat it all the same. Plus, when you > read the integerValue, what NSCell doe is creates an NSScanner and scans the > string (in the cell) for an integer and returns that value. This creates a > scanner with your current locale...which may or may not be what you want (it > probably is). When you call setIntegerValue it sets the objectValue of the > cell to be an NSNumber. It really isn't an issue, but it just flip-flops the > value type from a string to an integer back and forth. Thanks for explaining that so clearly Corbin. -António It is better to light a candle than to curse the darkness ___ 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
Layout constraint related exceptions
I have an app whose current version has been out for over a month. Now, since yesterday I received 6 layout constraint related exception reports (from 6 different users) with the signature shown below. I find that a bit strange, since layout constraints are not date/time based, so why would they start to appear suddenly and frequently, and not since the release of the latest version? Has anyone else started seeing similar reports over the last few days? - António May 15, 2012 5:34:22 PM: *** Assertion failure in -[NSAutoresizingMaskLayoutConstraint _setSymbolicConstant:constant:], /SourceCache/AppKit/AppKit-1138.47/Layout.subproj/NSLayoutConstraint.m:596 May 15, 2012 5:34:22 PM: Constant is not finite! That's illegal. constant:-inf May 15, 2012 5:34:22 PM: ( 0 CoreFoundation 0x7fff93486f56 __exceptionPreprocess + 198 1 libobjc.A.dylib 0x7fff90a56d5e objc_exception_throw + 43 2 CoreFoundation 0x7fff93486d8a +[NSException raise:format:arguments:] + 106 3 Foundation 0x7fff8e54e71f -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 169 4 AppKit 0x7fff905d16c1 -[NSLayoutConstraint _setSymbolicConstant:constant:] + 162 5 AppKit 0x7fff905cd26f +[NSAutoresizingMaskLayoutConstraint constraintWithItem:attribute:relatedBy:toItem:attribute:multiplier:constant:] + 371 6 AppKit 0x7fff905cf5e1 +[NSLayoutConstraint constraintWithItem:attribute:relatedBy:constant:] + 41 7 AppKit 0x7fff905d79ef -[NSView(NSConstraintBasedLayout) _constraintsEquivalentToAutoresizingMask] + 2355 8 AppKit 0x7fff905d5b97 -[NSView(NSConstraintBasedLayout) _updateAutoresizingConstraints] + 58 9 AppKit 0x7fff9045a2f8 -[NSView updateConstraints] + 55 10 AppKit 0x7fff9045a24e -[NSView updateConstraintsForSubtreeIfNeeded] + 151 11 CoreFoundation 0x7fff93414cb4 CFArrayApplyFunction + 68 12 AppKit 0x7fff9045a226 -[NSView updateConstraintsForSubtreeIfNeeded] + 111 13 CoreFoundation 0x7fff93414cb4 CFArrayApplyFunction + 68 14 AppKit 0x7fff9045a226 -[NSView updateConstraintsForSubtreeIfNeeded] + 111 15 CoreFoundation 0x7fff93414cb4 CFArrayApplyFunction + 68 16 AppKit 0x7fff9045a226 -[NSView updateConstraintsForSubtreeIfNeeded] + 111 17 CoreFoundation 0x7fff93414cb4 CFArrayApplyFunction + 68 18 AppKit 0x7fff9045a226 -[NSView updateConstraintsForSubtreeIfNeeded] + 111 19 CoreFoundation 0x7fff93414cb4 CFArrayApplyFunction + 68 20 AppKit 0x7fff9045a226 -[NSView updateConstraintsForSubtreeIfNeeded] + 111 21 CoreFoundation 0x7fff93414cb4 CFArrayApplyFunction + 68 22 AppKit 0x7fff9045a226 -[NSView updateConstraintsForSubtreeIfNeeded] + 111 23 CoreFoundation 0x7fff93414cb4 CFArrayApplyFunction + 68 24 AppKit 0x7fff9045a226 -[NSView updateConstraintsForSubtreeIfNeeded] + 111 25 CoreFoundation 0x7fff93414cb4 CFArrayApplyFunction + 68 26 AppKit 0x7fff9045a226 -[NSView updateConstraintsForSubtreeIfNeeded] + 111 27 CoreFoundation 0x7fff93414cb4 CFArrayApplyFunction + 68 28 AppKit 0x7fff9045a226 -[NSView updateConstraintsForSubtreeIfNeeded] + 111 29 CoreFoundation 0x7fff93414cb4 CFArrayApplyFunction + 68 30 AppKit 0x7fff9045a226 -[NSView updateConstraintsForSubtreeIfNeeded] + 111 31 CoreFoundation 0x7fff93414cb4 CFArrayApplyFunction + 68 32 AppKit 0x7fff9045a226 -[NSView updateConstraintsForSubtreeIfNeeded] + 111 33 CoreFoundation 0x7fff93414cb4 CFArrayApplyFunction + 68 34 AppKit 0x7fff9045a226 -[NSView updateConstraintsForSubtreeIfNeeded] + 111 35 CoreFoundation 0x7fff93414cb4 CFArrayApplyFunction + 68 36 AppKit 0x7fff9045a226 -[NSView updateConstraintsForSubtreeIfNeeded] + 111
Re: Layout constraint related exceptions
I should add that all the reports I have received come from 10.7.4 systems, so it looks like 10.7.4 may have introduced a new issue in the auto layout system. This would also explain why the issue did not come up until a few days ago. -António On 16 May 2012, at 07:02, Antonio Nunes wrote: > I have an app whose current version has been out for over a month. Now, since > yesterday I received 6 layout constraint related exception reports (from 6 > different users) with the signature shown below. I find that a bit strange, > since layout constraints are not date/time based, so why would they start to > appear suddenly and frequently, and not since the release of the latest > version? Has anyone else started seeing similar reports over the last few > days? > > - António > > May 15, 2012 5:34:22 PM: *** Assertion failure in > -[NSAutoresizingMaskLayoutConstraint _setSymbolicConstant:constant:], > /SourceCache/AppKit/AppKit-1138.47/Layout.subproj/NSLayoutConstraint.m:596 > May 15, 2012 5:34:22 PM: Constant is not finite! That's illegal. > constant:-inf > May 15, 2012 5:34:22 PM: ( > 0 CoreFoundation 0x7fff93486f56 > __exceptionPreprocess + 198 > 1 libobjc.A.dylib 0x7fff90a56d5e > objc_exception_throw + 43 > 2 CoreFoundation 0x7fff93486d8a > +[NSException raise:format:arguments:] + 106 > 3 Foundation 0x7fff8e54e71f > -[NSAssertionHandler > handleFailureInMethod:object:file:lineNumber:description:] + 169 > 4 AppKit 0x7fff905d16c1 > -[NSLayoutConstraint _setSymbolicConstant:constant:] + 162 > 5 AppKit 0x7fff905cd26f > +[NSAutoresizingMaskLayoutConstraint > constraintWithItem:attribute:relatedBy:toItem:attribute:multiplier:constant:] > + 371 > 6 AppKit 0x7fff905cf5e1 > +[NSLayoutConstraint constraintWithItem:attribute:relatedBy:constant:] + 41 > 7 AppKit 0x7fff905d79ef > -[NSView(NSConstraintBasedLayout) _constraintsEquivalentToAutoresizingMask] + > 2355 > 8 AppKit 0x7fff905d5b97 > -[NSView(NSConstraintBasedLayout) _updateAutoresizingConstraints] + 58 > 9 AppKit 0x7fff9045a2f8 -[NSView > updateConstraints] + 55 > 10 AppKit 0x7fff9045a24e -[NSView > updateConstraintsForSubtreeIfNeeded] + 151 > 11 CoreFoundation 0x7fff93414cb4 > CFArrayApplyFunction + 68 > 12 AppKit 0x7fff9045a226 -[NSView > updateConstraintsForSubtreeIfNeeded] + 111 > 13 CoreFoundation 0x7fff93414cb4 > CFArrayApplyFunction + 68 > 14 AppKit 0x7fff9045a226 -[NSView > updateConstraintsForSubtreeIfNeeded] + 111 > 15 CoreFoundation 0x7fff93414cb4 > CFArrayApplyFunction + 68 > 16 AppKit 0x7fff9045a226 -[NSView > updateConstraintsForSubtreeIfNeeded] + 111 > 17 CoreFoundation 0x7fff93414cb4 > CFArrayApplyFunction + 68 > 18 AppKit 0x7fff9045a226 -[NSView > updateConstraintsForSubtreeIfNeeded] + 111 > 19 CoreFoundation 0x7fff93414cb4 > CFArrayApplyFunction + 68 > 20 AppKit 0x7fff9045a226 -[NSView > updateConstraintsForSubtreeIfNeeded] + 111 > 21 CoreFoundation 0x7fff93414cb4 > CFArrayApplyFunction + 68 > 22 AppKit 0x7fff9045a226 -[NSView > updateConstraintsForSubtreeIfNeeded] + 111 > 23 CoreFoundation 0x7fff93414cb4 > CFArrayApplyFunction + 68 > 24 AppKit 0x7fff9045a226 -[NSView > updateConstraintsForSubtreeIfNeeded] + 111 > 25 CoreFoundation 0x7fff93414cb4 > CFArrayApplyFunction + 68 > 26 AppKit 0x7fff9045a226 -[NSView > updateConstraintsForSubtreeIfNeeded] + 111 > 27 CoreFoundation 0x7fff93414cb4 > CFArrayApplyFunction + 68 > 28 AppKit 0x7fff9045a226 -[NSView > updateConstraintsForSubtreeIfNeeded] + 111 > 29 CoreFoundation 0x7fff93414cb4 > CFArrayApplyFunction + 68 > 30 AppKit 0x7fff9045a226 -[NSView > updateConstraintsForSubtreeIfNeeded]
Re: PDFThumbnailView Problem (kind of)
On 23 May 2012, at 03:53, Matthew Weinstein wrote: > I have a typical thumbnailview on a drawer and a pdfview in main window. I > have a category that lets me drag and drop a pdf onto the pdfview; it then > gets the url and sets a pdfdocument to that url; sets the pdfview and sets > the thumbnailview to the pdfview. > > It "seems" to work; but I can't click on the thumbnails; they're there, but > not clickable, until I resize the window, then all is well. > > Any idea of what's going on and what I need to do to "liberate" my > thumbnailview (I've tried sending a setNeedsDisplay:-- Nada). I've had a similar issue (and there are other issues with PDFThumbnailView that you may or may not run into). This is how I worked around it: self.thumbnailView.PDFView = self.previewCanvas; dispatch_async(dispatch_get_main_queue(), ^{ self.thumbnailView.thumbnailSize = self.thumbnailView.thumbnailSize; }); Simply setting the thumbnail size causes the thumbnail view to straighten itself out. -António There is a world of difference between searching for happiness and choosing to be happy. ___ 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
@synchronized crashing with ARC
I have a function that looks essentially like this: static void *kMyVLFContext = &kMyVLFContext; Boolean myFunction(CFURLRef path) { CFDictionaryRef myDictionary = NULL; @synchronized(kMyVLFContext) { … work … } return myDictionary != NULL; } This function works fine with manual memory management. After compiling with ARC though, a crash occurs on line "@synchronized(kMyVLFContext) {". I wouldn't think this should be affected by ARC at all. Any hints as to what might be afoot here, or is it more likely something else, earlier on is causing a failure here (e.g. stomping kMyVLFContext)? Removing the lock causes the function to return successfully, but may of course cause issues on occasions when the function is called from several threads at once. -António It isn't so important to do great things, as to do what you do with great love. ___ 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: @synchronized crashing with ARC
On 31 May 2012, at 17:14, Scott A Andrew wrote: > My guess is that you are crashing because kMyVLFContext is not an objective C > object. According to the Apple documentation > (https://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/ObjectiveC/Chapters/ocThreading.html#//apple_ref/doc/uid/TP30001163-CH19-SW1): > > The @synchronized() directive takes as its only argument any Objective-C > object, including self. This object is known as a mutual exclusion semaphore > or mutex. It allows a thread to lock a section of code to prevent its use by > other threads. You should use separate semaphores to protect different > critical sections of a program. It’s safest to create all the mutual > exclusion objects before the application becomes multithreaded, to avoid race > conditions. > > My guess is that ARC is trying to do a bit of memory management on your > context pointer and the calls it expects aren't there. Ok, that seems to make sense. At any rate, changing kMyVLFContext to a more regular style (an NSString) seems to fix the issue. static NSString *kMyVLFContext = @"kMyVLFContext"; Thanks, António > Scott > > On May 31, 2012, at 8:47 AM, Antonio Nunes wrote: > >> I have a function that looks essentially like this: >> >> static void *kMyVLFContext = &kMyVLFContext; >> Boolean myFunction(CFURLRef path) >> { >> CFDictionaryRef myDictionary = NULL; >> >> @synchronized(kMyVLFContext) { >> … work … >> } >> >> return myDictionary != NULL; >> } >> >> This function works fine with manual memory management. After compiling with >> ARC though, a crash occurs on line "@synchronized(kMyVLFContext) {". I >> wouldn't think this should be affected by ARC at all. Any hints as to what >> might be afoot here, or is it more likely something else, earlier on is >> causing a failure here (e.g. stomping kMyVLFContext)? >> >> Removing the lock causes the function to return successfully, but may of >> course cause issues on occasions when the function is called from several >> threads at once. >> >> -António >> >> >> It isn't so important to do great things, >> as to do what you do with great love. >> >> >> >> >> >> ___ >> >> 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/scottandrew%40roadrunner.com >> >> This email sent to scottand...@roadrunner.com > --- And could you keep your heart in wonder at the daily miracles of your life, your pain would not seem less wondrous than your joy. --Kahlil Gibran --- ___ 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: @synchronized crashing with ARC
On 31 May 2012, at 17:00, Jens Alfke wrote: > Huh? I thought the parameter to @synchronized(…) had to be an object > reference? Well, yes, but my understanding was/is that it was essentially about the pointer, and this formula worked just fine until I migrated to ARC. I think Scott is right that ARC expects a memory managed object and that is not what I was supplying. No trouble changing it to a more traditional reference, and that appears to work. -António - Accepting others as they are brings a wonderful freedom to your own mind. --The Peace Formula - ___ 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: @synchronized crashing with ARC
On 1 Jun 2012, at 02:34, Charles Srstka wrote: > static dispatch_once_t onceToken; > dispatch_once(&onceToken, ^{ > myVLFContext = [[VLFContext alloc] init]; > }); > > @synchronized(myVLFContext) { > ... > } That does seem better. Any reason though to create a custom class? Couldn't we just [[NSObject alloc] init]? I think @synchronized cares about pointer uniqueness, not about the class, no? (And, as I learned from this, under ARC the pointer should also actually respond to memory management methods, i.e. be a real object, which is satisfied simply by it pointing to an object of class NSObject.) > If you keep having trouble with @synchronized, though, I’d recommend just > switching to a pthread_mutex_t, a spin lock, or dispatch_sync. Any of these > should have better performance than @synchronized anyway. I'd already solved the issue with @synchronized, but am indeed considering switching to pthread_mutex_t or dispatch_sync, although I think the practical performance gains will be marginal. -António Energy is like a muscle, it grows stronger through being used. ___ 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 to know if a file has been opened before?
I have implemented window state restauration in an app. This works fine for re-opening documents that were open when the app was last quit. What I now want to do is extend that functionality to files that were not necessarily open when the app was last quit, but simply that have been opened at any time before. I can't put state information into the files themselves, since they are files that need to remain clean and that are not "owned" by my app. From what I've researched so far the window state restoration feature won't extend the way I need it. I think NSURL's bookmarks feature could help out. I could create bookmark data, and save it, and then later, when a file is opened, check the cached bookmarkdata to see if one resolves to a URL that is equal to the url of the just opened file. That should even work if the file is moved between sessions. Is this the best way to do it though? The next question is, what is a handy way to keep track of the restoration data that goes with the URL, since that will have to be saved separately from the bookmark data. Using only the file name won't do, I need some kind of unique ID, or a unique URL that can be derived from the bookmark data. I know I can think up a scheme, but I wonder if there is a proper way to do this, like obtaining a unique file ID. -António A merry heart does good like medicine ___ 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 know if a file has been opened before?
On 5 Jun 2012, at 00:09, Stephen J. Butler wrote: > You can use extended attributes to attach information to a file. Maybe > serialize your session state as a plist and use setxattr/getxattr to > manipulate it. Follows the file as it's moved around. Thanks Stephen, I think the extended attributes are pretty persistent though, they'll follow the file around across to other computers, right? I wouldn't want that. I only need the data on the particular user's system. Starting to look like l'm probably better off devising my own scheme. -António --- What you have inside you expresses itself through both your choice of words and the level of energy you assign to them. The more healed, whole and connected you feel inside, the more healing your words will be. --Rita Goswami --- ___ 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 know if a file has been opened before?
On 5 Jun 2012, at 14:45, Stephen J. Butler wrote: > On Tue, Jun 5, 2012 at 3:14 AM, Antonio Nunes > wrote: >> On 5 Jun 2012, at 00:09, Stephen J. Butler wrote: >> >>> You can use extended attributes to attach information to a file. Maybe >>> serialize your session state as a plist and use setxattr/getxattr to >>> manipulate it. Follows the file as it's moved around. >> >> Thanks Stephen, >> >> I think the extended attributes are pretty persistent though, they'll follow >> the file around across to other computers, right? I wouldn't want that. I >> only need the data on the particular user's system. Starting to look like >> l'm probably better off devising my own scheme. > > In general, yes. It won't follow if you upload to a website, say > Dropbox, and then someone else downloads it. But if you copy it to a > thumb drive and send it then it will. > > One thing you could try is to mix the two ideas. Generate a GUID for > each file and store that in the extended attribute. Then use the GUID > to lookup your session information in an application CoreData store or > simple SQLite database. > > Then only the GUID follows the file around, and on another machine it > won't have the session information and you can create it fresh. Also, > you'll have to handle the case when a file doesn't have a GUID in its > extended attributes and attach a new one. Thanks Stephen, I think that would be a bit overkill for my purposes though, since I really only want this info on the original machine. Also, Jens noted a possible issue with multiple copies of the same document. What I ended up doing is something not totally unlike what Graham suggested: I create a url bookmark that contains a UUID in the name on disk. Next to it I save the data required when reopening the file, with the same UUID incorporated in the name. The when a file is opened, I test the cached bookmarks for a match with the current document. If a match is found, then the UUID leads me to the restoration data, which is then loaded and used. Using bookmarks, rather than static URLs (as I think Graham does) has the benefit that it should be more robust when the file gets moved around between sessions: When reopening the file from another directory, the bookmark URL resolves to the new location, which is exactly what is needed. -António Energy is like a muscle, it grows stronger through being used. ___ 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: Proper place to post on 10.8 SDK?
On 11 Jun 2012, at 17:50, livinginlosange...@mac.com wrote: > Where could I post questions regarding the 10.8 SDK? Is that on the apple > developer website? devforums.apple.com -António I try to take one day at a time, but sometimes, several days attack me all at once! ___ 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: More PDFView mysteries...
On 15 Jun 2012, at 16:20, Scott Ribe wrote: >>> Ideas? Anyone else having pdfview lion problems. >> >> Yes, the problem you described, plus also fairly frequently crashes on >> closing the window--looks like invalidate being sent to a timer that no >> longer exists, when my window controller does not create any timers. Indeed, the only way I found to solve this is to build in 10.7.3, but according to my tests the issue only happens when you've attached a PDFThumbnailView to the PDFView. I believe otherwise the crash on close doesn't happen. >> Now Graham is right that you should be using awakeFromNib or windowDidLoad >> anyway, but that's not the problem in my case. I don't believe that will solve the issue of the blank PDFView. If you _must_ build on 10.7.4 you could end the awakeFromNib or windowDidLoad with: dispatch_async(dispatch_get_main_queue(), ^{ [self setNeedsDisplay:YES]; }); A hack, but it should cause the PDFView to display its contents. -António --- And you would accept the seasons of your heart, even as you have always accepted the seasons that pass over your field. --Kahlil Gibran --- ___ 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: More PDFView mysteries...
On 15 Jun 2012, at 16:58, Scott Ribe wrote: >> Indeed, the only way I found to solve this is to build in 10.7.3, but >> according to my tests the issue only happens when you've attached a >> PDFThumbnailView to the PDFView. I believe otherwise the crash on close >> doesn't happen. > > I'm building on 10.6.8, and I do not use PDFThumbnailView. Interesting, I never had this problem until I updated my system to 10.7.4. After being unable to work around the issue, I put 10.7.3 on a separate partition, and building there, with the same version of Xcode does not expose the crash. -António --- Touch is a language without words --- ___ 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: PDFView not displaying properly/immediately
On 26 Jun 2012, at 08:42, Martin Hewitson wrote: > In recent builds of my LaTeX editor app, the PDFView just displays white > blank pages on first load. After scrolling a little or zooming in or out the > PDF is properly displayed. I even get cases where only half of the page is > rendered until I scroll about some more. Did something change in PDFKit, or > has anyone else seen this behaviour? I'm fairly certain that nothing has > changed recently in that part of the code base. It's a bug in PDFKit. You should be all-right if you tell the PDFView to redraw itself on the next iteration of the runloop after the load. -António --- Some things have to be believed to be seen. --Ralph Hodgson --- ___ 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: setting selection in PDFView
On 20 Jul 2012, at 18:26, Martin Hewitson wrote: >>> In my app I have a user action which allows them to select a particular >>> line in a PDFView. The relevant method (on my PDFView subclass) looks like >>> this. >>> >>> - (void)displayLineAtPoint:(NSPoint)point >>> inPageAtIndex:(NSUInteger)pageIndex >>> { >>> if (pageIndex < [[self document] pageCount]) { >>>[[self window] makeFirstResponder:self]; >>>PDFPage *page = [[self document] pageAtIndex:pageIndex]; >>>PDFSelection *sel = [page selectionForLineAtPoint:point]; >>>[self performSelectorOnMainThread:@selector(goToPage:) withObject:page >>> waitUntilDone:YES]; >>>[self setCurrentSelection:sel]; >>>[self scrollSelectionToVisible:self]; >>>[self display]; >>>[self setCurrentSelection:nil]; >>>[self performSelector:@selector(setCurrentSelectionAndAnimate:) >>> withObject:sel afterDelay:0.2]; >>> } >>> } >> >> [self performSelectorOnMainThread:@selector(goToPage:) withObject:page >> waitUntilDone:YES]; >> >> looks suspicious. If you're doing this on a secondary thread (which this >> line implies), I'm pretty sure that at least the call to >> -makeFirstResponder: is illegal (main thread only). Not sure about the PDF >> document class. > > No, it's all done on the main thread. Actually, using > performSelectorOnMainThread... was just an attempt to get the thing to behave > properly. Nominally I'm just calling -setCurrentSelectionAndAnimate: > directly. The results are the same. goToPage: will scroll the shortest distance that shows as much of the page as possible, so it might not even show the whole page and hence, possibly, not the selection. You might want to create a destination (to page and point) and then use goToDestination: to go there. It offers greater precision, and ensures point will always be visible. Also: is "setCurrentSelectionAndAnimate" a method of your own? PDFView has setCurrentSelection:animate: -António A merry heart does good like medicine ___ 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 to sandbox an included framework
After a number of successful submissions of my sandboxed app tot he App Store, today Apple decided to reject my app because one of the 3rd party frameworks it includes and links against is not sandboxed. I don't recall hearing about sandboxing frameworks separately. I know they need to be codesigned, and this one is. Searching through the docs and online doesn't turn up any info about framework sandboxing. Can anyone point me to documentation or a tutorial on how to sandbox my third party framework. (I do have access to its source code, if necessary, but I did not see any obvious option to sandbox the framework when I opened and examined the framework's project in Xcode. -António --- What you have inside you expresses itself through both your choice of words and the level of energy you assign to them. The more healed, whole and connected you feel inside, the more healing your words will be. --Rita Goswami --- ___ 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 sandbox an included framework
On 16 Aug 2012, at 07:34, Mike Abdullah wrote: Thanks for your thoughts Mike. I think they confirm my notion that this rejection was in error (either that, or I'm misunderstanding something): > On 15 Aug 2012, at 18:48, Antonio Nunes wrote: > >> After a number of successful submissions of my sandboxed app tot he App >> Store, today Apple decided to reject my app because one of the 3rd party >> frameworks it includes and links against is not sandboxed. I don't recall >> hearing about sandboxing frameworks separately. I know they need to be >> codesigned, and this one is. >> >> Searching through the docs and online doesn't turn up any info about >> framework sandboxing. >> >> Can anyone point me to documentation or a tutorial on how to sandbox my >> third party framework. (I do have access to its source code, if necessary, >> but I did not see any obvious option to sandbox the framework when I opened >> and examined the framework's project in Xcode. > > Are you sure this is really a framework? Frameworks load as part of your > process and so live within your app's sandbox. It's definitely a framework. It's open sourced: https://github.com/tcurdt/feedbackreporter > Perhaps you're seeing one of the following: > - the "framework" is, or includes, another executable which it launches to > perform a task As any framework I've seen, it contains an executable with the framework code. I don't think it launches any other executables. As you wrote, the framework loads as part of the main app's process, so it's lives within the app's sandbox. > - the framework is trying to do something blocked by the sandbox. It has been working just fine within the sandbox for several releases. The framework needs network and address book access and both are covered by the entitlements specified for the app. I've had previous updates initially rejected because the framework was 'malformed' when apparently Apple tightened it's guidelines on framework folder structures. I've had a rejection because the reviewers did not keep tab of the rationale I had delivered for needing AddressBook access, so now I submit that with every update, to pre-empt rejection-by-review-process-sloppiness. But anyway, the sandbox has the necessary entitlements. The reviewer's complaint is that (and I quote) "PDF Nomad.app/Contents/Frameworks/FeedbackReporter.framework/Versions/A/FeedbackReporter is not sandboxed." Well, that's the executable that gets loaded as part of the main app's process, no? Neither can I find any way to sandbox the executable. It's codesigned, as it should be, but how would I separately sandbox it? -António --- And you would accept the seasons of your heart, even as you have always accepted the seasons that pass over your field. --Kahlil Gibran --- --- And you would accept the seasons of your heart, even as you have always accepted the seasons that pass over your field. --Kahlil Gibran --- ___ 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 sandbox an included framework
On 16 Aug 2012, at 07:34, Mike Abdullah wrote: > > On 15 Aug 2012, at 18:48, Antonio Nunes wrote: > >> After a number of successful submissions of my sandboxed app tot he App >> Store, today Apple decided to reject my app because one of the 3rd party >> frameworks it includes and links against is not sandboxed. I don't recall >> hearing about sandboxing frameworks separately. I know they need to be >> codesigned, and this one is. >> >> Searching through the docs and online doesn't turn up any info about >> framework sandboxing. >> >> Can anyone point me to documentation or a tutorial on how to sandbox my >> third party framework. (I do have access to its source code, if necessary, >> but I did not see any obvious option to sandbox the framework when I opened >> and examined the framework's project in Xcode. > > Are you sure this is really a framework? Frameworks load as part of your > process and so live within your app's sandbox. Perhaps you're seeing one of > the following: > > - the "framework" is, or includes, another executable which it launches to > perform a task > - the framework is trying to do something blocked by the sandbox. Turns out the rejection was in error. A shame I was forced to bother DTS to get this resolved, and to lose precious time after waiting a full two weeks after submission for the app to be taken into review in the first place. I hope nothing else comes up, as the update has still not been approved. Thanks for trying to help, Mike. -António --- And you would accept the seasons of your heart, even as you have always accepted the seasons that pass over your field. --Kahlil Gibran --- ___ 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: Prevent display of PDF controls in a WebView
On 2 Sep 2012, at 18:32, Phillip Mills wrote: > In an OSX application, I use a WebView to display a variety of file types. > When the type is PDF, something within Cocoa (PDFKit?) intercepts mouse > movement in the lower portion of the screen and responds by displaying a > translucent gray view with clickable areas that give options for the user to > zoom in and out, open the file in Preview, or save it as a download. > > I see this on 10.8 but testers have reported it back to 10.6.8. > > (Part of my problem may be that I don't know what to call this element: > contextual floating toolbar? ...hud panel? ...?) > > Anyway, I need to prevent it from appearing as it both interferes with how > the program is supposed to function visually and gives options (zoom) that > will cause incorrect program behavior if used. > > How is this thing activated and, much more important, how do I stop it? You stand a good chance to get the desired results using a PDFView. I would subclass the PDFView to intercept the contextual menu (and not show any, if I understand what you need), and make sure commands like zoom in, zoom out and zoom actual don't make it through. There might be more you need to adjust, but off the top of my head, this should get you a great deal of the way there. Another consideration would be to use your own (non-PDFView subclass) view, and draw the PDF pages in there. Drawing a PDFPage into a view is fairly straightforward, but of course, creating your own PDF view is likely more work than subclassing and customizing the provided PDFView. -António --- Touch is a language without words --- ___ 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: variable problem is driving me nuts
On 28 Oct, 2012, at 12:50 , H Miersch wrote: > ok, it looks like i've sorted the original problem. but here's the next one: > > i have this line: > > for (i = 0; i++; i < count) {…} > > in the app delegate. Xcode keeps giving me this warning: expression result > unused. WTF? that is correct syntax for a for loop, isn't it? so then why do > i keep getting this warning? > also, i have confirmed that the statements between { and } are NOT executed, > no matter what. that's not right either. so WTF is going on here? for (i=0;ihttps://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Mystifying index out of bounds error
Hi, I have this code in my app: - (void)keyDown:(NSEvent *)theEvent { unichar oneChar; NSString*theChars = [theEvent charactersIgnoringModifiers]; if ( 0 == theChars.length ) { return; } oneChar = [theChars characterAtIndex:0]; … } After about 10 months of the app being available, with this method unchanged, I received a single crash report that points to a crash on the last line: -[__NSCFConstantString characterAtIndex:]: Range or index out of bounds The length property of a string returns an NSUInteger, so it should never be lower than zero. I don't see how the out of bounds error could ever happen for index 0, when the string has a length greater than 0. Any ideas? (Considering that I only ever received a single report for what is an often exercised bit of code, should I just consider this a freak incident and ignore it?) -António --- Don't believe everything you think --- ___ 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: Mystifying index out of bounds error
On 1 Nov, 2012, at 15:24 , Mike Abdullah wrote: > Well that sounds an impossible problem, but might not be. Give us the crash > report too. 12/10/2012 12:41:10: -[__NSCFConstantString characterAtIndex:]: Range or index out of bounds 12/10/2012 12:41:10: ( 0 CoreFoundation 0x7fff9354a0a6 __exceptionPreprocess + 198 1 libobjc.A.dylib 0x7fff8ba543f0 objc_exception_throw + 43 2 CoreFoundation 0x7fff93549e7c +[NSException raise:format:] + 204 3 CoreFoundation 0x7fff9350e8ee -[__NSCFString characterAtIndex:] + 94 4 PDF Nomad 0x00010380b5fe PDF Nomad + 1205758 ( -> -[ANBorderedTextView keyDown:] (in PDF Nomad) (ANBorderedTextView.m:91) ) 5 AppKit 0x7fff8a9ba120 -[NSWindow sendEvent:] + 9687 6 AppKit 0x7fff8a9b5744 -[NSApplication sendEvent:] + 5761 7 AppKit 0x7fff8a8cb2fa -[NSApplication run] + 636 8 AppKit 0x7fff8a86fcb6 NSApplicationMain + 869 9 PDF Nomad 0x0001036e6f84 PDF Nomad + 8068 ) Unfortunately, I did not receive a full crash report, so I can't show register contents. -António > On 1 Nov 2012, at 12:11, Antonio Nunes wrote: > >> Hi, >> >> I have this code in my app: >> >> - (void)keyDown:(NSEvent *)theEvent >> { >> unichar oneChar; >> NSString*theChars = [theEvent charactersIgnoringModifiers]; >> >> if ( 0 == theChars.length ) { >> return; >> } >> >> oneChar = [theChars characterAtIndex:0]; >> >> … >> } >> >> After about 10 months of the app being available, with this method >> unchanged, I received a single crash report that points to a crash on the >> last line: >> -[__NSCFConstantString characterAtIndex:]: Range or index out of bounds >> >> >> The length property of a string returns an NSUInteger, so it should never be >> lower than zero. I don't see how the out of bounds error could ever happen >> for index 0, when the string has a length greater than 0. Any ideas? >> (Considering that I only ever received a single report for what is an often >> exercised bit of code, should I just consider this a freak incident and >> ignore it?) >> >> -António >> >> --- >> Don't believe everything you think >> --- >> >> >> ___ >> >> 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/cocoadev%40mikeabdullah.net >> >> This email sent to cocoa...@mikeabdullah.net > It is better to light a candle than to curse the darkness ___ 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: Mystifying index out of bounds error
On 1 Nov, 2012, at 15:50 , Mike Abdullah wrote: > Well it all looks like your code shouldn't be able to give the above > exception. To check, there's no other calls to -characterAtIndex: in the code > you omitted? And the code you pasted is from ANBorderedTextView? No other calls to characterAtIndex: in the omitted code, which is indeed from ANBorderedTextView. Thanks for looking at this, Mike. -António ___ 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
PDFActionRemoteGoTo won't save?
Hi, I want to create, use and save PDFActionRemoteGoTo objects. Creating them, adding them to a PDFPage and using them in a PDFView works just fine. However when I save the document, the console logs a warning: "NEED TO ADD PARTIAL FILE PATH", and the action is not saved with the document. Looks to me like a bug in PDFKit, or underlying frameworks, but I want to check here if anyone has encountered this issue and knows it is definitely a bug, and/or knows a workaround. Cheers, António --- For to the bee a flower is the fountain of life, And to the flower a bee is the messenger of love --Kahlil Gibran --- ___ 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
Auto Layout, Localization and Superview Size
I'm having trouble implementing auto layout based views that appear in popups and open/save panels. Due to increased verbosity, relative to the original English, in for some localizations some views need to grow in size to fit their content. Currently, if I create a NIB in IB (Xcode 4.5), and then localize the UI elements in awakeFromNib, the parent view doesn't grow in size to auto-accommodate the larger labels and buttons it holds. How can I create an auto layout that causes the superview to grow in size to accommodate its contents? -António --- And your body is the harp of your soul. --Kahlil Gibran --- ___ 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
Window resizing autolayout?
I asked this question a little while back, but probably not in a clear or smart way. I hope I can explain what I need better this time. In the process of localising my app, i find that I need some sheets and some popovers to have different sizes, depending on the user's chosen language. Mostly, I need increased width and/or height when the language is not English. I've watched the auto layout related videos from WWDC 2012 and 2011, and am able to create layouts that, when the window is resized will limit how far it can be resized down vertically and horizontally, but what I need is for windows to be loaded from nibs and open in a size larger than the size saved in the nib when it was created, rather than resized by the user. Currently, in awakeFromNib, I adjust all user facing interface elements to the target language, and I had hoped that with wider, and sometimes higher controls, the containing sheet/popover would automatically resize to compensate for the larger dimensions. It doesn't. I find I need to calculate the new size of the container and set it manually. Is there a way to specify auto layout settings such that all this is taken care of automatically by the autlayout system? The app requires 10.7 and up, so I'd rather not use 10.8 specific enhancements to auto layout. To be explicit, lets say I have a very simple popover with a label followed by a text field: |-20-[some label]-8-[some text field]-20-| In the nib, which is laid out for the English language, the layout has a certain width: Lets say the label as laid out in the nib file has width 80 and the text field has width 120=> total width = 20+80+8+120+20 = 248 Let's say the user's system is set to French, the label now needs width 110, resulting in a total required width of 278. Ideally, controls' containers would resize from 248 to 278, after the localisation during loading of the nib, but before the sheet or popover is shown to the user. As it is, I see that the label has resized, after changing its stringValue, and the text field has moved out of the way towards the right, but since the container has not, the text field is clipped by the window's bounds. -António --- Don't believe everything you think --- ___ 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: Window resizing autolayout?
On 24 Dec, 2012, at 08:28 , Kyle Sluder wrote: > Changing the text of a label will cause it to call [self > invalidateIntrinsicContentSize], which will ensure a layout pass happens > on the next window update. > > My hunch is that NSPopover manually manages the size of its window to > match is contentSize, and it doesn't do so using constraints (or if it > does, those constraints have mandatory priority). If I set the view's frame in awakeFromNib, then the popover will show with the correct size, so it appears to be an issue with the view that contains the controls, rather than with the popover (or sheet, for that matter). -António --- For to the bee a flower is the fountain of life, And to the flower a bee is the messenger of love --Kahlil Gibran --- ___ 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: Window resizing autolayout?
On 24 Dec, 2012, at 08:25 , Quincey Morris wrote: > On Dec 23, 2012, at 22:44 , Antonio Nunes wrote: > >> Currently, in awakeFromNib, I adjust all user facing interface elements to >> the target language, and I had hoped that with wider, and sometimes higher >> controls, the containing sheet/popover would automatically resize to >> compensate for the larger dimensions. It doesn't. I find I need to calculate >> the new size of the container and set it manually. >> >> Is there a way to specify auto layout settings such that all this is taken >> care of automatically by the autlayout system? > > Have you read this: > > > https://developer.apple.com/library/mac/#releasenotes/UserExperience/RNAutomaticLayout/_index.html I had read this, but maybe not thoroughly enough. I'll take a deeper look at it, to see if I can get things working. > It seems to me that changing the UI elements in awakeFromNib probably isn't > enough, since that doesn't tell the layout system that something has changed. > Anyway, these documents try to explain the correct place to make the > adjustments (see "Core Layout Runtime"), though it might take some studying. > > It may also be that the container view *is* resizing due to the updated > layout conditions, but something else is forcibly doing a setFrame on it > shortly afterwards. Do any of the layout debugging aids (see "Debugging") > tell you what the sequence of events is in your case? If I manually set the view's frame in awakeFromNib then the popover/sheet will have the correct size. An NSLog(@"%@", [self.view constraintsAffectingLayoutForOrientation:NSLayoutConstraintOrientationHorizontal]); results in an empty list, which I find surprising. The constraints are certainly there in IB. -António A merry heart does good like medicine ___ 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: Window resizing autolayout?
On 24 Dec, 2012, at 11:22 , Antonio Nunes wrote: >> It seems to me that changing the UI elements in awakeFromNib probably isn't >> enough, since that doesn't tell the layout system that something has >> changed. Anyway, these documents try to explain the correct place to make >> the adjustments (see "Core Layout Runtime"), though it might take some >> studying. >> >> It may also be that the container view *is* resizing due to the updated >> layout conditions, but something else is forcibly doing a setFrame on it >> shortly afterwards. Do any of the layout debugging aids (see "Debugging") >> tell you what the sequence of events is in your case? > > If I manually set the view's frame in awakeFromNib then the popover/sheet > will have the correct size. > > An NSLog(@"%@", [self.view > constraintsAffectingLayoutForOrientation:NSLayoutConstraintOrientationHorizontal]); > results in an empty list, which I find surprising. The constraints are > certainly there in IB. The reason I did not find the constraints was because I was requesting them too early (before the view had been added to a window). I now managed to get the view to display correctly by calling [self.view layoutSubtreeIfNeeded] after localising the controls. -António There is nothing as strong as real gentleness, and there is nothing as gentle as real strength. ___ 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
BAse localisation and strings files compatibility with 10.7
I'm considering moving (part of) an existing project to using a base localisation, with nibs only for the base language, and strings files to localise for other languages. I can't find in the documentation whether this feature is compatible with 10.7. I think it is, but I'm not sure, and can't find any confirmation on it in Apple's docs nor generally on the web. I need this app to remain compatible with 10.7. Can I safely move to using base localisation and strings files to localise nibs? -António They deem me mad because I will not sell my days for gold; And I deem them mad because they think my days have a price. --Kahlil Gibran --- ___ 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: BAse localisation and strings files compatibility with 10.7
On 30 Dec, 2012, at 23:09 , Antonio Nunes wrote: > I'm considering moving (part of) an existing project to using a base > localisation, with nibs only for the base language, and strings files to > localise for other languages. I can't find in the documentation whether this > feature is compatible with 10.7. I think it is, but I'm not sure, and can't > find any confirmation on it in Apple's docs nor generally on the web. I need > this app to remain compatible with 10.7. Can I safely move to using base > localisation and strings files to localise nibs? To answer my own question: some hands-on testing demonstrated that an app localised this way won't even startup under Lion. SO the answer is no. -António There is nothing as strong as real gentleness, and there is nothing as gentle as real strength. ___ 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
Showing a drawer on a sheet
Hi, I have a panel that is shown as a sheet on the document window. I'm trying to show a drawer (NSDrawer) when a certain tab is selected. The drawer shows, but behind the main document window, rather than in front of it, thus being either partly or completely obscured. The drawer window level is the same as the panel's level (3), so I'm not sure why the drawer is drawn behind the main window. As an experiment I tried adjusting the drawer's parentWindow level but to no avail. Is there any way to make this work? (i.e. show the drawer in front of the main window) -António ___ 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
Find functions disabled while NSSearchField is first responder.
Hi, I have an NSSearchField, and a menu bar submenu with the standard Find items. When the search field receives some input, it performs its action and an array controller is filled with search results. Now, while the search field is the first responder, none of the Find items are enabled, so it is impossible to issue, say a Find Next command. The Find functions perform fine when just about any other item in the document window is first responder. I find that surprising, but, more importantly, I cannot find a way to get the Find functions to work, while the search command has focus. What am I missing? -António ___ 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: Find functions disabled while NSSearchField is first responder.
On 24 Apr, 2013, at 21:46 , Antonio Nunes wrote: > I have an NSSearchField, and a menu bar submenu with the standard Find items. > When the search field receives some input, it performs its action and an > array controller is filled with search results. Now, while the search field > is the first responder, none of the Find items are enabled, so it is > impossible to issue, say a Find Next command. The Find functions perform fine > when just about any other item in the document window is first responder. I > find that surprising, but, more importantly, I cannot find a way to get the > Find functions to work, while the search command has focus. What am I missing? I added a search field to a small test project, to see if it works correctly in a less complicated setup, but to no avail. The Find menu items are still disabled. Some more googling (previous queries did not yield any relevant info), showed me that this issue has bitten others before, but no solutions appear to have been put forward. I've checked the responder chain, and tried to catch calls to validateMenuItem and validateUserInterfaceItem:, to see if I can find out the point at which these items are disabled. But the break points don't even trigger. When I check the window for its first responder, when the search field is receiving input, it returns the document window, not the search field. The document window though, has its own implementation of validateMenuItem:, but that is never called. How can I find out where the validation for performFindPanelAction: fails? -António ___ 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: Find functions disabled while NSSearchField is first responder.
On 25 Apr, 2013, at 18:21 , Antonio Nunes wrote: >> I have an NSSearchField, and a menu bar submenu with the standard Find >> items. When the search field receives some input, it performs its action and >> an array controller is filled with search results. Now, while the search >> field is the first responder, none of the Find items are enabled, so it is >> impossible to issue, say a Find Next command. The Find functions perform >> fine when just about any other item in the document window is first >> responder. I find that surprising, but, more importantly, I cannot find a >> way to get the Find functions to work, while the search command has focus. >> What am I missing? > > I added a search field to a small test project, to see if it works correctly > in a less complicated setup, but to no avail. The Find menu items are still > disabled. Some more googling (previous queries did not yield any relevant > info), showed me that this issue has bitten others before, but no solutions > appear to have been put forward. > > I've checked the responder chain, and tried to catch calls to > validateMenuItem and validateUserInterfaceItem:, to see if I can find out the > point at which these items are disabled. But the break points don't even > trigger. When I check the window for its first responder, when the search > field is receiving input, it returns the document window, not the search > field. The document window though, has its own implementation of > validateMenuItem:, but that is never called. > > How can I find out where the validation for performFindPanelAction: fails? Finally managed to solve this, and this is how I did it: (doesn't feel clean or proper, but it works. If anyone knows of a better way to do this, I'm all ears.) - In my NSDocument subclass, return a custom object (NSTextView subclass) for the NSFieldEditor when the search field is activated: - (id)windowWillReturnFieldEditor:(NSWindow *)sender toObject:(id)client { static NMD_SearchTextView *searchFieldEditor; if ( client == self.searchField ) { if ( nil == searchFieldEditor ) { searchFieldEditor = [[NMD_SearchTextView alloc] initWithFrame:NSZeroRect]; searchFieldEditor.document = self; // The object has a document property to point to the NSDocument object, since we'll need that later. } return searchFieldEditor; } return nil; } - Implement validateMenuItem: on the subclass to enable the relevant menu items. - (BOOL)validateMenuItem:(NSMenuItem *)menuItem { if ( menuItem.action == @selector(performFindPanelAction:)) { return menuItem.tag != NSFindPanelActionSetFindString; // No use allowing "Use Selection for Find", since it will always be equal to the current find string, where it exists. } else { return [super validateMenuItem:menuItem]; } } - Implement performFindPanelAction: to forward the action to the document. - (void)performFindPanelAction:(id)sender { [self.document performFindPanelAction:sender]; } - António ___ 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: Find functions disabled while NSSearchField is first responder.
On 27 Apr, 2013, at 08:04 , Antonio Nunes wrote: > On 25 Apr, 2013, at 18:21 , Antonio Nunes wrote: > >>> I have an NSSearchField, and a menu bar submenu with the standard Find >>> items. When the search field receives some input, it performs its action >>> and an array controller is filled with search results. Now, while the >>> search field is the first responder, none of the Find items are enabled, so >>> it is impossible to issue, say a Find Next command. The Find functions >>> perform fine when just about any other item in the document window is first >>> responder. I find that surprising, but, more importantly, I cannot find a >>> way to get the Find functions to work, while the search command has focus. >>> What am I missing? >> >> I added a search field to a small test project, to see if it works correctly >> in a less complicated setup, but to no avail. The Find menu items are still >> disabled. Some more googling (previous queries did not yield any relevant >> info), showed me that this issue has bitten others before, but no solutions >> appear to have been put forward. >> >> I've checked the responder chain, and tried to catch calls to >> validateMenuItem and validateUserInterfaceItem:, to see if I can find out >> the point at which these items are disabled. But the break points don't even >> trigger. When I check the window for its first responder, when the search >> field is receiving input, it returns the document window, not the search >> field. The document window though, has its own implementation of >> validateMenuItem:, but that is never called. >> >> How can I find out where the validation for performFindPanelAction: fails? > > Finally managed to solve this, and this is how I did it: (doesn't feel clean > or proper, but it works. If anyone knows of a better way to do this, I'm all > ears.) > > - In my NSDocument subclass, return a custom object (NSTextView subclass) for > the NSFieldEditor when the search field is activated: > > - (id)windowWillReturnFieldEditor:(NSWindow *)sender toObject:(id)client > { >static NMD_SearchTextView *searchFieldEditor; > >if ( client == self.searchField ) { >if ( nil == searchFieldEditor ) { >searchFieldEditor = [[NMD_SearchTextView alloc] > initWithFrame:NSZeroRect]; >searchFieldEditor.document = self; // The object has a document > property to point to the NSDocument object, since we'll need that later. >} >return searchFieldEditor; >} >return nil; > } Oh dear, as someone pointed out off-list, there's a bug here: the document is only assigned once, when the searchFieldEditor variable is set the first time. The document should be assigned on every call: if ( client == self.searchField ) { if ( nil == searchFieldEditor ) { searchFieldEditor = [[NMD_SearchTextView alloc] initWithFrame:NSZeroRect]; } searchFieldEditor.document = self; // The object has a document property to point to the NSDocument object, since we'll need that later. return searchFieldEditor; } return nil; } > - Implement validateMenuItem: on the subclass to enable the relevant menu > items. > > - (BOOL)validateMenuItem:(NSMenuItem *)menuItem > { >if ( menuItem.action == @selector(performFindPanelAction:)) { >return menuItem.tag != NSFindPanelActionSetFindString; // No use > allowing "Use Selection for Find", since it will always be equal to the > current find string, where it exists. >} else { >return [super validateMenuItem:menuItem]; >} > } > > - Implement performFindPanelAction: to forward the action to the document. > > - (void)performFindPanelAction:(id)sender > { >[self.document performFindPanelAction:sender]; > } ___ 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