Re: NSArrayController design/usage question
On Sep 6, 2009, at 10:00 AM, Steven Degutis wrote: For instance, if you have 2 genuine properties on your Person entity called firstName and lastName then you can create a fullName property on your Person class, and when firstName or lastName change, call -willChangeValueForKey: and -didChangeValueForKey: on fullName and then have your -fullName method return a concatenation of the first and last names. This is at best misleading. In this situation, you should typically not invoke the change notification methods yourself; instead, you should set up dependent keys as described in http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/KeyValueObserving/Concepts/DependentKeys.html#//apple_ref/doc/uid/20002179-BAJEAIEE mmalc ___ 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
atanch...@live.com
Hello, I just want to ask, how can I access/add in my app (if possible) the Favorites list on the iPhone Phone app? I saw an application that has synchronized Favorites list with theiPhone Phone app. Is it possible to access the Favorites list and be able to modify the list? Thanks in advance! Regards,Angie _ More than messages–check out the rest of the Windows Live™. http://www.microsoft.com/windows/windowslive/___ 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
Meta Package in 10.5 to support 10.3 problem
Hello, I am building a meta package on 10.5 that supports 10.3 (Install Properties). I have two packages as: 1. Package 1: works on 10.6 onwards: (Gestalt sysv = 0x01060) 2. Package 2: works on 10.3, 10.4 and 10.5 (Gestalt sysv 0x01060) Both the packages work fine independently. I have checked system version with Gestalt as shown above in the requirements section for individual addition. The meta-package installs desired files on 10.4, 10.5 and 10.6. Thus Gestalt check works fine on 10.4, 10.5 and 10.6. But on Panther (10.3) when I try to install this meta-package, both the packages are read one by one. Package-2 passes the check and shows the installation screen. But immediately the screen shows ³Package-1 can not be installed on this computer² message. Thus ending with only ³close² button left to select. Changing the sequence of packages addition has no effect on this result. Does anyone has seen such problem before? Please suggest me how should I proceed with the package maker. -- Thanks and Regards, Sparta... ___ 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
NSPDFImageRep Memory Leak?
Hi all, I'm trying to rasterize a PDF document using PDFKit, but it seems NSPDFImageRep has a terrible memory leak, which crashes my whole application. This is the simple test code I used: for (int i = 0; i [pdfDoc pageCount]; i++) { NSLog(@Processing page %d/%d, i, [pdfDoc pageCount]); NSAutoreleasePool *localPool = [[NSAutoreleasePool alloc] init]; PDFPage *page = [pdfDoc pageAtIndex:i]; NSRect mb = [page boundsForBox:kPDFDisplayBoxMediaBox]; NSRect cb = CalcCropBox(mb, 40, 60, 18, 18); [page setBounds:cb forBox:kPDFDisplayBoxMediaBox]; NSPDFImageRep *pdfImgRep = [[NSPDFImageRep alloc] initWithData:[page dataRepresentation]]; [pdfImgRep release]; [localPool drain]; } In the code, pdfDoc is a preloaded PDFDocument object. As seen from above, I've released everything allocated, but in Instruments, this app keeps on consuming memory. So is this a bug in PDFKit? Or I'm not supposed to use it in this way? Thanks. Regards Dairyknight ___ 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: Meta Package in 10.5 to support 10.3 problem
On 08/09/2009, at 9:17 PM, Sparta wrote: I am building a meta package on 10.5 that supports 10.3 (Install Properties). This is the wrong list. You want Installer-dev: http://lists.apple.com/mailman/listinfo/installer-dev -- Rob Keniger ___ 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: atanch...@live.com
Mind if I ask what is the app that you saw doing this? Luke On Sep 8, 2009, at 3:44 AM, Angelica Grace Tanchico wrote: Hello, I just want to ask, how can I access/add in my app (if possible) the Favorites list on the iPhone Phone app? I saw an application that has synchronized Favorites list with theiPhone Phone app. Is it possible to access the Favorites list and be able to modify the list? Thanks in advance! Regards,Angie _ More than messages–check out the rest of the Windows Live™. http://www.microsoft.com/windows/windowslive/___ 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/luketheh%40apple.com This email sent to luket...@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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Application main menu title behavior change in 10.6
On Fri, Sep 4, 2009 at 9:03 PM, Peter Ammonpam...@apple.com wrote: Hi Jim, First let me thank you for checking the release notes. However, that particular issue is unrelated, confusingly enough. Here's what's going on. The first menu item in the main menu (or more precisely, its submenu) is magic, in that when it becomes the first item, its title is ignored and instead the application name is used. This is why you do not have to update your MainMenu.nib every time you change your application name. In Leopard, there was a bug that caused this to be applied inconsistently. It sounds like your application was benefiting from this bug. You can change the title of the application menu, after you set the main menu, like so: NSApp mainMenu] itemAtIndex:0] submenu] setTitle:@New Title] Hope this helps, -Peter Indeed it does help, Peter. I now see why I was so confused with the behavior I was encountering when I tried setTitle: initially. setTitle: does its business only if the new title is different than the current title. We are building a new main menu with the new application's name already in place. Doing the following sets the menu's title correctly when the title is already set to New Title: NSApp mainMenu] itemAtIndex:0] submenu] setTitle:@] NSApp mainMenu] itemAtIndex:0] submenu] setTitle:@New Title] Always appreciative of the help, Peter. Thanks! -- Jim ___ 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: atanch...@live.com
That's not the iTunes store app right, the pipe game called Siphone, it's something unauthorized? I don't know of an official API which lets you do what you want and a documentation search didn't throw one up. You may not be able to do that with the released APIs (if you can I'd love to know how too). On 08-Sep-2009, at 10:29 PM, Angelica Grace Tanchico wrote: The application is Siphon Angie Mind if I ask what is the app that you saw doing this? Luke On Sep 8, 2009, at 3:44 AM, Angelica Grace Tanchico wrote: Hello, I just want to ask, how can I access/add in my app (if possible) the Favorites list on the iPhone Phone app? I saw an application that has synchronized Favorites list with theiPhone Phone app. Is it possible to access the Favorites list and be able to modify the list? Thanks in advance! Regards,Angie _ With Windows Live, you can organize, edit, and share your photos. http://www.microsoft.com/middleeast/windows/windowslive/products/photo-gallery-edit.aspx___ 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/rols%40rols.org This email sent to r...@rols.org ___ 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: KVO on Distributed Objects with exception handling.
I've just tested it on Snow Leopard (10a380), and it works as expected. Do you happen to remember the technical reasons why KVO on DOs would fail? Ed On Mon, Sep 7, 2009 at 11:55 PM, Scott Anguishsc...@cocoadoc.com wrote: In spite of the fact that it might be working, it isn't supported. When I talked to engineering about this, this is what I was told. He was a bit shocked it worked at all, and it isn't tested as part of releases. On Sep 7, 2009, at 3:02 PM, Edward Chan wrote: Hello, I'm using KVO on a Distributed Object, and I am binding my UI controls based on the observer. For example: MonkeyViewController.isEatingABanana - Binded to a UI checkbox. MonkeyViewController.m: @propery (readwrite, assign) BOOL isEatingABanana; -(id)init { ... [MonkeyBrainDOObject addObserver:self forKeyPath:@banana options:(NSKeyValueObservingOptionNew | NSKeyValueObservingOptionOld) context:NULL]; ... } - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context { if ([keyPath isEqualToString:@banana]) { [self willChangeValueForKey:@isEatingABanana]; isEatingABanana = [change objectForKey:NSKeyValueChangeNewKey] boolValue]; [self didChangeValueForKey:@isEatingABanana]; } } - (void)setIsEatingABanana:(BOOL)flag { [MonkeyBrainDOObject setBanana:flag]; isEatingABanana = flag; } This indeed works, and we save some hassles of sending NSNotifications and such. So, what I'm wondering is if the following code is sufficient enough for the IPC exception handling? Instead of having to manually write @try/@catch wherever I doing some IPC, I create a wrapper object around the DO to handle the exceptions. This wrapper class is simply an NSObject, and will call the methods methodSignatureForSelector, and forwardInvocation when I try to use MonkeyBrainDOObject methods (since the wrapper does not understand them). I can then insert a @try/@catch when I forward the invokations to the actual DO object. MonkeyBrainWrapper.m : NSObject - (NSMethodSignature *)methodSignatureForSelector:(SEL)selector { return [MonkeyBrainDOObject methodSignatureForSelector:selector]; // maybe I can use extra code to make sure MonkeyBrainDOObject responds to the selector. } - (void)forwardInvocation:(NSInvocation *)invocation { �...@try { [invocation invokeWithTarget:MonkeyBrainDOObject]; } @catch (NSException *e) { // Oh no! some went wrong with the IPC. But it's ok, I caught you.. :P } } So, instead of calling directly on the MonkeyBrainDOObject in my MonkeyViewController, I would now call my MonkeyBrainWrapper object, which has explicit exception handling rather than the one handle by the NSApplication. Should that be enough for exception handling on both ends of the IPC? Or do I need some explicit exception handling on the other end? It seems when I tested it out, my other end never threw anything when the connection broke. Also, is there maybe a better approach to all of this? My old code had a bunch of NSNotifications being sent/received whenever something needed updating on the UI, and I found this approach to be a lot cleaner. Edward ___ 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/scott%40cocoadoc.com This email sent to sc...@cocoadoc.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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
[iPhone] : How to customize Phonepad ?
Hi All, I am looking for a way to customize the Phonepad provided by the iPhone for my application use. Here is the list I am interested in : ___ 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: [iPhone] : How to customize Phonepad ?
Then I would say you have very little to do ;) On Tue, Sep 8, 2009 at 10:34 AM, Dan Ribe dan.r...@gmail.com wrote: Hi All, I am looking for a way to customize the Phonepad provided by the iPhone for my application use. Here is the list I am interested in : ___ 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/edolecki%40gmail.com This email sent to edole...@gmail.com -- http://ericd.net Interactive design and development ___ 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: NSPDFImageRep Memory Leak?
On Sep 8, 2009, at 5:08 AM, DairyKnight wrote: In the code, pdfDoc is a preloaded PDFDocument object. As seen from above, I've released everything allocated, but in Instruments, this app keeps on consuming memory. I can't find anything wrong with your code. Have you tried checking for leaks? I'm not sure how to do it with Instruments; I generally use the old-fashioned leaks command (man 1 leaks). Turn on the environment variable MallocStackLogging in your app to get backtraces in the output. —Jens___ 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: atanch...@live.com
OK. Thanks for the response Jeff. I appreciate it :) Angie Subject: Re: atanch...@live.com From: jeff.schill...@gmail.com Date: Tue, 8 Sep 2009 10:39:53 -0400 CC: cocoa-dev@lists.apple.com To: atanch...@live.com Siphon (the SIP/VoiP app, not the game) http://code.google.com/p/ siphon/ can be run as a developer installed app. My previous answer that there is no approved way to get favorites from the Phone app stands. The favorites in the phone app are sandboxed and no other app can access that data -jeff On Sep 8, 2009, at 10:29 AM, Angelica Grace Tanchico wrote: The application is Siphon Angie Mind if I ask what is the app that you saw doing this? Luke On Sep 8, 2009, at 3:44 AM, Angelica Grace Tanchico wrote: Hello, I just want to ask, how can I access/add in my app (if possible) the Favorites list on the iPhone Phone app? I saw an application that has synchronized Favorites list with theiPhone Phone app. Is it possible to access the Favorites list and be able to modify the list? Thanks in advance! Regards,Angie _ With Windows Live, you can organize, edit, and share your photos. http://www.microsoft.com/middleeast/windows/windowslive/products/photo-gallery-edit.aspx___ 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/jeff.schilling%40gmail.com This email sent to jeff.schill...@gmail.com _ With Windows Live, you can organize, edit, and share your photos. http://www.microsoft.com/middleeast/windows/windowslive/products/photo-gallery-edit.aspx___ 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] : How to customize Phonepad ?
Sorry for my last mail ... It got sent while I was typing ! Hi All, I am looking for a way to customize the Phonepad provided by the iPhone for my application use. Here is the list I am interested in : - Want to show it at the middle of the screen. - Want to change caption of the button to Call. - Want to change the color/size of the Phonepad. - Also want to customize the keys which will be available to the users (hide special characters other than '+' '#'). Can anyone give me some pointers on this. Any help on this is highly appreciated. Cheers ! -Dan ___ 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: Crash on SL in com.apple.DesktopServices after using NSOpenPanel
On Sep 7, 2009, at 5:25 AM, Markus Spoettl wrote: On Sep 7, 2009, at 1:31 PM, Thomas Clement wrote: Looks like an Apple bug. http://kb2.adobe.com/cps/506/cpsid_50654.html That doesn't seem to be the problem with that user's machine as the files are local. It is more than likely that it is the same problem. Please report bugs like this using bugreporter.apple.com -- especially when you believe the problem may be in a system framework. Thanks! corbin ___ 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: atanch...@live.com
The application is Siphon Angie Mind if I ask what is the app that you saw doing this? Luke On Sep 8, 2009, at 3:44 AM, Angelica Grace Tanchico wrote: Hello, I just want to ask, how can I access/add in my app (if possible) the Favorites list on the iPhone Phone app? I saw an application that has synchronized Favorites list with theiPhone Phone app. Is it possible to access the Favorites list and be able to modify the list? Thanks in advance! Regards,Angie _ With Windows Live, you can organize, edit, and share your photos. http://www.microsoft.com/middleeast/windows/windowslive/products/photo-gallery-edit.aspx___ 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
[MEET] Chicago CocoaHeads Tuesday Sept. 8
The Chicago CocoaHeads / Chicago Cocoa and WebObjects User Group is holding our next meeting Tuesday, September 8th, at 7:00 PM at the Apple Store on Michigan Ave. Agenda: - Book Report - What's new in Snow Leopard Under the Covers - adjournment to O'Toole's When: Tuesday, September 8th, 7:00 PM Where: Apple Store Michigan Avenue 679 North Michigan Ave. (at the corner of Huron Michigan Ave.) Chicago, IL 60611 http://tinyurl.com/Michigan-Ave-Apple-Store (Google Maps URL) - Bob Tonight I will talk about new technologies in Snow Leopard and Snow Leopard Server. - O'Tooles We will continue our discussions at our local watering hold Timothy O'Toole's at 622 Fairbanks (2 blocks east of the store). We also wish to thank the folks who run the theater space at the Apple store for letting us have our meetings there, and Jonathan 'Wolf' Rentzsch for helping out so often. Thanks all. Also, if you are working on a project and would like to talk about it briefly / promote it, I think it would be fun for people to hear about other people's projects. Please email me off line and you can talk at a future meeting or would like a book to review we would welcome that too. Future meetings dates and tentative topics: 10/13/09, 11/10/09 CAWUG Resources Mail list: http://groups.google.com/group/cawug Google Site: http://groups.google.com/group/cawug RSS feed: http://groups.google.com/group/cawug/feed/atom_v1_0_msgs.xml http://ical.mac.com/chicagobob/Chicago-CocoaHeads-CAWUG webcal://ical.mac.com/chicagobob/Chicago-CocoaHeads-CAWUG.ics Cocoa Heads web site: http://cocoaheads.org/us/ChicagoIllinois/index.html Hope to see you at the meeting. -Bob ___ 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: [iPhone] : How to customize Phonepad ?
You can't customize the phone pad, which is really just an instance of a keyboard. For the stuff you want to do, you should write your own custom view that behaves as you desire. Luke On Sep 8, 2009, at 7:48 AM, Dan Ribe wrote: Sorry for my last mail ... It got sent while I was typing ! Hi All, I am looking for a way to customize the Phonepad provided by the iPhone for my application use. Here is the list I am interested in : - Want to show it at the middle of the screen. - Want to change caption of the button to Call. - Want to change the color/size of the Phonepad. - Also want to customize the keys which will be available to the users (hide special characters other than '+' '#'). Can anyone give me some pointers on this. Any help on this is highly appreciated. Cheers ! -Dan ___ 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/luketheh%40apple.com This email sent to luket...@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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Strangest UITable bug
I should have posted the code sorry. I deleted all the code out of the app for table view delegation. I then pasted it back in one method at a time (except for the required ones) and compiled then ran the app and now it works. I have no idea why that fixed it but it did. On Sep 7, 2009, at 6:41 PM, Hank Heijink (Mailinglists) wrote: Do you want help guessing or help solving? If you're after the latter, you should post your code. Hank On Sep 7, 2009, at 9:10 PM, Development wrote: Ok I have the weirdest UITableViewBug.. I've set up the delegate, datasource, etc. My data appears correctly in the table. HOWEVER, when I click the table once, it ignores the first click. Then, if I click it again on a different cell, it shows that I clicked the previous cell. In fact each subsequent touch shows that I clicked the cell just previous to it. I have no clue how I managed to screw up a tableview like this but does any one have any idea how I might have done this? ___ 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/hank.list%40runbox.com This email sent to hank.l...@runbox.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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
NSTextView resizeability and scrolling
Hi all, I am trying to make a user interface in which there is a view that contains multiple subviews, one of which is an NSTextView. The parent view should be embedded in an NSScrollView. The idea is that when the NSTextView is typed in, and possibly resizes as a consequence, it's parent view should resize, scroll bars should appear etc. The effect would be similar to what you get in address book when typing in the notes field. If the notes field gets too big, you get to scroll all of the contact info, not only the view. Googling indicates however that this is done differently, I am not searching for a way to imitate this exact behavior, just using it as an example of what I want to achieve visually. I've googled for a solution, found nothing. I tried making it by observing the NSViewFrameChangedNotification of the NSTextView from it's parent, and resizing, but this is more tricky then I imagined. As as side question, it seems that an NSTextView has some margins that separate the text from it's outer edges. This makes sense when the NSTextView is in an NSScrollView, but makes it difficult to align the text view when it is not. I can't find any documented API on controlling this. Is it possible? Perhaps I am going about this the wrong way. I am open to suggestions on how to accomplish this some other way. TIA, F ___ 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
Sheets positioning.
Hello I have a new file dialog that pops up as a sheet, hwoever on the first popup of this sheet, Its not positioned below the titlebar http://i29.tinypic.com/2k287p.jpg But if I hit cancel, and then open the dialog again, Its perfect. http://i27.tinypic.com/e9uurl.jpg Any idea what Im doing wrong? Heres the code that initiates the sheet. Its loaded in from a xib - (IBAction)add:sender { if (myWindow == nil) { NSBundle *myBundle = [NSBundle bundleForClass:[self class]]; NSNib *nib = [[NSNib alloc] initWithNibNamed:@addFile bundle:myBundle]; BOOL success = [nib instantiateNibWithOwner:self topLevelObjects:nil]; [nib release]; if (success != YES) { // should present error return; } } [[self titleField] setStringValue:@]; [[self pathField] setStringValue:@]; [NSApp beginSheet:myWindow modalForWindow:documentWindow modalDelegate:self didEndSelector:@selector (newObjectSheetDidEnd:returnCode:contextInfo:) contextInfo:NULL]; } ___ 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: Anti-aliasing in Snow Leopard (10.6) PDFView
If you haven't gotten a response the first time, don't resend your message without checking cocoabuilder.com and lists.apple.com to make sure it went through. If you don't see it there, then fire away. --Kyle Sluder ___ 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: NSImage with multiple representation sizes
On Tue, Sep 8, 2009 at 10:30 AM, Benjamin Rister bdris...@gmail.com wrote: Hi Ken, Thanks for your response. The size of an image is the default size of the rect in which it's drawn when the person drawing it doesn't have any more specific information. That's a concept that there can only be one of for the entire image, so it's confusing if the -size for contained reps doesn't match that of the image itself. I'm not concerned/confused about the results of -[NSImage size], I know it'll draw wherever I ask it to in whatever space that is. The -size is unrelated to the number of pixels in a rep. The ratio determines resolution. Reps can definitely have different numbers of pixels. The issue/question comes from tiffutil's explicit warning that NSImage doesn't like it or may be confused if the net sizes of the different representations in the tiff are different. So the reps can have different numbers of pixels, but if the dpi is the same across the different reps, they have different real sizes, and man tiffutil says that that is a problem. So it's perfectly fine to pack in different representations with different numbers of pixels. What the docs encourage is setting the metadata so that the -size of each representation is the same. man tiffutil says that NSImage may not be able to successfully choose the right size image out of the generated TIFF file. That sounds much stronger to me than encouraging it so that -size isn't potentially confusing to a programmer calling it. I'm not questioning whether what you say about the frameworks is true, just making sure we're on the same page, because you said the doc says one thing and that's not what I read in it. =) So to be clear: if I create a TIFF image, with tiffutil -cat, that has 9x...@72dpi, 16x1...@72dpi, 32x3...@72dpi: - This is an entirely supported configuration, despite what man tiffutil says and the warning it generates. No, these reps would not have the same -size. If you set the DPI metadata for the reps to 72, 128, and 256 respectively, then each rep would have -size 9x9. This is what I meant above. It's fine to have different pixel sizes, but it's best to set the metadata so that the -size is consistent. - NSImage will correctly choose and draw representations now and in the future when drawn at different sizes, and both at 1.0 and non-1.0 scale factors. For instance, it will use the 32x3...@72dpi rep to fill a 16x16pt space at scale 2.0, even though the 16x1...@72dpi is the one that matches the physical size, despite the NSImage docs only giving rules based on color space, dpi, and bit depth for choosing representations. Is this correct, and something I can safely rely upon? Thanks, Benjamin Rister ___ 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
Continuous NSTextField not updating bound value continuously?
Hi, I have a text field (two, actually) bound to a string value in a controller object, and I'd like to validate the value on each keystroke so that I can enable other controls appropriately depending on the content of the field. The text fields are set to continuous updating in IB, and I have confirmed this by checking the fields' isContinuous in the code. However, the bound value is not updated on every keystroke, but only when the field loses key status. The only thing that I can think is different between this case and most other uses is that the window is application modal, but I can't think of why that would affect continuous updating. Any thoughts of something else I might be missing? TIA, Doug K; ___ 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: NSImage with multiple representation sizes
Hi Ken, Thanks for your response. The size of an image is the default size of the rect in which it's drawn when the person drawing it doesn't have any more specific information. That's a concept that there can only be one of for the entire image, so it's confusing if the -size for contained reps doesn't match that of the image itself. I'm not concerned/confused about the results of -[NSImage size], I know it'll draw wherever I ask it to in whatever space that is. The -size is unrelated to the number of pixels in a rep. The ratio determines resolution. Reps can definitely have different numbers of pixels. The issue/question comes from tiffutil's explicit warning that NSImage doesn't like it or may be confused if the net sizes of the different representations in the tiff are different. So the reps can have different numbers of pixels, but if the dpi is the same across the different reps, they have different real sizes, and man tiffutil says that that is a problem. So it's perfectly fine to pack in different representations with different numbers of pixels. What the docs encourage is setting the metadata so that the -size of each representation is the same. man tiffutil says that NSImage may not be able to successfully choose the right size image out of the generated TIFF file. That sounds much stronger to me than encouraging it so that -size isn't potentially confusing to a programmer calling it. I'm not questioning whether what you say about the frameworks is true, just making sure we're on the same page, because you said the doc says one thing and that's not what I read in it. =) So to be clear: if I create a TIFF image, with tiffutil -cat, that has 9x...@72dpi, 16x1...@72dpi, 32x3...@72dpi: - This is an entirely supported configuration, despite what man tiffutil says and the warning it generates. - NSImage will correctly choose and draw representations now and in the future when drawn at different sizes, and both at 1.0 and non-1.0 scale factors. For instance, it will use the 32x3...@72dpi rep to fill a 16x16pt space at scale 2.0, even though the 16x1...@72dpi is the one that matches the physical size, despite the NSImage docs only giving rules based on color space, dpi, and bit depth for choosing representations. Is this correct, and something I can safely rely upon? Thanks, Benjamin Rister ___ 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: KVO on Distributed Objects with exception handling.
On Sep 8, 2009, at 10:38 AM, Edward Chan wrote: I've just tested it on Snow Leopard (10a380), and it works as expected. Perhaps. But as I said, unsupported, untested internally, and could break at any time. Do you happen to remember the technical reasons why KVO on DOs would fail? None given, other than the above. Ed On Mon, Sep 7, 2009 at 11:55 PM, Scott Anguishsc...@cocoadoc.com wrote: In spite of the fact that it might be working, it isn't supported. When I talked to engineering about this, this is what I was told. He was a bit shocked it worked at all, and it isn't tested as part of releases. On Sep 7, 2009, at 3:02 PM, Edward Chan wrote: Hello, I'm using KVO on a Distributed Object, and I am binding my UI controls based on the observer. For example: MonkeyViewController.isEatingABanana - Binded to a UI checkbox. MonkeyViewController.m: @propery (readwrite, assign) BOOL isEatingABanana; -(id)init { ... [MonkeyBrainDOObject addObserver:self forKeyPath:@banana options:(NSKeyValueObservingOptionNew | NSKeyValueObservingOptionOld) context:NULL]; ... } - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context { if ([keyPath isEqualToString:@banana]) { [self willChangeValueForKey:@isEatingABanana]; isEatingABanana = [change objectForKey:NSKeyValueChangeNewKey] boolValue]; [self didChangeValueForKey:@isEatingABanana]; } } - (void)setIsEatingABanana:(BOOL)flag { [MonkeyBrainDOObject setBanana:flag]; isEatingABanana = flag; } This indeed works, and we save some hassles of sending NSNotifications and such. So, what I'm wondering is if the following code is sufficient enough for the IPC exception handling? Instead of having to manually write @try/@catch wherever I doing some IPC, I create a wrapper object around the DO to handle the exceptions. This wrapper class is simply an NSObject, and will call the methods methodSignatureForSelector, and forwardInvocation when I try to use MonkeyBrainDOObject methods (since the wrapper does not understand them). I can then insert a @try/@catch when I forward the invokations to the actual DO object. MonkeyBrainWrapper.m : NSObject - (NSMethodSignature *)methodSignatureForSelector:(SEL)selector { return [MonkeyBrainDOObject methodSignatureForSelector:selector]; // maybe I can use extra code to make sure MonkeyBrainDOObject responds to the selector. } - (void)forwardInvocation:(NSInvocation *)invocation { @try { [invocation invokeWithTarget:MonkeyBrainDOObject]; } @catch (NSException *e) { // Oh no! some went wrong with the IPC. But it's ok, I caught you.. :P } } So, instead of calling directly on the MonkeyBrainDOObject in my MonkeyViewController, I would now call my MonkeyBrainWrapper object, which has explicit exception handling rather than the one handle by the NSApplication. Should that be enough for exception handling on both ends of the IPC? Or do I need some explicit exception handling on the other end? It seems when I tested it out, my other end never threw anything when the connection broke. Also, is there maybe a better approach to all of this? My old code had a bunch of NSNotifications being sent/received whenever something needed updating on the UI, and I found this approach to be a lot cleaner. Edward ___ 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/scott %40cocoadoc.com This email sent to sc...@cocoadoc.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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Sheets positioning.
On Sep 8, 2009, at 12:53 PM, Brent Smith wrote: Hello I have a new file dialog that pops up as a sheet, hwoever on the first popup of this sheet, Its not positioned below the titlebar http://i29.tinypic.com/2k287p.jpg But if I hit cancel, and then open the dialog again, Its perfect. http://i27.tinypic.com/e9uurl.jpg Any idea what Im doing wrong? You very likely have the Visible at Launch property of your sheet window turned on. Turn this property off in the nib and it should show at the correct location the first time. Jason smime.p7s Description: S/MIME cryptographic signature ___ 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: NSPDFImageRep Memory Leak?
On Sep 8, 2009, at 5:08 AM, DairyKnight wrote: NSPDFImageRep *pdfImgRep = [[NSPDFImageRep alloc] initWithData:[page dataRepresentation]]; Check [page dataRepresentation] above. Pre-SnowLeopard the NSData returned was not autoreleased and so needed to be released by the caller. This was not consistent with other AppKit -[xxx dataRepresentation] calls. In SnowLeopard, -[PDDPage dataRepresentation] is properly auto- released. SnowLeopard PDF Kit though checks the compiler and continues the non-auto-prelease behavior for apps compiled before SnowLeopard. The above applies to -[PDFDocument dataRepresentation] as well. Check the PDFXxx headers, the behavior change is documented there. John Calhoun—___ 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: Continuous NSTextField not updating bound value continuously?
On Sep 8, 2009, at 1:05 PM, Doug Knowles wrote: Hi, I have a text field (two, actually) bound to a string value in a controller object, and I'd like to validate the value on each keystroke so that I can enable other controls appropriately depending on the content of the field. The text fields are set to continuous updating in IB, and I have confirmed this by checking the fields' isContinuous in the code. However, the bound value is not updated on every keystroke, but only when the field loses key status. The only thing that I can think is different between this case and most other uses is that the window is application modal, but I can't think of why that would affect continuous updating. Any thoughts of something else I might be missing? It sounds like you've set the Continuous property of the text field. When using bindings, you need to set the Continuously Updates Value property of the binding in order to get the effect you're looking for. Can you verify that you've set the property on the binding and not just the text field? Jason smime.p7s Description: S/MIME cryptographic signature ___ 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: Anti-aliasing in Snow Leopard (10.6) PDFView
On Sep 7, 2009, at 3:50 PM, Duncan McGregor wrote: It used to be that PDFView anti-aliased nicely. Now it doesn't, at least not for some files. Text and scans rendered in both the PDKKitViewer and PDFLinker2 samples are horrible in 10.6. Can you point to a specific PDF that shows this behavior? John Calhoun—___ 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: Sheets positioning.
Ahh, the visible at launch was the issue. Thanks! On Sep 8, 2009, at 11:07 AM, Jason Foreman wrote: On Sep 8, 2009, at 12:53 PM, Brent Smith wrote: Hello I have a new file dialog that pops up as a sheet, hwoever on the first popup of this sheet, Its not positioned below the titlebar http://i29.tinypic.com/2k287p.jpg But if I hit cancel, and then open the dialog again, Its perfect. http://i27.tinypic.com/e9uurl.jpg Any idea what Im doing wrong? You very likely have the Visible at Launch property of your sheet window turned on. Turn this property off in the nib and it should show at the correct location the first time. Jason ___ 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/liarepmi%40hack3r.com This email sent to liare...@hack3r.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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Continuous NSTextField not updating bound value continuously?
Sigh. I so should have known. That's it. Many thanks for the quick reply, and for your time. On Tue, Sep 8, 2009 at 2:18 PM, Jason Foreman ja...@threeve.org wrote: It sounds like you've set the Continuous property of the text field. When using bindings, you need to set the Continuously Updates Value property of the binding in order to get the effect you're looking for. Can you verify that you've set the property on the binding and not just the text field? Jason ___ 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/knowles.doug%40gmail.com This email sent to knowles.d...@gmail.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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: NSImage with multiple representation sizes
So to be clear: if I create a TIFF image, with tiffutil -cat, that has 9x...@72dpi, 16x1...@72dpi, 32x3...@72dpi: - This is an entirely supported configuration, despite what man tiffutil says and the warning it generates. No, these reps would not have the same -size. If you set the DPI metadata for the reps to 72, 128, and 256 respectively, then each rep would have -size 9x9. This is what I meant above. It's fine to have different pixel sizes, but it's best to set the metadata so that the -size is consistent. Okay, take 2 then. If I do the same thing, with 9x...@72dpi, 16x1...@128dpi, and 32x3...@256dpi (so the tiffutil warning isn't applicable anymore), will NSImage correctly use the more detailed image when drawing into a 16x16pt space? As I mentioned, Cocoa Drawing Guide Images How an Image Representation Is Chosen gives rules to be applied in the order of color space, dpi, bit depth. All have the same color space, the 9x...@72dpi matches dpi (when at 1.0 scale factor) and the others don't, so according to the docs it's the one that would be chosen, with poor results. Best, Benjamin Rister ___ 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
NSURLDownload delegate methods seperate thread
Hey, Is anyone aware of a way to receive NSURLDownload's delegate methods on a separate thread, i.e. not the main one? I am using an NSOperationQueue to manage them but at the moment I need to use the performSelectorOnMainThread method to get it too work. The problem with this is that it drives the kernel task crazy reaching about 30% of CPU cycles. Curiously this has only happened since upgrading to SL, when NSOperationQueue changed behaviour (not that I am dissing it, GCD rocks!) ThanksColin _ With Windows Live, you can organize, edit, and share your photos. http://www.microsoft.com/ireland/windows/windowslive/products/photo-gallery-edit.aspx___ 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: Anti-aliasing in Snow Leopard (10.6) PDFView
Oops! Didn't realize you had not reposted, but instead posted it elsewhere! Gmail did not indicate this. Sorry. --Kyle Sluder ___ 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: NSURLDownload delegate methods seperate thread
On Sep 8, 2009, at 1:03 PM, Colin Deasy wrote: Hey, Is anyone aware of a way to receive NSURLDownload's delegate methods on a separate thread, i.e. not the main one? Delegate messages will be sent on the thread which calls this method. So, start your NSURLDownload on whichever thread you want the delegate methods to be called on. ___ 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: NSURLDownload delegate methods seperate thread
Spot on, thanks man. Fixed it using:[[NSRunLoop currentRunLoop] runUntilDate:[NSDate distantFuture]]; while ([self isDownloading] ); So just blocks until finished the download. If I take away the while loop it doesn't run.Is there a better way? Colin CC: cocoa-...@not-pc.com; cocoa-dev@lists.apple.com From: d...@rudedog.org To: colde...@hotmail.com Subject: Re: NSURLDownload delegate methods seperate thread Date: Tue, 8 Sep 2009 12:55:33 -0700 On Sep 8, 2009, at 12:36 PM, Colin Deasy wrote: Well I did try that but there were no callbacks. That is I initiated the download in the start method of an NSOperation. You likely have no run loop running on the thread. You need that for NSURLConnection to do its work. -- Dave Carrigan d...@rudedog.org Seattle, WA, USA _ With Windows Live, you can organize, edit, and share your photos. http://www.microsoft.com/ireland/windows/windowslive/products/photo-gallery-edit.aspx___ 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: NSURLDownload delegate methods seperate thread
On Tue, Sep 8, 2009 at 1:43 PM, Colin Deasycolde...@hotmail.com wrote: So just blocks until finished the download. If I take away the while loop it doesn't run.Is there a better way? Then why are you running in a separate thread at all? Why not just run asynchronously on the main thread? --Kyle Sluder ___ 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: NSURLDownload delegate methods seperate thread
On Sep 8, 2009, at 12:36 PM, Colin Deasy wrote: Well I did try that but there were no callbacks. That is I initiated the download in the start method of an NSOperation. You likely have no run loop running on the thread. You need that for NSURLConnection to do its work. -- Dave Carrigan d...@rudedog.org Seattle, WA, USA PGP.sig Description: This is a digitally signed message part ___ 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: [[NSHost currentHost] name] blocking on 10.6 ?
Le 8 sept. 2009 à 22:15, jonat...@mugginsoft.com a écrit : I am not sure if this is a problem unique to me or not but under 10.5 [[NSHost currentHost] name] or [[[NSProcessInfo] processInfo] hostname] were quick and easy ways to get an mDNS friendly hostname such as imac-2.local On 10.6 I find that both these combinations block badly (NSProcessInfo merely defers to NSHost I think). The list has a few references to the possibility of these blocking but I never encountered it until now. According to a stack sample getnameinfo() seems to be the library call that is blocking. _mdns_query_mDNSResponder seems to be the actual blocking call. Anyone else seeing this behaviour? It's a system wide problem (try to launch OpenGL Profiler for instance, it take hours). But it occurs only with some specifics networks configuration. Do you have Internet Sharing enabled ? That's what causing the issue on my machine. -- Jean-Daniel ___ 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: NSURLDownload delegate methods seperate thread
On Sep 8, 2009, at 1:43 PM, Colin Deasy wrote: Spot on, thanks man. Fixed it using: [[NSRunLoop currentRunLoop] runUntilDate:[NSDate distantFuture]]; while ([self isDownloading] ); This will work, but you won't be able to know if your NSInvocationQueue wants to cancel. If that's important, then this would be better: while ([self isDownloading] ![self isCancelled]) { [[NSRunLook currentRunLoop] runUntilDate:[NSDate dateWithTimeIntervalSinceNow:0.001]]; } This assumes that your object inherits from NSOperation. You might also want to cancel the NSURLConnection if the operation gets cancelled. -- Dave Carrigan d...@rudedog.org Seattle, WA, USA PGP.sig Description: This is a digitally signed message part ___ 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: NSURLDownload delegate methods seperate thread
Well I did try that but there were no callbacks. That is I initiated the download in the start method of an NSOperation. Subject: Re: NSURLDownload delegate methods seperate thread From: cocoa-...@not-pc.com Date: Tue, 8 Sep 2009 13:17:55 -0600 CC: cocoa-dev@lists.apple.com To: colde...@hotmail.com On Sep 8, 2009, at 1:03 PM, Colin Deasy wrote: Hey, Is anyone aware of a way to receive NSURLDownload's delegate methods on a separate thread, i.e. not the main one? Delegate messages will be sent on the thread which calls this method. So, start your NSURLDownload on whichever thread you want the delegate methods to be called on. _ Share your memories online with anyone you want. http://www.microsoft.com/ireland/windows/windowslive/products/photos-share.aspx?tab=1___ 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: [[NSHost currentHost] name] blocking on 10.6 ?
On 8 Sep 2009, at 22:24, Jens Alfke wrote: On Sep 8, 2009, at 1:15 PM, jonat...@mugginsoft.com wrote: I am not sure if this is a problem unique to me or not but under 10.5 [[NSHost currentHost] name] or [[[NSProcessInfo] processInfo] hostname] were quick and easy ways to get an mDNS friendly hostname such as imac-2.local On 10.6 I find that both these combinations block badly (NSProcessInfo merely defers to NSHost I think). This has always been a blocking API — as you saw, it calls into the low-level synchronous DNS function getnameinfo(). I only started poking into it when it started to cause an issue. It was certainly news to me that it could block. And it doesn't necessarily return an mDNS-style .local hostname, either. If there's a regular DNS hostname entry for your machine, you'll get that instead, although in my experience it's usually something uninteresting like dhcp-123-12-34-56.intranet.bigcorp.com. Thanks for that. I had presumed otherwise. If you really want the locally-set 'sharing name', the SCDynamicStore call seems like a good bet. (Follow-ups should probably go to the macnetworkprog or bonjour-dev lists, as this isn't really a Cocoa question.) True. But hopefully a useful Cocoa posting too for anyone else using NSHost whose app exhibits narcolepsy on 10.6 Thanks for the reply. —Jens Jonathan Mitchell Developer http://www.mugginsoft.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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: NSImage with multiple representation sizes
On Tue, Sep 8, 2009 at 11:42 AM, Benjamin Rister bdris...@gmail.com wrote: So to be clear: if I create a TIFF image, with tiffutil -cat, that has 9x...@72dpi, 16x1...@72dpi, 32x3...@72dpi: - This is an entirely supported configuration, despite what man tiffutil says and the warning it generates. No, these reps would not have the same -size. If you set the DPI metadata for the reps to 72, 128, and 256 respectively, then each rep would have -size 9x9. This is what I meant above. It's fine to have different pixel sizes, but it's best to set the metadata so that the -size is consistent. Okay, take 2 then. If I do the same thing, with 9x...@72dpi, 16x1...@128dpi, and 32x3...@256dpi (so the tiffutil warning isn't applicable anymore), will NSImage correctly use the more detailed image when drawing into a 16x16pt space? As I mentioned, Cocoa Drawing Guide Images How an Image Representation Is Chosen gives rules to be applied in the order of color space, dpi, bit depth. All have the same color space, the 9x...@72dpi matches dpi (when at 1.0 scale factor) and the others don't, so according to the docs it's the one that would be chosen, with poor results. On 10.6 and later, yes, you can count on it choosing 16x16 pixel representation. We're not looking at resolution anymore, only number of pixels in rep vs number of pixels to be filled. I'm pretty sure it would on previous OSes too, but not 100% positive. -Ken ___ 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: [[NSHost currentHost] name] blocking on 10.6 ?
While I don't speak for Apple, we ran into this with Daylite Server, and found out that you shouldn't be using those calls. Basically, your computer is NOT the authority on your computer's host name. The DNS system is the authority. So these calls tend to trigger DNS lookups, at which point you're at the mercy of DNS, especially badly configured DNS, or DNS servers that are down, or what-have-you. Beyond that, I haven't worked out all the intricacies. But I believe that gethostname() gets a cached host name that gets set at system startup, and is in no way authoritative (it is I think the C API which underlies the hostname command, and has a complementary sethostname command). That old way of doing stuff is pretty much obsolete. Mac OS X always tries to discover its name from DNS first, and falls back to the mDNS if there is no good response from DNS. Or that seems to be what's going on. The Apple engineers at WWDC were appalled by the very idea of NSHost -currentHost and anything related to it, and basically said that if you're using them, you've got problems in your design. Not making any judgements, just relating my (now somewhat fuzzy) experience. On Tue, Sep 8, 2009 at 4:15 PM, jonat...@mugginsoft.com jonat...@mugginsoft.com wrote: I am not sure if this is a problem unique to me or not but under 10.5 [[NSHost currentHost] name] or [[[NSProcessInfo] processInfo] hostname] were quick and easy ways to get an mDNS friendly hostname such as imac-2.local On 10.6 I find that both these combinations block badly (NSProcessInfo merely defers to NSHost I think). The list has a few references to the possibility of these blocking but I never encountered it until now. According to a stack sample getnameinfo() seems to be the library call that is blocking. _mdns_query_mDNSResponder seems to be the actual blocking call. Anyone else seeing this behaviour? There seem to be two alternatives: NSString *name = NSMakeCollectable(SCDynamicStoreCopyLocalHostName(NULL)); This gives the correct mDNS friendly hostname but omits the local pseudo domain. Otherwise this seems suitable: char hostname[_POSIX_HOST_NAME_MAX + 1]; gethostname(hostname, _POSIX_HOST_NAME_MAX); name = [NSString stringWithCString:hostname encoding:NSUTF8StringEncoding]; Jonathan Mitchell Developer http://www.mugginsoft.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: http://lists.apple.com/mailman/options/cocoa-dev/bgulanowski%40gmail.com This email sent to bgulanow...@gmail.com -- Brent Gulanowski ___ 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: [[NSHost currentHost] name] blocking on 10.6 ?
On 8 Sep 2009, at 22:37, Jean-Daniel Dupas wrote: Le 8 sept. 2009 à 22:15, jonat...@mugginsoft.com a écrit : I am not sure if this is a problem unique to me or not but under 10.5 [[NSHost currentHost] name] or [[[NSProcessInfo] processInfo] hostname] were quick and easy ways to get an mDNS friendly hostname such as imac-2.local On 10.6 I find that both these combinations block badly (NSProcessInfo merely defers to NSHost I think). The list has a few references to the possibility of these blocking but I never encountered it until now. According to a stack sample getnameinfo() seems to be the library call that is blocking. _mdns_query_mDNSResponder seems to be the actual blocking call. Anyone else seeing this behaviour? It's a system wide problem (try to launch OpenGL Profiler for instance, it take hours). But it occurs only with some specifics networks configuration. I had thought that there had to be some local configuration aspect to it. Connecting to other .local machines is none too swift on occasion. Do you have Internet Sharing enabled ? That's what causing the issue on my machine. Yes I do - though I don't recall enabling it or needing it. The machine was upgraded from 10.5 and the blocking behaviour before went completely unnoticed. Switching to SCDynamicStoreCopyLocalHostName() has greatly reduced the apps launch time. -- Jean-Daniel Jonathan Mitchell Developer http://www.mugginsoft.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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
scaleUnitSquareToSize strange behavior Scaling a UI
I am trying to build a ui where I have an NSView with a variety of subviews that are programatically added from nib files similar to the CocoaSlides demo. I need to be able to zoom in and out. Essentially I have little boxes of cocoa controls. I have tried all sorts of solutions with ambiguous results. It seems that when I call scaleUnitSquareToSize there are strange results. My first attempt was to scale the frame of the main view and then planned on calling scaleUnitSquareToSize and have everything trickle down. That did not work. I then started doing everything manually by turning off autoresizing of subviews for the main view. I can scale the frame but scaleUnitSquareTosize again causes problems on the controls of the nib. I also did a test of just building a window cocoa app with a nib to confirm that I can successfully scale buttons, sliders and such and that works. Those objects are subviews of the main window. I also encapsulated controls in a box and it all works with scaleUnitSquareToSize. I found this old email thread which sounds very similar. I don't think a solution was ever proposed though. Any help would be appreciated. Thanks Josh John, Thanks for the insight. Regarding your statement: The resizing behavior pertains to the frame, and not the bounds. Once you've scaled the bounds, if the frame changes, the view may appear to move in unexpected ways depending on the view's own coordinate space (it may be inverted, for example). Is it possible to programmatically prevent this resizing behavior when scaling and then resizing the frame to display the entire bounds of the view ? Thanks again, Bob On Feb 19, 2005, at 9:28 PM, John C. Randolph wrote: On Feb 18, 2005, at 7:03 AM, Robert Miller wrote: Hello, Has anyone had in depth experience with the 'scaleUnitSquareToSize' call vs. the resulting frame size of the receiver ? I'm working on an application that has movable / resizable custom subviews that are also scalable. I've done some research and have discovered some very useful examples on scaling using the scaleUnitSquareToSize' call and understand it's use and how the bounds rectangle of a view is affected by this call. The call does not affect the frame rectangle as would be expected however, I want to be able to display the entire scaled bounds in the NSView after scaling. The frame of a view is the view's location and size in its superview's coordinate space. -scaleUnitSquareToSize: affects the bounds, not the frame of a view. I've added some code which effectively readjusts the frame rectangle to do this. The real issue is that once a view is scaled it seems that any subviews within that view seem to have lost their auto resize mask. (even though diagnosis has shown that they haven't) The behavior of subviews when a previously scaled view is subsequently resized appears as if they have. Example. A custom view is created and displayed, the custom view contains sub views whose 'spring' settings include NSViewMinYMargin and NSViewMaxXMargin which cause the subviews to 'stick' to the top left corner of the view when the view is resized such that its width and height are increased. After the view is scaled the subviews no longer behave as if the previously mentioned resize settings are in effect. (even though as previously stated the values for resizing have not changed). In other words when the view is resized after a scale is applied the subviews now move and no longer stick to the top left corner. Is this some strange anomaly with scaling and resizing mask behaviors internal to NSView. Does my example make sense ? The resizing behavior pertains to the frame, and not the bounds. Once you've scaled the bounds, if the frame changes, the view may appear to move in unexpected ways depending on the view's own coordinate space (it may be inverted, for example). -jcr ___ 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
[[NSHost currentHost] name] blocking on 10.6 ?
I am not sure if this is a problem unique to me or not but under 10.5 [[NSHost currentHost] name] or [[[NSProcessInfo] processInfo] hostname] were quick and easy ways to get an mDNS friendly hostname such as imac-2.local On 10.6 I find that both these combinations block badly (NSProcessInfo merely defers to NSHost I think). The list has a few references to the possibility of these blocking but I never encountered it until now. According to a stack sample getnameinfo() seems to be the library call that is blocking. _mdns_query_mDNSResponder seems to be the actual blocking call. Anyone else seeing this behaviour? There seem to be two alternatives: NSString *name = NSMakeCollectable(SCDynamicStoreCopyLocalHostName (NULL)); This gives the correct mDNS friendly hostname but omits the local pseudo domain. Otherwise this seems suitable: char hostname[_POSIX_HOST_NAME_MAX + 1]; gethostname(hostname, _POSIX_HOST_NAME_MAX); name = [NSString stringWithCString:hostname encoding:NSUTF8StringEncoding]; Jonathan Mitchell Developer http://www.mugginsoft.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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: [[NSHost currentHost] name] blocking on 10.6 ?
On 8 Sep 2009, at 22:44, Brent Gulanowski wrote: While I don't speak for Apple, we ran into this with Daylite Server, and found out that you shouldn't be using those calls. Basically, your computer is NOT the authority on your computer's host name. The DNS system is the authority. So these calls tend to trigger DNS lookups, at which point you're at the mercy of DNS, especially badly configured DNS, or DNS servers that are down, or what-have-you. That's true. Perhaps the problem here lies in the interaction between DNS and mDNS. I really just want my local mDNS name, nothing more. Beyond that, I haven't worked out all the intricacies. But I believe that gethostname() gets a cached host name that gets set at system startup, and is in no way authoritative (it is I think the C API which underlies the hostname command, and has a complementary sethostname command). That old way of doing stuff is pretty much obsolete. That is my take on it too. Mac OS X always tries to discover its name from DNS first, and falls back to the mDNS if there is no good response from DNS. Or that seems to be what's going on. The Apple engineers at WWDC were appalled by the very idea of NSHost -currentHost and anything related to it, and basically said that if you're using them, you've got problems in your design. I sent in a documentation request that some sort of caveat/danger sign be attached to [NSHost currentHost]. Not making any judgements, just relating my (now somewhat fuzzy) experience. On Tue, Sep 8, 2009 at 4:15 PM, jonat...@mugginsoft.com jonat...@mugginsoft.com wrote: I am not sure if this is a problem unique to me or not but under 10.5 [[NSHost currentHost] name] or [[[NSProcessInfo] processInfo] hostname] were quick and easy ways to get an mDNS friendly hostname such as imac-2.local On 10.6 I find that both these combinations block badly (NSProcessInfo merely defers to NSHost I think). The list has a few references to the possibility of these blocking but I never encountered it until now. According to a stack sample getnameinfo() seems to be the library call that is blocking. _mdns_query_mDNSResponder seems to be the actual blocking call. Anyone else seeing this behaviour? There seem to be two alternatives: NSString *name = NSMakeCollectable(SCDynamicStoreCopyLocalHostName (NULL)); This gives the correct mDNS friendly hostname but omits the local pseudo domain. Otherwise this seems suitable: char hostname[_POSIX_HOST_NAME_MAX + 1]; gethostname(hostname, _POSIX_HOST_NAME_MAX); name = [NSString stringWithCString:hostname encoding:NSUTF8StringEncoding]; Jonathan Mitchell Developer http://www.mugginsoft.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: http://lists.apple.com/mailman/options/cocoa-dev/bgulanowski%40gmail.com This email sent to bgulanow...@gmail.com -- Brent Gulanowski Jonathan Mitchell Developer http://www.mugginsoft.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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Framework versioning and handling multiple OS SDK's?
On Tue, Sep 8, 2009 at 3:25 PM, Brent Gulanowskibgulanow...@gmail.com wrote: For classes, you can check whether NSClassFromString(@Classname) returns a class. This might return incompatible private versions of some classes. For example, NSClassFromString(@QLPreviewPanel) will return a class with a very different API on 10.5 than it does on 10.6. For selectors, you can check whether NSSelectorFromString(@selector) returns a selector. This is untrue. NSSelectorFromString always returns a selector. Usually that's enough. In fact, if you pick a representative class that was introduced in the OS release of your choice, you can use that as a short cut to check for the OS version. Or you can check the version major and minor values using Gestalt for accurate version info: Do not use NSClassFromString to check for OS versions. There is absolutely no guarantee it will work. --Kyle Sluder ___ 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: Framework versioning and handling multiple OS SDK's?
On Sep 8, 2009, at 3:25 PM, Brent Gulanowski wrote: For selectors, you can check whether NSSelectorFromString(@selector) returns a selector. That won't do what you want. NSSelectorFromString() always returns a selector; it creates one itself if that name has not been used yet. (And not used yet differs from does not exist anyway; the runtime manipulates selectors as lazily as it can.) Try these instead: [NSClassFromString(@SomeClass) respondsToSelector:@selector (someClassMethod)]; [NSClassFromString(@SomeClass) instancesRespondToSelector:@selector(someInstanceMethod)]; -- Greg Parker gpar...@apple.com Runtime Wrangler ___ 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: [[NSHost currentHost] name] blocking on 10.6 ?
Hi Brent, I may have been one of those appalled Apple engineers. In general, [NSHost currentHost] is the worst API on the system and people should avoid it like the plague. Jonathan, just use SCDynamicStoreCopyLocalHostName instead. gethostname probably isn't going to do what you want. Cheers, -Marc On Sep 8, 2009, at 2:44 PM, Brent Gulanowski wrote: While I don't speak for Apple, we ran into this with Daylite Server, and found out that you shouldn't be using those calls. Basically, your computer is NOT the authority on your computer's host name. The DNS system is the authority. So these calls tend to trigger DNS lookups, at which point you're at the mercy of DNS, especially badly configured DNS, or DNS servers that are down, or what-have-you. Beyond that, I haven't worked out all the intricacies. But I believe that gethostname() gets a cached host name that gets set at system startup, and is in no way authoritative (it is I think the C API which underlies the hostname command, and has a complementary sethostname command). That old way of doing stuff is pretty much obsolete. Mac OS X always tries to discover its name from DNS first, and falls back to the mDNS if there is no good response from DNS. Or that seems to be what's going on. The Apple engineers at WWDC were appalled by the very idea of NSHost -currentHost and anything related to it, and basically said that if you're using them, you've got problems in your design. Not making any judgements, just relating my (now somewhat fuzzy) experience. On Tue, Sep 8, 2009 at 4:15 PM, jonat...@mugginsoft.com jonat...@mugginsoft.com wrote: I am not sure if this is a problem unique to me or not but under 10.5 [[NSHost currentHost] name] or [[[NSProcessInfo] processInfo] hostname] were quick and easy ways to get an mDNS friendly hostname such as imac-2.local On 10.6 I find that both these combinations block badly (NSProcessInfo merely defers to NSHost I think). The list has a few references to the possibility of these blocking but I never encountered it until now. According to a stack sample getnameinfo() seems to be the library call that is blocking. _mdns_query_mDNSResponder seems to be the actual blocking call. Anyone else seeing this behaviour? There seem to be two alternatives: NSString *name = NSMakeCollectable(SCDynamicStoreCopyLocalHostName (NULL)); This gives the correct mDNS friendly hostname but omits the local pseudo domain. Otherwise this seems suitable: char hostname[_POSIX_HOST_NAME_MAX + 1]; gethostname(hostname, _POSIX_HOST_NAME_MAX); name = [NSString stringWithCString:hostname encoding:NSUTF8StringEncoding]; Jonathan Mitchell Developer http://www.mugginsoft.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: http://lists.apple.com/mailman/options/cocoa-dev/bgulanowski%40gmail.com This email sent to bgulanow...@gmail.com -- Brent Gulanowski ___ 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/marc%40apple.com This email sent to m...@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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Framework versioning and handling multiple OS SDK's?
For classes, you can check whether NSClassFromString(@Classname) returns a class. For selectors, you can check whether NSSelectorFromString(@selector) returns a selector. Usually that's enough. In fact, if you pick a representative class that was introduced in the OS release of your choice, you can use that as a short cut to check for the OS version. Or you can check the version major and minor values using Gestalt for accurate version info: file:///Developer/Documentation/DocSets/com.apple.adc.documentation.AppleSnowLeopard.CoreReference.docset/Contents/Resources/Documents/documentation/Carbon/Reference/Gestalt_Manager/Reference/reference.html enum { gestaltSystemVersion file:///Developer/Documentation/DocSets/com.apple.adc.documentation.AppleSnowLeopard.CoreReference.docset/Contents/Resources/Documents/documentation/Carbon/Reference/Gestalt_Manager/Reference/reference.html#//apple_ref/doc/c_ref/gestaltSystemVersion = 'sysv' gestaltSystemVersionMajor file:///Developer/Documentation/DocSets/com.apple.adc.documentation.AppleSnowLeopard.CoreReference.docset/Contents/Resources/Documents/documentation/Carbon/Reference/Gestalt_Manager/Reference/reference.html#//apple_ref/doc/c_ref/gestaltSystemVersionMajor = 'sys1', gestaltSystemVersionMinor file:///Developer/Documentation/DocSets/com.apple.adc.documentation.AppleSnowLeopard.CoreReference.docset/Contents/Resources/Documents/documentation/Carbon/Reference/Gestalt_Manager/Reference/reference.html#//apple_ref/doc/c_ref/gestaltSystemVersionMinor = 'sys2', gestaltSystemVersionBugFix file:///Developer/Documentation/DocSets/com.apple.adc.documentation.AppleSnowLeopard.CoreReference.docset/Contents/Resources/Documents/documentation/Carbon/Reference/Gestalt_Manager/Reference/reference.html#//apple_ref/doc/c_ref/gestaltSystemVersionBugFix = 'sys3' }; (Those symbols should link right into the file in your docs.) Now, that's pretty awkward because you won't be able to instantiate a class without converting from the classname or send a message without converting the method sig and calling -performSelector: so I'd think the right way would be to build two different versions of your framework and ship them separately, making sure to version them so they can co-exist if necessary. Not that hardly anyone does that. On Tue, Sep 8, 2009 at 12:24 AM, aaron smith beingthexemplaryli...@gmail.com wrote: Hey All, I've got a framework (GDKit) that I maintain - started writing it on 10.5. I'm running into something I'm not sure how to handle. -So far, everything I've been writing in GDKit links against 10.5, and applications I've been writing link against GDKit, and 10.5. -I have some new classes I want to add to the framework, but some of the API's are in 10.6 only. -The new classes and features in my framework are optional - because they require 10.6, but I don't want to have to change all of my applications to require 10.6. It is possible to build a framework against a different version of the OS than an application that depends on it. Although you have to be careful about setting up dependencies in Xcode which might push build settings from the app down to the framework, if you use that feature of Xcode. What I'm trying to figure out is how to keep the framework compiling for 10.5, but optionally including the new features/classes when it's compiling for 10.6. There's just a few things I'm unclear of.. -When it's compiling for 10.5, can I completely exclude files from compiling (the 10.6 features)? Is that the right way to exclude features? Well it seems you're definitely going to have to build two versions of the framework (probably by creating two different build configurations) -- in the 10.5, yes, you won't compile/link those classes which require 10.6. -When I link against GDKit from an application, how can I have the app link against GDKit that include only the 10.5 features? Or optionally link against the build that includes the 10.6 features? The linking is done dynamically. If you want the same compiled version of your app to use different features of your framework depending on where it is and what's available, it will have to explicitly check for the existence of those things. Your app should just link against the framework, not a specific version of it (if you choose to use versions). If it all becomes too onerous to access 10.6-only classes/methods using NSStringFrom... (or, in the case of Carbon/C, some other approach), you would be better off building separate versions of your app. I've been reading about framework versioning, and what they recommend is creating a new major version. But that doesn't really help my problem - as creating a new major version would require the 10.6 SDK. Hopefully that makes sense. Does anyone know of any blog posts or tutorials about this particular situation? Any ideas would be sweet. ___ I'm no expert in targetting
Re: [[NSHost currentHost] name] blocking on 10.6 ?
While I don't speak for Apple, we ran into this with Daylite Server, and found out that you shouldn't be using those calls. I got a similar response, I had been using NSHost previously and hadn't noticed any delay so assumed it was using a local backing store. I ran the same code on the network at WWDC and observed one minute plus delays as it waited for a multicast response. This gave rise to my new rule, test all network applications under WWDC network conditions, there's no replacement. Basically, your computer is NOT the authority on your computer's host name. The DNS system is the authority. So these calls tend to trigger DNS lookups, at which point you're at the mercy of DNS, especially badly configured DNS, or DNS servers that are down, or what-have-you. That's true. Perhaps the problem here lies in the interaction between DNS and mDNS. I really just want my local mDNS name, nothing more. Perhaps it's worth noting that in 10.6 the DNS responder and mDNSResponder are one in the same. It's now the system wide lookup demon so that there's one authoritative local cache. You haven't mentioned what you need the machine name for; as a miscellaneous networking example you can pass NULL for the host parameter to DNSServiceRegister which registers it for the current host and tracks changes; depending on wether you need it to pass to another API or if you need to display/otherwise use it you might get away with nil/NULL. Keith ___ 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
NSUserDefaults synchronization in Foundation tools
The docs for NSUserDefaults have this to say regarding - [NSUserDefaults synchronize]: Because this method is automatically invoked at periodic intervals, use this method only if you cannot wait for the automatic synchronization (for example, if your application is about to exit) NSUserDefaults seems to be hooked into -[NSApplication terminate:], since I can store a value and immediately terminate the application and the value is stored to disk. NSUserDefaults does not have the same behavior when used with a Foundation tool, since there's no Foundation- provided runloop and indeed no Foundation-provided way to exit your application. Will NSUserDefaults ever synchronize itself itself in an app without an NSApplication? If so, when and how? If not, the docs need to be ammended. ___ 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: NSUserDefaults synchronization in Foundation tools
On Sep 8, 2009, at 4:24 PM, Jens Alfke wrote: On Sep 8, 2009, at 4:13 PM, Sidney San Martín wrote: Because this method is automatically invoked at periodic intervals, use this method only if you cannot wait for the automatic synchronization (for example, if your application is about to exit) To my knowledge that's always been incorrect — the only time NSUserDefaults synchronizes automatically is upon quit. The app can change a default, stay running for days, then crash; and the default won't have been written to disk so the change is lost. So I've always ended up calling -synchronize myself, either immediately or using a perform-after-delay. Automatic synchronization of changes to NSUserDefaults was added in Leopard. CFPreferences may behave differently. -- Greg Parker gpar...@apple.com Runtime Wrangler ___ 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: [[NSHost currentHost] name] blocking on 10.6 ?
On Sep 8, 2009, at 3:31 PM, Marc Krochmal wrote: Hi Brent, I may have been one of those appalled Apple engineers. In general, [NSHost currentHost] is the worst API on the system and people should avoid it like the plague. Hi Marc, Can you tell why this is so? Best, __jayson Circus Ponies NoteBook - Organization for a Creative Mind www.circusponies.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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: NSUserDefaults synchronization in Foundation tools
On Sep 8, 2009, at 4:13 PM, Sidney San Martín wrote: Because this method is automatically invoked at periodic intervals, use this method only if you cannot wait for the automatic synchronization (for example, if your application is about to exit) To my knowledge that's always been incorrect — the only time NSUserDefaults synchronizes automatically is upon quit. The app can change a default, stay running for days, then crash; and the default won't have been written to disk so the change is lost. So I've always ended up calling -synchronize myself, either immediately or using a perform-after-delay. —Jens___ 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
usb notification
Hi all, Can't get a simple example working. AppearedNotificationHandler() should be called in the code below when a USB device (any device for now) is plugged in. I see the NSLog(@registerDeviceCallbackHandler) message appear in the console when I start the application, but never see the NSLog(@AppearedNotificationHandler) message when I plug in a device. What am I missing? Note: The project's MainMenu.nib Interface Builder file has an NSObject whose class is USBDriver. static void AppearedNotificationHandler (void * refCon, io_iterator_t iterator); @interface USBDriver(Private) - (void) registerDeviceCallbackHandler; @end @implementation USBDriver(Private) - (void) registerDeviceCallbackHandler { IOReturnkernErr; CFRunLoopSourceRef runLoopSource; CFMutableDictionaryRef matchingDict = IOServiceMatching (kIOUSBDeviceClassName); CFRunLoopRefrunLoop; // Create the port on which we will receive notifications. We'll wrap it in a runLoopSource // which we then feed into the runLoop for async event notifications. deviceNotifyPort = IONotificationPortCreate (kIOMasterPortDefault); if (deviceNotifyPort == NULL) { return; } // Get a runLoopSource for our mach port. runLoopSource = IONotificationPortGetRunLoopSource (deviceNotifyPort); matchingDict = (CFMutableDictionaryRef) CFRetain (matchingDict); kernErr = IOServiceAddMatchingNotification (deviceNotifyPort, kIOFirstMatchNotification, matchingDict, AppearedNotificationHandler, (void *) self, deviceAppearedIterator); kernErr = IOServiceAddMatchingNotification (deviceNotifyPort, kIOTerminatedNotification, matchingDict, DisappearedNotificationHandler, (void *) self, deviceDisappearedIterator ); // Get our runLoop runLoop = [[NSRunLoop currentRunLoop] getCFRunLoop]; // Add our runLoopSource to our runLoop CFRunLoopAddSource (runLoop, runLoopSource, kCFRunLoopDefaultMode); NSLog(@registerDeviceCallbackHandler); } @end @implementation USBDriver - (id) init { [super init]; if (self) { deviceNotifyPort= IO_OBJECT_NULL; deviceAppearedIterator = 0; [self registerDeviceCallbackHandler]; } return self; } @end static void AppearedNotificationHandler (void * refCon, io_iterator_t iterator) { NSLog(@AppearedNotificationHandler); } Any help is much appreciated. Thanks, Chris ___ 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: NSUserDefaults synchronization in Foundation tools
Hi Jens, On Tue, Sep 8, 2009 at 4:24 PM, Jens Alfke j...@mooseyard.com wrote: On Sep 8, 2009, at 4:13 PM, Sidney San Martín wrote: Because this method is automatically invoked at periodic intervals, use this method only if you cannot wait for the automatic synchronization (for example, if your application is about to exit) To my knowledge that's always been incorrect — the only time NSUserDefaults synchronizes automatically is upon quit. The app can change a default, stay running for days, then crash; and the default won't have been written to disk so the change is lost. So I've always ended up calling -synchronize myself, either immediately or using a perform-after-delay. No, it does actually behave as documented. In 10.6 I know it syncs after 15 seconds. I cannot find the bug where it was added, but it's been true since at least 10.5. Will NSUserDefaults ever synchronize itself itself in an app without an NSApplication? If so, when and how? If not, the docs need to be ammended. Yes, it's NSTimer based. Your app must be running the run loop for the synchronization to occur. -Ken ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Core Data fetch with to-many relationship
I am having trouble fetching results with a to-many relationship and would like to ask for advice. I have two NSManagedObject subclasses: Owner and Book. There is a one- to-many relationship between Owner and Book (an Owner can be associated with many Books). @interface Owner : NSManagedObject { } @property (nonatomic, retain) NSString * ownerId; @property (nonatomic, retain) NSString * displayName; @property (nonatomic, retain) NSSet* Book; @interface Owner (CoreDataGeneratedAccessors) - (void)addBookObject:(Book *)value; - (void)removeBookObject:(Book *)value; - (void)addBook:(NSSet *)value; - (void)removeBook:(NSSet *)value; @interface Book : NSManagedObject { } @property (nonatomic, retain) NSNumber * type; @property (nonatomic, retain) NSString * name; @property (nonatomic, retain) NSDate * creationDate; @property (nonatomic, retain) Owner * Owner; I first create the Owner managed object instance: Owner *ownerMO = (Owner *)[NSEntityDescription insertNewObjectForEntityForName:@Owner inManagedObjectContext:moc]; [ownerMO setOwnerId:[libraryOwner _id]]; [ownerMO setDisplayName:[libraryOwner _displayName]]; NSError *error; [moc save:error]; I then loop through my Books and add them: for (LibraryBook *libraryBook in libraryBooks) { Book *bookMO = (Book *)[NSEntityDescription insertNewObjectForEntityForName:@Book inManagedObjectContext:managedObjectContext]; [bookMO setName:[libraryBook _name]]; [bookMO setCreationDate:[libraryBook _creationDate]]; [ownerMO addBucketObject:bookMO]; NSError *error; [moc save:error]; } So far, so good (I think). Let's say, in my example, I populate the store with one Owner: Owner 123456 | username and multiple Books, some of which have names that start with myPrefix. When I go to search the Owner entities for Books that start with myPrefix, I get an error message when I try to look at the results: NSArray *testFetchResults = [managedObjectContext fetchObjectsForEntityName:@Owner withPredicate:[NSString stringWithFormat:@ANY Book.name like 'myPrefix*']]; NSLog(@testFetchResults - \n%d...@\n%@, [testFetchResults count], [testFetchResults description], [(Book *)[(Owner *)[testFetchResults objectAtIndex:0] Book] description]); Here's the error: Relationship fault for (NSRelationshipDescription: 0x3d1b2b0), name Book, isOptional 1, isTransient 0, entity Owner, renamingIdentifier Book, validation predicates ( ), warnings ( ), versionHashModifier (null), destination entity Book, inverseRelationship Owner, minCount 0, maxCount 0 on Owner 123456 | username Is the following NSPredicate incorrect for doing a to-many lookup: @ANY Book.name like 'myPrefix*' Or did I go about adding new Book and Owner managed objects incorrectly, in that the relationship between Book objects and Owner was not established correctly? Sorry if this is a noob Core Data question. Thanks for your advice. Regards, Alex ___ 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
NSDockTilePlugIn
I've been experimenting with an NSDockTilePlugIn. The documentation is a bit sparse. It looks like the plug-in needs to be 32-bit/64-bit GC supported. The plug-in gets called successfully in the release build of my app, but it does not get called in the debug build. Instead, I get this error message printed to the system log: Dock[88]: _DESCRegisterDockExtraClient failed 5 I wondered if anybody knew what that error meant before I go and twiddle every permutation of the build settings to find out the culprit. Dave ___ 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: NSImage with multiple representation sizes
On 09/09/2009, at 6:20 AM, Ken Ferry wrote: On 10.6 and later, yes, you can count on it choosing 16x16 pixel representation. We're not looking at resolution anymore, only number of pixels in rep vs number of pixels to be filled. I'm pretty sure it would on previous OSes too, but not 100% positive. It works this way on 10.5. It's easy to test, dump a multi-resolution TIFF into an NSImageView set to resize with the window and scale the window up and down. If the TIFF contains different images at each resolution (say the number 16 for a 16x16px rep, and the number 128 for a 128x128px rep) then you'll see the various representations drawn as you resize. -- Rob Keniger ___ 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: usb notification
On Tue, Sep 8, 2009 at 5:47 PM, Chris Carsoncucar...@yahoo.com wrote: IOReturn kernErr; You never seem to check for errors. Please ensure your calls are succeeding by checking the value of this variable. If they're failing, use macerror(1) to look up the error number. - (id) init { [super init]; if (self) { This is not the correct initializer pattern. You need to assign to self here. --Kyle Sluder ___ 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: NSPDFImageRep Memory Leak?
Thanks. That's the problem. By releasing the NSData PDFPage returns, the program now consumes half the memory. But still, the memory it consumes keeps increasing and yet I cannot figure out why... On Wed, Sep 9, 2009 at 2:17 AM, John Calhoun calho...@apple.com wrote: On Sep 8, 2009, at 5:08 AM, DairyKnight wrote: NSPDFImageRep *pdfImgRep = [[NSPDFImageRep alloc] initWithData:[page dataRepresentation]]; Check [page dataRepresentation] above. Pre-SnowLeopard the NSData returned was *not* autoreleased and so needed to be released by the caller. This was not consistent with other AppKit -[xxx dataRepresentation] calls. In SnowLeopard, -[PDDPage dataRepresentation] is properly auto-released. SnowLeopard PDF Kit though checks the compiler and continues the non-auto-prelease behavior for apps compiled before SnowLeopard. The above applies to -[PDFDocument dataRepresentation] as well. Check the PDFXxx headers, the behavior change is documented there. *John Calhoun—* ___ 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 Data fetch with to-many relationship
On Sep 8, 2009, at 18:03, Alex Reynolds wrote: Relationship fault for (NSRelationshipDescription: 0x3d1b2b0), name Book, isOptional 1, isTransient 0, entity Owner, renamingIdentifier Book, validation predicates ( ), warnings ( ), versionHashModifier (null), destination entity Book, inverseRelationship Owner, minCount 0, maxCount 0 on Owner 123456 | username That's not an error, it's an unfired to-many relationship fault. If you call a method on it (say [testFetchResults valueForKey:@name]) it will fire and look more like what you're expecting. BTW, it's generally a bad idea to use uppercase key names. The ivar 'Book' should probably be 'books', and 'Owner' should be 'owner' (the class names are fine the way they are). +Melissa ___ 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: Does Mac OS X support interior pointers?
On Sun, Sep 6, 2009 at 9:20 PM, Quincey Morris quinceymor...@earthlink.netwrote: On Sep 6, 2009, at 17:36, John Engelhart wrote: So, since the Mac OS X documentation uses the term interior pointer in a totally non-standard way, and I can't find anything wrt/ to what I'm looking for, my question is: Does the Mac OS X garbage collector support interior pointers (as defined at http://www.memorymanagement.org/glossary/i.html#interior.pointer )? Huh? You know it doesn't. You've beaten up on GC before, with reference to *both* senses of interior pointer. To my recollection, I have never discussed this problem on the list. I have discussed the following: (both related to http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/GarbageCollection/Articles/gcUsing.html#//apple_ref/doc/uid/TP40008006-SW7) 1) The problems of Mac OS X Interior pointers, in so far that the pointer from [data bytes] does not keep 'data' live. 2) The compiler, in GC mode, generates code that is violates C99 section 6.2.4: Storage duration of objects. Point 1 is not contested by anyone (in so far as I know). The only point of contention is the degree that this causes problems. Point 2 is not up for debate- One can write an example test case of objective-c code that when compiled with -fobjc-gc, the assembly output from the compiler can be checked to see if it violates section 6.2.4. Whether or not the assembly output violates 6.2.4 is unambiguous and not open to interpretation. The referenced Mac OS X GC section essentially says this is what happens. In fact, the referenced section effectively says that point 1 and 2 happen. The problem I've brought up is neither point 1 or point 2. I certainly hope this isn't the case because this essentially means that it is fundamentally impossible to write programs that execute in a deterministic fashion when using GC. It is basically impossible to write code that guarantees that the base pointer remains visible to the collector, particularly when __weak and/or the optimizer is used. Things work the vast majority of the time because there is (usually) a very small window of time where it could actually cause a problem and one of two things are true: 1) When the compiler generates code that, as a side effect, only uses interior pointers (this happens much, much more frequently than you would think), there's something that covers this fundamental error with a base pointer. This is invariably due to a happy set of coincidences and rarely the explicit, intentional result of the programmer. 2) The collector is not collecting during the window of vulnerability. You also know that no one else on this list agrees with you on this subject, so I don't understand why you're asking about it. Well, since point 1 is (assumed) uncontested, that leaves point 2. Those who disagree with me implicitly acknowledge A) The compiler is generating code that violates the C standard. B) Because of this, it significantly complicates writing code that uses garbage collection. ... and I gotta say, hats off to those folks! Even if you put A aside, that still leaves the effects of B. The dedication to make your life harder and your programming more difficult just to 'be right' is impressive. Garbage collection is supposed to make things simpler and easier, after all. *Of course* every programmer explicitly and intentionally ensures that the lifetimes of base pointers continue for as long as derived or interior pointers need to be valid. That's the Mac OS X garbage collection architecture, for now. From this statement I'm going to assume that you have very little experience with the back ends of compilers. Either that or you didn't bother to read my message before you responded. You don't seem to understand that what you've just asserted is, for all practical purposes (and especially once the optimizer kicks in), *IMPOSSIBLE *. For example: // Assume that 'data' is a NSData that is a ASCII string of text. NSData *data; const char *cString = [data bytes]; size_t length = strlen(cString); char cStringCopy[length]; for(NSUInteger x = 0UL; x length; x++) { cStringCopy[x] = cString[x]; } The non-declaration usage of '[]' is a pointer operator in C. The use of 'cStringCopy' after the declaration is equivalent to '(cStringCopy[0])'- a pointer to the first (index 0) element of the array. This means the for loop is equivalent to: for(NSUInteger x = 0UL; x length; x++) { *(cStringCopy + x) = *(cString + x); } It's useful to note that both 'cStringCopy' and 'cString' are loop invariant, usually a prime target for optimization. Once the optimizer gets ahold of this, it will transform the code in to something like: char *p = cStringCopy; for(NSUInteger x = 0UL; x length; x++) { *p++ = *cString++; } Do you understand what the problem is? It is extremely difficult to keep the base pointer 'live' for arbitrary pointer types, particularly those that are
Core Data SQLite I/O error on 10.6
Hello! I updated my Mac from 10.5 to 10.6 yesterday. Using the app I developed under 10.5 with a Core Data SQLite store created under 10.5 I get the following error under 10.6: I/O error for database at /Users/norbert/Library/Application Support/ Grosshandel/Grosshandel.grosshandelstore. SQLite error code:1, 'no such column: t1.Z_75PERSONALACCOUNTS1' This error does NOT occur when I create a new Core Data SQLite store with the same app under 10.6. I didn NOT edit the store with SQLite directly, of course. The Entitiy names affected may be PersonalAccount and PersonalAccountRebateGroup which are related with an optional many-to- many relationship named personalAccountRebateGroups / personalAccounts. Seems to be a problem deeply in Core Data. I have no idea how to resolve this. I will get a HUGE problem when my existing customers update from 10.5 to 10.6. Norbert ___ 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
NSTableView doesn't increase the number of elements in table?
Hi all, I've an NSTableView that uses the controller object for the NIB being displayed as the data source. I implement the NSTableView informal protocol. This NSTableView gets its values from Core Data. I startup the application, load all values I have in XML and then display them. My problem is, the NSTableView doesn't seem to add any new rows to the end of the table. If I start the application with no values in permanent storage and add another one (adding values works as I can see them being saved to XML), the table view simply ignores the new value. If I add a value I know will go to the end of the table (the contents are organized alphabetically), I won't see the new value. If I and a value that I know won't go to the end of the table, the value will be added, I will see it on the table, but the last value on the table will be pushed out and become invisible. Has anyone encountered something like this? Any clues to what might be? -- Best regards, Rui Pacheco ___ 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: [iPhone] : How to customize Phonepad ?
you can customize the phone pad, or any of the UIKeyboards by creating and drawing your own buttons/views over them. it's a hack, but it can work quite nicely if you're interested in some minimal customization (for example: changing the Go or Done button to display Login or Save). best results will require some photoshop skill. keep in mind that some buttons change shape and position depending on which international keyboard settings the user chooses. here's a tutorial to get you started: http://www.neoos.ch/news/46-development/54-uikeyboardtypenumberpad-and-the-missing-return-key if you really want to customize everything from top to bottom, i suggest you roll your own keyboard. good luck! On Tue, Sep 8, 2009 at 11:53 AM, Luke the Hiestermanluket...@apple.com wrote: You can't customize the phone pad, which is really just an instance of a keyboard. For the stuff you want to do, you should write your own custom view that behaves as you desire. Luke On Sep 8, 2009, at 7:48 AM, Dan Ribe wrote: Sorry for my last mail ... It got sent while I was typing ! Hi All, I am looking for a way to customize the Phonepad provided by the iPhone for my application use. Here is the list I am interested in : - Want to show it at the middle of the screen. - Want to change caption of the button to Call. - Want to change the color/size of the Phonepad. - Also want to customize the keys which will be available to the users (hide special characters other than '+' '#'). Can anyone give me some pointers on this. Any help on this is highly appreciated. Cheers ! -Dan ___ 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/luketheh%40apple.com This email sent to luket...@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: http://lists.apple.com/mailman/options/cocoa-dev/chunk1978%40gmail.com This email sent to chunk1...@gmail.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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Garbage collection and about windows
Hi all. I'm just getting into my first garbage collected Cocoa project, and I'm a bit mystified by the behavior I'm seeing. I'm just trying to make a custom about panel. I put this method in my application delegate: - (IBAction)orderFrontAboutPanel:(id)sender { if (!aboutController) aboutController = [[AKAboutPanelController alloc] initWithWindowNibName:@AKSplash]; [aboutController showWindow:nil]; } I put this declaration of aboutController in my app delegate header: __weak AKAboutPanelController *aboutController; And then I implemented AKAboutPanelController like so: @interface AKAboutPanelController : NSWindowController { } @end @implementation AKAboutPanelController - (void)finalize { NSLog(@AKAboutPanelController finalize); [super finalize]; } @end My idea — perhaps being too clever for my own good — was that as long as the about window was open, the window would be referenced by the window list, and so the window and its controller would stick around. Choosing the About menu item a second time would therefore just call showWindow: on the controller again, ordering the window to the front if it had gotten buried. As soon as the window was closed, I figured it and its controller would be garbage collected, and the weak reference to it in the app delegate would zero out, so then choosing About would create a new controller and reload the nib. But this is not what happened. Instead, the about window sticks around for as long as it is the key window (presumably the window is strong-referenced by AppKit or somebody at a lower level than the Kit). As soon as it is not the key window (click on a different window in the app) it gets garbage collected immediately, even though it is still open! Now maybe this is intended behavior, but it sure isn't what I expected; it seemed intuitive to me that an open window, visible to the user, would not be garbage collected. Is there a reason that the window list uses weak references for visible windows? So. I can think of any number of ways to fix this, of course, but they all seem a little bit gross since they involve either tweaking the garbage collector (CFRetain, for example) or making the reference to the window controller in the app delegate strong, in which it doesn't automatically zero and I have to set up a way for the windowcontroller to tell the app delegate that it's no longer needed. There must be a better pattern; I imagine I'm just not used to thinking in garbage-collection terms yet. So what's the right way to do this? Thanks... Ben Haller Stick Software ___ 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: Framework versioning and handling multiple OS SDK's?
Of course. I wasn't thinking straight. Sorry for the misinformation. On Tue, Sep 8, 2009 at 6:33 PM, Greg Parker gpar...@apple.com wrote: On Sep 8, 2009, at 3:25 PM, Brent Gulanowski wrote: For selectors, you can check whether NSSelectorFromString(@selector) returns a selector. That won't do what you want. NSSelectorFromString() always returns a selector; it creates one itself if that name has not been used yet. (And not used yet differs from does not exist anyway; the runtime manipulates selectors as lazily as it can.) Try these instead: [NSClassFromString(@SomeClass) respondsToSelector:@selector (someClassMethod)]; [NSClassFromString(@SomeClass) instancesRespondToSelector:@selector (someInstanceMethod)]; -- Greg Parker gpar...@apple.com Runtime Wrangler -- Brent Gulanowski ___ 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: Strangest UITable bug
Hard to know sans code ... are you calling dequeReusableCellWithIdentifier in your cellForRowAtIndexPath: method? On Sep 7, 2009, at 8:10 PM, Development wrote: Ok I have the weirdest UITableViewBug.. I've set up the delegate, datasource, etc. My data appears correctly in the table. HOWEVER, when I click the table once, it ignores the first click. Then, if I click it again on a different cell, it shows that I clicked the previous cell. In fact each subsequent touch shows that I clicked the cell just previous to it. I have no clue how I managed to screw up a tableview like this but does any one have any idea how I might have done this? ___ 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/cosmogyralist%40gmail.com This email sent to cosmogyral...@gmail.com Alan K Duncan Cocoa, Cocoa Touch development: http://alanduncan.net/ Flickr: http://www.flickr.com/photos/_alan_/ Twitter: N201LJ ___ 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
KVO can be unsafe in -init?
Hi all, Question: is it unsafe for some reason to be adding yourself as a KVO observer during -init? We have a singleton with an -init that looks something like this: - (id)init { if ((self = [super init])) { _foo = [[NSMutableDictionary alloc] init]; _bar = [[NSMutableDictionary alloc] init]; [[XYZManager sharedManager] addObserver:self forKeyPath:@allObjects options:NSKeyValueObservingOptionInitial context:NULL]; } return self; } This code is running on iPhone OS. On some devices (we haven't been to narrow this down), the last line of code is throwing an exception: Sun Sep 6 13:41:26 unknown MyApp[1609] Error: *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[NSCFDictionary setObject:forKey:]: attempt to insert nil key' We know that [XYZManager sharedManager] can't be nil, since otherwise -addObserver: would not be getting called, and the first line if ((self = [super init])) ensures that self can't be nil. We're pretty sure that [XYZManager sharedManager].allObjects is not nil, but even if it were nil, that shouldn't cause an exception. -allObjects is a synthesized getter with no dependent keys. No other threads are involved here. So we're stumped as to why KVO is throwing an exception. The only theory is that the NSKeyValueObservingOptionInitial option is causing KVO to do something with self immediately, but self isn't fully set up yet. Though it's unclear why in this particular usage that would be unsafe, or why it would make any difference. Can anyone provide any insight? Thanks, /John Stockholm, Sweden ___ 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
NSOutlineView with multiple Core Data entities
My goal is to have an NSOutlineView (Source List style) that contains group items at it's root with each group item corresponding to a Core Data entity type (which I'll hard code, it doesn't need to automatically adapt to new entity types). I'd then like those group items to contain leaves for every instance of the corresponding entity in my object graph. For example: Foos [hard coded group item] - Foo 1 - Foo 2 Bars [hard coded group item] - Bar 1 - Bar 2 I've found numerous threads on similar topics but so far every approach I've tried has tripped me up at some point. I tried making my entities inherit from an abstract leaf entity and using an NSTreeController in entity mode with that entity. I hesitate to continue down that path because I don't like having to change my model just to get the view working. I also tried rolling my own data source for NSOutlineView based on the data source example at CocoaDev. Each node (group or leaf) is an NSMutableDictionary but I stumbled when it came to adding the entities. Creating a new object with a given title is fine but how do I obtain the actual entity instance from that title? Should I add the entity as a value in the dictionary item? I've also tried having a separate model for the NSTreeController but again I couldn't quite figure out how to map a leaf node to the entity instance I actually care about. Do I add a binary data attribute to my Leaf entity and somehow map that to an entity instance? Do I merge the models at runtime and add a relationship from one model to the other? I get the feeling all three approaches will work but I don't know for sure. I'd really appreciate a gentle steer towards a single approach or some help with the aforementioned tripping points! Thanks in advance, Matthew ___ 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: KVO on Distributed Objects with exception handling.
On Sep 7, 2009, at 21:45 , Edward Chan wrote: Great... How long ago did you ask the Apple engineers? I haven't tried this piece of code with Snow Leopard actually... This was back in February, I was probably testing on Leopard. The difference between what you and I tried was that I used - bind:toObject:withKeyPath:options: instead of - addObserver:forKeyPath:options:. Did they explain why they didn't want to support it? No, but then the discussion was over Twitter DMs, with all the terseness that entails :-). I do remember eventually sending some sample code to someone in Apple who I seem to recall is on this list, hopefully he is and will be able to explain engineering's reservations more completely. Cheers, Graham. ___ 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
Malloc error: GC operation on unregistered thread...
I'm working on an app that uses Audio Queue Services for recording audio. I have the following lines in my code: OSStatus err; UInt32 propertySize; AudioQueueRef myQueue = [self audioQueue]; err = AudioQueueGetPropertySize(myQueue, kAudioQueueProperty_MagicCookie, propertySize); I'm calling AudioQueueGetPropertySize in preparation for calling AudioQueueGetProperty() to get the magic cookie from the audio queue so I can save it as a property in my audio file. However, I get the following error when the line above is executed: malloc: *** auto malloc[861]: error: GC operation on unregistered thread. Thread registered implicitly. Break on auto_zone_thread_registration_error() to debug. Breaking on auto_zone_thread_registration_error shows me the following stack trace: #0 0x9567a0c3 in auto_zone_thread_registration_error #1 0x95675116 in auto_zone_allocate_object #2 0x91749791 in CFAllocatorAllocate #3 0x917494b3 in _CFRuntimeCreateInstance #4 0x9177e362 in __CFRunLoopCreate #5 0x9177e24f in _CFRunLoopGet0 #6 0x9177df1d in CFRunLoopGetCurrent #7 0x20390e86 in AVS::AVCDeviceController::AVCDeviceController #8 0x20391478 in AVS::DestroyAVCDeviceController #9 0x9050cfe1 in _pthread_start #10 0x9050ce66 in thread_start My app doesn't crash, and everything seems to work OK, but I'm trying to figure out what this means. This is my first garbage collected app, so I'm guessing there's something about the intricacies of actually using garbage collection that I'm missing. Any pointers? Thanks! Andrew Madsen ___ 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: KVO on Distributed Objects with exception handling.
On Sep 7, 2009, at 20:02 , Edward Chan wrote: Hello, I'm using KVO on a Distributed Object, and I am binding my UI controls based on the observer. Hi, not much of constructive help from me I'm afraid, just a warning. I also did the same thing once, and the reaction from Apple engineers went through denial, shock and fear, but never got as far as acceptance. In fact I was told that combining KVO with DO is not supported and if it does work now, don't expect it to work in the future. Cheers, Graham. ___ 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: Finding nearby places
Find a web service that reverse geocodes what you want and use their api's. If you're still unsure there are books on the market that will walk you through the concepts. Some research for you: http://groups.google.com/group/Google-Maps-API/web/resources-non-google-geocoders?pli=1 Alan K Duncan Cocoa, Cocoa Touch development: http://alanduncan.net/ Flickr: http://www.flickr.com/photos/_alan_/ Twitter: N201LJ On Sep 7, 2009, at 4:48 AM, Mahaboob wrote: Hi, I get the latitude and longitude from the iPhone using coreLocation framework. Now I need to show the nearby hotels, restaurants etc. Which api I need to use for this? I'm using iPhone OS 2.2 Thanks in advance Mahaboob ___ 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/cosmogyralist%40gmail.com This email sent to cosmogyral...@gmail.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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
How to remove the Special Characters... menu item?
XCode automatically adds the Special Characters... menu item to applications, but mine doesn't need it, so I'd like to leave it off. Mac OS X Developer Release Notes: Cocoa Application Framework (10.5 and Earlier) contains the following AppKit now adds Special Characters... menu item to the Edit menu if an item with -orderFrontCharacterPalette: action is not found in the menu. To prevent the behavior, you can set the NSDisabledCharacterPaletteMenuItem preference setting to YES. which does not accurately describe behavior under OSX 10.5 and XCode 3.1. I've made these attempts to suppress the Special Characters... menu item added by AppKit: 1. Set NSDisabledCharacterPaletteMenuItem. I do not find this setting, or anything relevant, in XCode. 2. Create and hide my own menu item. It's easy enough to create a functional Special Characters... menu item in Interface builder (create the item and link it to the orderFrontCharacterPalette: received action of the NSApplication instance), but contrary to the claim of the release note above, this does not prevent AppKit from adding another. 3. Programmatically remove the item after the application has launched. The menu's array of items does not include the item added by AppKit, so NSMenu's methods cannot access it. What else can I try? Incidentally, can anyone explain why this particular menu item is exalted? Thanks, David ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: KVO can be unsafe in -init?
John Chang wrote: Hi all, Question: is it unsafe for some reason to be adding yourself as a KVO observer during -init? We have a singleton with an -init that looks something like this: - (id)init { if ((self = [super init])) { _foo = [[NSMutableDictionary alloc] init]; _bar = [[NSMutableDictionary alloc] init]; [[XYZManager sharedManager] addObserver:self forKeyPath:@allObjects options:NSKeyValueObservingOptionInitial context:NULL]; } return self; } This code is running on iPhone OS. On some devices (we haven't been to narrow this down), the last line of code is throwing an exception: Sun Sep 6 13:41:26 unknown MyApp[1609] Error: *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[NSCFDictionary setObject:forKey:]: attempt to insert nil key' We know that [XYZManager sharedManager] can't be nil, since otherwise -addObserver: would not be getting called, and the first line if ((self = [super init])) ensures that self can't be nil. We're pretty sure that [XYZManager sharedManager].allObjects is not nil, but even if it were nil, that shouldn't cause an exception. -allObjects is a synthesized getter with no dependent keys. No other threads are involved here. So we're stumped as to why KVO is throwing an exception. The only theory is that the NSKeyValueObservingOptionInitial option is causing KVO to do something with self immediately, but self isn't fully set up yet. Though it's unclear why in this particular usage that would be unsafe, or why it would make any difference. Can anyone provide any insight? I don't see anything wrong with what you're attempting to do, as long as you're a little careful. Your NSKeyValueObservingOptionInitial isn't being magically intercepted, I'm quite sure. However that will cause your KVO handler to be executed immediately to give you the initial value, before the registration method returns, are you fully set-up to receive it at that point, is it really the last line before you return self? What happens if your class has been subclassed and that subclass has its own observeValueForKeyPath:ofObject:change:context: method, I'm not entirely sure which one would be called, but I think it would be your subclasses, and your subclass initializer hasn't yet been called. One thing to note, you're using a context of NULL, which I used to do all the time until I got badly bitten. Don't do that, set a context for your observations and check it, the pattern is in the documentation and XCode will even generate a stub for it. You must check the context, you must call the superclass implementation. That would save you by the way in the case you have been subclassed and the subclass method has been called as the contexts wouldn't match and the subclass would pass the observation back up to you. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
How to set the media box for a CGPDFPageRef?
Hi all, I'm trying to convert my program with PDFKit to CGPDF to get better performance. I'm trying to crop a page, with PDFPage I can simply do: [PDFPage setBounds: forBox:kPDFDisplayMediaBox]; But for CGPDFPageRef, there seems to be only a CGPDFPageGetBoxRect available. I wonder if I can simply change the mediabox with a function? Thanks. Regards, DairyKnight ___ 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: KVO can be unsafe in -init?
On Mon, Sep 7, 2009 at 9:36 AM, John Changjohn.r.ch...@gmail.com wrote: This code is running on iPhone OS. On some devices (we haven't been to narrow this down), the last line of code is throwing an exception: Sun Sep 6 13:41:26 unknown MyApp[1609] Error: *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[NSCFDictionary setObject:forKey:]: attempt to insert nil key' Why do you think registering the observer is causing this exception? There's nothing KVO related in this message. ___ 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: Malloc error: GC operation on unregistered thread...
On Sep 7, 2009, at 3:35 PM, Andrew Madsen wrote: My app doesn't crash, and everything seems to work OK, but I'm trying to figure out what this means. This is my first garbage collected app, so I'm guessing there's something about the intricacies of actually using garbage collection that I'm missing. Any pointers? Yes. File a bug with pretty much exactly what you posted to cocoa-dev. When an application causes something to happen on a thread that GC needs to be aware of, but that thread is not registered with the collector, the collector will implicitly register the thread while spewing a note to the console. As Nick said, the behavior change between Leopard and Snow Leopard was to actually log when this happens. In Leopard, the collector just registered the thread, didn't tell you that it registered the thread, and everything kept working just fine. The behavior was changed because some developers were surprised to find collector activity on their threads. Thus, the collector now logs to mitigate surprise. (Of course, some developers were then surprised by the log message. But... but... but... my code cannot possibly run under the garbage collector!!, they said. Well... that's funny... your code has been running under the garbage collector for 18 months and you only noticed it when the collector started telling you. Are you saying your code has been broken for all of that time?, was the response.) As Nick said, as well, if your code is spawning the thread, call objc_registerThreadWithCollector(). If Audio Queue Services entirely controls that particular backtrace, then file a bug via http://bugreport.apple.com/ as mentioned above. b.bum ___ 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: Garbage collection and about windows
On Sep 8, 2009, at 6:45 PM, Ben Haller wrote: My idea — perhaps being too clever for my own good — was that as long as the about window was open, the window would be referenced by the window list, and so the window and its controller would stick around. Choosing the About menu item a second time would therefore just call showWindow: on the controller again, ordering the window to the front if it had gotten buried. As soon as the window was closed, I figured it and its controller would be garbage collected, and the weak reference to it in the app delegate would zero out, so then choosing About would create a new controller and reload the nib. Panels -- NSPanel subclasses -- don't show up in the window list (and aren't visible in the Windows menu on the menu bar, either) and, thus, you'll see the behavior you do. Unless your about panel is ridiculously large complex, make the aboutController __strong and forget about it. It'll only take up memory if a user brings it up -- which will be rare -- and, once that happens, the memory is minimal. b.bum ___ 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
NSArray EXEC_BAD_ACCESS when initalized with strings
Hi all, I have two arrays initalized as follows, the first works fine and I can work with elements in the Array NSArray *majorScaleQuestions = [[NSArray alloc] initWithObjects:@1, @2, @b3, @3, @4, @5, @b6, @6, @7, nil]; the second throws up an EXEC_BAD_ACCESS and the application obviously stops NSArray *newToneNotes = [[NSArray alloc] initWithObjects:@C, @C#, @D, @D#, @E, @F, @F#, @G, @G#, @A, @A#, @B, nil]; if the same array is initalized as NSArray *newToneNotes = [[NSArray alloc] initWithObjects:@C, @C#, @D, nil]; the applications starts up, but if I add @D# and initalize it as follows NSArray *newToneNotes = [[NSArray alloc] initWithObjects:@C, @C#, @D, @D#, nil]; it fails. Can anyone see what I might be doing wrong? Thanks. -- The secret impresses no-one, the trick you use it for is everything - Alfred Borden (The Prestiege) ___ 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: NSTableView doesn't increase the number of elements in table?
Rui, Generally you don't use the data source method of filling up an NSTableView when you use Core Data. Doing so would require you to observe changes to the Managed Object Context, and reload the table manually. Instead, you would usually use an NSArrayController in your NIB instead, and use bindings. This is explained in more detail in Aaron Hillegass's book, a great one and one that I recommend for beginners, called something about starting with Mac OS X development, or something. It's pretty famous around these here parts, I'm sure you can find it somewhere. But remember, use NSArrayController, not manual bindings, when using Core Data. (Usually.) -- Steven Degutis http://www.thoughtfultree.com/ http://www.degutis.org/ On Tue, Sep 8, 2009 at 9:55 AM, Rui Pacheco rui.pach...@gmail.com wrote: Hi all, I've an NSTableView that uses the controller object for the NIB being displayed as the data source. I implement the NSTableView informal protocol. This NSTableView gets its values from Core Data. I startup the application, load all values I have in XML and then display them. My problem is, the NSTableView doesn't seem to add any new rows to the end of the table. If I start the application with no values in permanent storage and add another one (adding values works as I can see them being saved to XML), the table view simply ignores the new value. If I add a value I know will go to the end of the table (the contents are organized alphabetically), I won't see the new value. If I and a value that I know won't go to the end of the table, the value will be added, I will see it on the table, but the last value on the table will be pushed out and become invisible. Has anyone encountered something like this? Any clues to what might be? -- Best regards, Rui Pacheco ___ 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/steven.degutis%40gmail.com This email sent to steven.degu...@gmail.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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: How to remove the Special Characters... menu item?
On Sep 7, 2009, at 6:54 PM, H David Goering h...@cox.net wrote: Incidentally, can anyone explain why this particular menu item is exalted? Because it's the only way to enter certain characters. If I want to turn on certain ligatures or drop math symbols into a text field, I have to use the Special Characters panel. Why do you want to get rid of it? Incidentally, I can just open it from the Language Text menu extra. Or open in it another app and switch to yours. Removing the Special Characters menu item is not going to preclude the user from using the panel. --Kyle Sluder ___ 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: [iPhone] : How to customize Phonepad ?
On Sep 8, 2009, at 8:00 PM, Luke the Hiesterman luket...@apple.com wrote: That is an EXTREMELY fragile approach. Chunk mentioned the international keyboard issue, but there's also the issue of software updates. Keyboards are subject to change with new releases. You should never overlay views on top of the built-in keyboard. If you really want custom stuff, write your own keyboard. And file a bug so Apple knows how many of us might like to do the same thing. :) --Kyle Sluder ___ 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: KVO can be unsafe in -init?
On 08/09/2009, at 12:36 AM, John Chang wrote: Hi all, Question: is it unsafe for some reason to be adding yourself as a KVO observer during -init? We have a singleton with an -init that looks something like this: - (id)init { if ((self = [super init])) { _foo = [[NSMutableDictionary alloc] init]; _bar = [[NSMutableDictionary alloc] init]; [[XYZManager sharedManager] addObserver:self forKeyPath:@allObjects options:NSKeyValueObservingOptionInitial context:NULL]; NSKeyValueObservingInitial will trigger an immediate send of the KVO notification to self. Since you're still inside -init I wouldn't have thought that was generally safe, though it may be in certain cases. Sun Sep 6 13:41:26 unknown MyApp[1609] Error: *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[NSCFDictionary setObject:forKey:]: attempt to insert nil key' So we're stumped as to why KVO is throwing an exception. Because you're trying to use a nil key with a dictionary. Why not set a breakpoint on objc_exception_throw and see where that is being attempted? The only theory is that the NSKeyValueObservingOptionInitial option is causing KVO to do something with self immediately It is. , but self isn't fully set up yet. Though it's unclear why in this particular usage that would be unsafe true, it's unclear. But debugging the exception should show you what's happening. --Graham ___ 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: Framework versioning and handling multiple OS SDK's?
Hey Brent, thanks that helps. This leads me to one more question. Let's say I build my framework with two versions, A and B - A is the base and B includes only the 10.6 features. Is there a way in xcode to specifically tell the linker that it's it's linking against A or B? The reason I ask is because in xcode when you link against a framework you just tell it to link against a .framework folder. But How can tell the loader to load a specific version (A or B) without having to modify the current symlink in the .framework folder? If I can accomplish this, then I can create two build targets. Each just building either A or B, but then when I link against the framework I can have it link A or B. Does that make sense? Thanks On Tue, Sep 8, 2009 at 3:25 PM, Brent Gulanowskibgulanow...@gmail.com wrote: For classes, you can check whether NSClassFromString(@Classname) returns a class. For selectors, you can check whether NSSelectorFromString(@selector) returns a selector. Usually that's enough. In fact, if you pick a representative class that was introduced in the OS release of your choice, you can use that as a short cut to check for the OS version. Or you can check the version major and minor values using Gestalt for accurate version info: file:///Developer/Documentation/DocSets/com.apple.adc.documentation.AppleSnowLeopard.CoreReference.docset/Contents/Resources/Documents/documentation/Carbon/Reference/Gestalt_Manager/Reference/reference.html enum { gestaltSystemVersion = 'sysv' gestaltSystemVersionMajor = 'sys1', gestaltSystemVersionMinor = 'sys2', gestaltSystemVersionBugFix = 'sys3' }; (Those symbols should link right into the file in your docs.) Now, that's pretty awkward because you won't be able to instantiate a class without converting from the classname or send a message without converting the method sig and calling -performSelector: so I'd think the right way would be to build two different versions of your framework and ship them separately, making sure to version them so they can co-exist if necessary. Not that hardly anyone does that. On Tue, Sep 8, 2009 at 12:24 AM, aaron smith beingthexemplaryli...@gmail.com wrote: Hey All, I've got a framework (GDKit) that I maintain - started writing it on 10.5. I'm running into something I'm not sure how to handle. -So far, everything I've been writing in GDKit links against 10.5, and applications I've been writing link against GDKit, and 10.5. -I have some new classes I want to add to the framework, but some of the API's are in 10.6 only. -The new classes and features in my framework are optional - because they require 10.6, but I don't want to have to change all of my applications to require 10.6. It is possible to build a framework against a different version of the OS than an application that depends on it. Although you have to be careful about setting up dependencies in Xcode which might push build settings from the app down to the framework, if you use that feature of Xcode. What I'm trying to figure out is how to keep the framework compiling for 10.5, but optionally including the new features/classes when it's compiling for 10.6. There's just a few things I'm unclear of.. -When it's compiling for 10.5, can I completely exclude files from compiling (the 10.6 features)? Is that the right way to exclude features? Well it seems you're definitely going to have to build two versions of the framework (probably by creating two different build configurations) -- in the 10.5, yes, you won't compile/link those classes which require 10.6. -When I link against GDKit from an application, how can I have the app link against GDKit that include only the 10.5 features? Or optionally link against the build that includes the 10.6 features? The linking is done dynamically. If you want the same compiled version of your app to use different features of your framework depending on where it is and what's available, it will have to explicitly check for the existence of those things. Your app should just link against the framework, not a specific version of it (if you choose to use versions). If it all becomes too onerous to access 10.6-only classes/methods using NSStringFrom... (or, in the case of Carbon/C, some other approach), you would be better off building separate versions of your app. I've been reading about framework versioning, and what they recommend is creating a new major version. But that doesn't really help my problem - as creating a new major version would require the 10.6 SDK. Hopefully that makes sense. Does anyone know of any blog posts or tutorials about this particular situation? Any ideas would be sweet. ___ I'm no expert in targetting multiple OS versions simultaneously, but these are the strategies we use here. Hopefully this will help. (If I've made any errors, I expect they'll get corrected.) -- Brent
Re: KVO can be unsafe in -init?
Hi John, Since you're passing NSKeyValueObservingOptionInitial, -observeValueForKeyPath: is going to be invoked on your object immediately, before the method even returns. Is your -observeValueForKeyPath: safe to be called with a partially set up object? Do you have any subclasses of your object? If so, -observeValueForKeyPath: is getting called on them before they've done their work in init. -Ken On Mon, Sep 7, 2009 at 7:36 AM, John Chang john.r.ch...@gmail.com wrote: Hi all, Question: is it unsafe for some reason to be adding yourself as a KVO observer during -init? We have a singleton with an -init that looks something like this: - (id)init { if ((self = [super init])) { _foo = [[NSMutableDictionary alloc] init]; _bar = [[NSMutableDictionary alloc] init]; [[XYZManager sharedManager] addObserver:self forKeyPath:@allObjects options:NSKeyValueObservingOptionInitial context:NULL]; } return self; } This code is running on iPhone OS. On some devices (we haven't been to narrow this down), the last line of code is throwing an exception: Sun Sep 6 13:41:26 unknown MyApp[1609] Error: *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[NSCFDictionary setObject:forKey:]: attempt to insert nil key' We know that [XYZManager sharedManager] can't be nil, since otherwise -addObserver: would not be getting called, and the first line if ((self = [super init])) ensures that self can't be nil. We're pretty sure that [XYZManager sharedManager].allObjects is not nil, but even if it were nil, that shouldn't cause an exception. -allObjects is a synthesized getter with no dependent keys. No other threads are involved here. So we're stumped as to why KVO is throwing an exception. The only theory is that the NSKeyValueObservingOptionInitial option is causing KVO to do something with self immediately, but self isn't fully set up yet. Though it's unclear why in this particular usage that would be unsafe, or why it would make any difference. Can anyone provide any insight? Thanks, /John Stockholm, Sweden ___ 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/kenferry%40gmail.com This email sent to kenfe...@gmail.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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: usb notification
IOReturnkernErr; You never seem to check for errors. Please ensure your calls are succeeding by checking the value of this variable. If they're failing, use macerror(1) to look up the error number. IOServiceAddMatchingNotification() returns no errors (0). - (id) init { [super init]; if (self) { This is not the correct initializer pattern. You need to assign to self here. --Kyle Sluder Changed this to self = [super init]; However, the issue still persists. Chris ___ 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: NSArray EXEC_BAD_ACCESS when initalized with strings
For some reason, I really doubt that the creation of the NSArray is causing this exception. Have you run this through the debugger and verified this is the exact line that throws the exception? And is that the exact line of code? -- Steven Degutis http://www.thoughtfultree.com/ http://www.degutis.org/ On Tue, Sep 8, 2009 at 10:13 PM, Devraj Mukherjee dev...@gmail.com wrote: Hi all, I have two arrays initalized as follows, the first works fine and I can work with elements in the Array NSArray *majorScaleQuestions = [[NSArray alloc] initWithObjects:@1, @2, @b3, @3, @4, @5, @b6, @6, @7, nil]; the second throws up an EXEC_BAD_ACCESS and the application obviously stops NSArray *newToneNotes = [[NSArray alloc] initWithObjects:@C, @C#, @D, @D#, @E, @F, @F#, @G, @G#, @A, @A#, @B, nil]; if the same array is initalized as NSArray *newToneNotes = [[NSArray alloc] initWithObjects:@C, @C#, @D, nil]; the applications starts up, but if I add @D# and initalize it as follows NSArray *newToneNotes = [[NSArray alloc] initWithObjects:@C, @C#, @D, @D#, nil]; it fails. Can anyone see what I might be doing wrong? Thanks. -- The secret impresses no-one, the trick you use it for is everything - Alfred Borden (The Prestiege) ___ 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/steven.degutis%40gmail.com This email sent to steven.degu...@gmail.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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: How to remove the Special Characters... menu item?
On 08/09/2009, at 11:54 AM, H David Goering wrote: 1. Set NSDisabledCharacterPaletteMenuItem. I do not find this setting, or anything relevant, in XCode. This means you need to add this to your application's preferences (user defaults). I just tried that and it works. --Graham ___ 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: Malloc error: GC operation on unregistered thread...
On Sep 7, 2009, at 4:35 PM, Andrew Madsen wrote: My app doesn't crash, and everything seems to work OK, but I'm trying to figure out what this means. This is my first garbage collected app, so I'm guessing there's something about the intricacies of actually using garbage collection that I'm missing. Any pointers? It's caused by a change made to Snow Leopard. In Leopard, if you created a thread outside of NSThread or NSOperationQueue (e.g. with the pthread functions), then the thread would quietly be implicitly registered for GC. In Snow Leopard, it's still registered implicitly, but now the runtime whines to you about it. There's a function you can call that gets rid of the whine, called objc_registerThreadWithCollector(). However, the function is only present in the 10.6 SDK AFAICT, so this may not be an option if you still need to target Leopard. If you do, then just ignore the warning, or create the thread with NSThread if that would be possible. Nick Zitzmann http://www.chronosnet.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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: usb notification
Not really a Cocoa question, and it's answered in the docs on IOServiceAddMatchingNotification :) The notification is armed when the iterator is emptied by calls to IOIteratorNext - when no more objects are returned, the notification is armed. Note that the notification is not armed when first created. IOServiceAddMatchingNotification(...); CFRunLoopAddSource(...); while (IOIteratorNext(deviceAppearedIterator)); ___ 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 remove the Special Characters... menu item?
On Sep 7, 2009, at 7:54 PM, H David Goering wrote: XCode automatically adds the Special Characters... menu item to applications, but mine doesn't need it, so I'd like to leave it off. That menu item cannot be turned off. Nick Zitzmann http://www.chronosnet.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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: [iPhone] : How to customize Phonepad ?
That is an EXTREMELY fragile approach. Chunk mentioned the international keyboard issue, but there's also the issue of software updates. Keyboards are subject to change with new releases. You should never overlay views on top of the built-in keyboard. If you really want custom stuff, write your own keyboard. Luke On Sep 8, 2009, at 9:35 AM, Chunk 1978 wrote: you can customize the phone pad, or any of the UIKeyboards by creating and drawing your own buttons/views over them. it's a hack, but it can work quite nicely if you're interested in some minimal customization (for example: changing the Go or Done button to display Login or Save). best results will require some photoshop skill. keep in mind that some buttons change shape and position depending on which international keyboard settings the user chooses. here's a tutorial to get you started: http://www.neoos.ch/news/46-development/54-uikeyboardtypenumberpad-and-the-missing-return-key if you really want to customize everything from top to bottom, i suggest you roll your own keyboard. good luck! On Tue, Sep 8, 2009 at 11:53 AM, Luke the Hiestermanluket...@apple.com wrote: You can't customize the phone pad, which is really just an instance of a keyboard. For the stuff you want to do, you should write your own custom view that behaves as you desire. Luke On Sep 8, 2009, at 7:48 AM, Dan Ribe wrote: Sorry for my last mail ... It got sent while I was typing ! Hi All, I am looking for a way to customize the Phonepad provided by the iPhone for my application use. Here is the list I am interested in : - Want to show it at the middle of the screen. - Want to change caption of the button to Call. - Want to change the color/size of the Phonepad. - Also want to customize the keys which will be available to the users (hide special characters other than '+' '#'). Can anyone give me some pointers on this. Any help on this is highly appreciated. Cheers ! -Dan ___ 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/luketheh %40apple.com This email sent to luket...@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: http://lists.apple.com/mailman/options/cocoa-dev/ chunk1978%40gmail.com This email sent to chunk1...@gmail.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: http://lists.apple.com/mailman/options/cocoa-dev/luketheh%40apple.com This email sent to luket...@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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: How to remove the Special Characters... menu item?
On 09/09/2009, at 2:11 PM, H David Goering wrote: I'm new with XCode. I don't find application preferences or user defaults in the XCode UI, the project, or the documentation. I don't find anything that looks relevant in the XCode preferences or in the project setting. It's got little to do with Xcode, your project or build settings. Look up NSUserDefaults in the documentation. That's where you need to add this setting. I find it surprising that you are new to Xcode/Cocoa and yet the first thing you think you need to do is strip out this menu. Isn't this trying to run before you can walk? --Graham ___ 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