Re: Creating methods with variable length arguments terminated by nil
The other night I spent about three hours trying to figure out why some code I had was behaving so strangely. It got to the point where I was convinced I found a bug in gcc - but as always, it was the pilot at fault. It turns out I forgot to terminate several of my variable-argument lists with a nil. At one time, I recall Xcode/gcc warning me about not terminating my varg list with a nil, but recently I found this warning is not enabled by default (perhaps my system's just acting up?). So yeah, I learned pretty quick how useful -Wformat can be; I highly recommend enabling it! David ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Efficiency of loading Localizable.strings and NSUserDefaults
Le 16 juil. 09 à 04:55, Graham Cox a écrit : On 16/07/2009, at 6:45 AM, Development wrote: Anyone has some comments or ideas about this? Possibly someone with some inner understanding of how localized strings are read? Optimise later. You are fretting about the speed of loading strings to the point where you are considering your own look-up scheme - a problem that Cocoa has already solved for you. And all without doing any measurement (presumably - you don't mention any profiling figures). Here's a fact - *drawing* a string takes aeons compared to the time needed to get that string in place ready to be drawn. So no matter how fast you load the strings, your performance will be graphics/ drawing time bound. You mention these being error strings - I find it hard to imagine why performance here matters. Are you wishing to display errors at hundreds of frames per second? How is the user expected to read them? Keep your code simple - use the NSLocalizedString macro or one of the localised string loading methods and worry about performance later if it proves (by actual measurement) necessary. Again, anyone has thoughts or comments about the inner working of NSUserDefaults? Same thing. Read from the defaults as needed. As far as I can tell, NSUserDefaults is basically a disk-backed dictionary, and is kept in memory. Access can be assumed to be fast, or at least fast enough, unless actual measurement shows otherwise. As for flushing to disk every time in case of a crash, I'd say don't even if that is Apple's apparent advice [citation needed]. I don't think you will find this citation in the NSUserDefaults doc. From the -synchronize method: Discussion 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) or if you want to update the user defaults to what is on disk even though you have not made any changes. And from the CFPreferences User Guide: The Rule of Thumb on CFPreferences synchronization: Only synchronize when absolutely necessary___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post 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: Window Resize with Animator Proxy: Window Contents Jump Around
On 13.07.2009, at 15:59, I. Savant wrote: My guess: I think because you're removing (with or without animation) the bottom field / label, you're changing the autosizing behavior of the content view's contents while it's being moved around. On 14.07.2009, at 04:37, Peter N Lewis wrote: One thing that may trip you up is auto resizing. Consider disabling it or making sure it is behaving properly. To check this, I made an extremely simplified version that only has an empty window with the disclosure button and nothing else. I switched off the window's content view's autoresize subviews option and enabled its CA layer backing option: http://www.entropy.ch/git/calayer-resize-test.git Even in this setup, the windows's contents (which consist only of the disclosure button) jump up and down during the animation. It seems enabling CA layer backing is really not an option. I tried the flipped content view, that didn’t help either. Its ridiculously painful isn't it? Indeed... Thanks for the MGViewAnimation hint, that looks promising and I’ll try using that instead... ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post 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] Encrypting data of an iPhone Application / Converting J2ME App functionality
Hi, The Java application uses RC4 Encryption. Could some one help me to encrypt a String with CommonCrypto. I think we can use CCCrypt function to do this. Can anyone point some way. I have worked on below code to encrypt a string. But it did not seem to be working. - (NSString*) encodeToRC4:(NSString*)plainText { const void *vplainText; size_t plainTextBufferSize; plainTextBufferSize = [plainText length]; vplainText = (const void *) [plainText UTF8String]; CCCryptorStatus ccStatus; uint8_t *bufferPtr = NULL; size_t bufferPtrSize = 0; size_t movedBytes = 0; bufferPtrSize = (plainTextBufferSize + kCCBlockSize3DES) ~(kCCBlockSize3DES - 1); bufferPtr = malloc( bufferPtrSize * sizeof(uint8_t)); memset((void *)bufferPtr, 0x0, bufferPtrSize); // memset((void *) iv, 0x0, (size_t) sizeof(iv)); NSString *key = @r...@^$%$**^(*; NSString *initVec = @init Vec; const void *vkey = (const void *) [key UTF8String]; const void *vinitVec = (const void *) [initVec UTF8String]; ccStatus = CCCrypt(kCCEncrypt, kCCAlgorithmRC4, kCCOptionPKCS7Padding, vkey, kCCAlgorithmRC4, vinitVec, vplainText, plainTextBufferSize, (void *)bufferPtr, bufferPtrSize, movedBytes); if (ccStatus == kCCSuccess) NSLog(@SUCCESS); else if (ccStatus == kCCParamError) return @PARAM ERROR; else if (ccStatus == kCCBufferTooSmall) return @BUFFER TOO SMALL; else if (ccStatus == kCCMemoryFailure) return @MEMORY FAILURE; else if (ccStatus == kCCAlignmentError) return @ALIGNMENT; else if (ccStatus == kCCDecodeError) return @DECODE ERROR; else if (ccStatus == kCCUnimplemented) return @UNIMPLEMENTED; NSString *result; NSData *myData = [NSData dataWithBytes:(const void *)bufferPtr length:(NSUInteger)movedBytes]; result = [[NSString alloc] initWithData:myData encoding:NSASCIIStringEncoding]; return result; } Please kindly have a look at how should I correct this. Thank you, Tharindu Madushanka ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post 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
Windowed Video
I would like to play a m4v from my bundle and I am using MPMoviePlayerController to do this. Works great. However in my view the designer would like the video to playback overlaid on top of a graphic of a television set. I don't seem to be able to do this with MPMoviePlayerController. How can I play that asset from my main bundle in a windowed fashion? (ie. I give the x,y and width, height), etc.? I haven't done a whole lot with movie playback yet so I might be unaware of a framework I should be using to accomplish this task. Googling now... Thanks, Eric ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post 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 debugging
On 15 Jul 2009, at 6:14 PM, tmow...@talktalk.net wrote: (gdb) po err Program received signal EXC_BAD_ACCESS, Could not access memory. Reason: KERN_PROTECTION_FAILURE at address: 0x 0x922e668c in objc_msgSend () (Earlier:) NSError *err; BOOL result = [moc save: err]; Are you sure moc isn't nil? Messages to nil yield zero-valued results, so result would be NO, but err would not be set. And I'm sure you've checked it, but have you made sure result is NO? Methods taking NSError ** don't return valid error objects unless they have failed. — 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
Re: Windowed Video
Add a QTMovieView as a subview of another view containing the TV set graphics. --Graham On 16/07/2009, at 10:15 PM, Eric E. Dolecki wrote: I would like to play a m4v from my bundle and I am using MPMoviePlayerController to do this. Works great. However in my view the designer would like the video to playback overlaid on top of a graphic of a television set. I don't seem to be able to do this with MPMoviePlayerController. How can I play that asset from my main bundle in a windowed fashion? (ie. I give the x,y and width, height), etc.? I haven't done a whole lot with movie playback yet so I might be unaware of a framework I should be using to accomplish this task. Googling now... Thanks, Eric ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post 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/graham.cox%40bigpond.com This email sent to graham@bigpond.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
splitView not rendering correctly - where am I wrong ?
Hello everyone! So I have a little problem that I don't know how to fix so if somebody would be kind to help and explain the solution. Problem is that splitView displays subviews that are rendered outside from the visible area of the window so therefore are clipped (not visible). They are clipped after the splitView has been resized in that extend that (only right subview and/or both) subviews had been totally sized down. When resized back up, top (of both subviews) and/or right part (of right subview) are clipped. My guess it has something to do with bounds and/or position of subviews, but since I'm novice in Cocoa and Objective-C I can't see the solution. Here is the code that I'm using for displaying splitView. Thanks in advance! Mario -- - (void)splitView:(NSSplitView *)sender resizeSubviewsWithOldSize:(NSSize)oldSize { NSView *leftView = [[sender subviews] objectAtIndex:0]; NSView *rightView = [[sender subviews] objectAtIndex:1]; float dividerThickness = [sender dividerThickness]; NSRect splitViewFrame = [sender frame]; NSRect leftFrame = [leftView frame]; NSRect rightFrame = [rightView frame]; int differenceInWidth = splitViewFrame.size.width - oldSize.width; leftFrame.size.height = newFrame.size.height; leftFrame.origin = newFrame.origin; if (differenceInWidth 0) { rightFrame.size.width += differenceInWidth; } else if (differenceInWidth 0) { rightFrame.size.width += differenceInWidth; } rightFrame.size.width = splitViewFrame.size.width - leftFrame.size.width - dividerThickness; rightFrame.size.height = newFrame.size.height; rightFrame.origin.x = newFrame.origin.x + leftFrame.size.width + dividerThickness; [leftView setFrame:leftFrame]; [rightView setFrame:rightFrame]; [sender adjustSubviews]; [sender display]; } ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post 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: Windowed Video
In fairness he did ask about MPMoviePlayerController which as far as I'm aware doesn't exist on the Mac. On 16 Jul 2009, at 15:19, Graham Cox wrote: Of course, because you didn't mention it, I didn't realise you were talking about the iPhone, which might not have QTMovieView like the Mac does, which is (I tend to assume) the default platform discussed here. It would be useful if people could prefix their messages with iPhone in some way so we know what context your questions are in (or can filter them out ;-) --Graham On 17/07/2009, at 12:13 AM, Graham Cox wrote: Add a QTMovieView as a subview of another view containing the TV set graphics. --Graham On 16/07/2009, at 10:15 PM, Eric E. Dolecki wrote: I would like to play a m4v from my bundle and I am using MPMoviePlayerController to do this. Works great. However in my view the ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post 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/cocoadev%40mikeabdullah.net This email sent to cocoa...@mikeabdullah.net ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: splitView not rendering correctly - where am I wrong ?
On 17/07/2009, at 12:55 AM, Mario Kušnjer wrote: Here is the code that I'm using for displaying splitView. I suggest removing it. You don't normally need to write any code to make a split view work unless you have some unusual constraint requirements. Mostly it can be set in IB. --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: Windowed Video
On 17/07/2009, at 1:02 AM, Mike Abdullah wrote: In fairness he did ask about MPMoviePlayerController which as far as I'm aware doesn't exist on the Mac. True, but I had to Google for it to find out it was an iPhone class - it could equally have been something third party as far as this Mac developer knew (I don't have the iPhobe SDK even). In the absence of any other info, suggesting QTMovieView seems reasonable - doesn't the iPhone have an equivalent? --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: [iPhone] Encrypting data of an iPhone Application / Converting J2ME App functionality
You might have better luck posting to the CDSA list (it's for crypto and security issues). Dave On Jul 16, 2009, at 3:13 AM, Tharindu Madushanka wrote: Hi, The Java application uses RC4 Encryption. Could some one help me to encrypt a String with CommonCrypto. I think we can use CCCrypt function to do this. Can anyone point some way. I have worked on below code to encrypt a string. But it did not seem to be working. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post 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
Problems displaying an image in UIWebView
I am trying to show an image from my Resources directory on a UIWebView along with toms text. I create the UIWebView using loadHTMLString:baseURL:. The string I pass has all of my content in html - the img tag and text. The text gets displayed but the image is shown as a broken link (in the simulator). When I copy the HTML string, paste it to a file, and open that under Safari it works fine. What could be going wrong in the simulator? Hrishi ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post 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: Printing a View [solved]
On Wed, 15 Jul 2009 21:23:29 -0700, K. Darcy Otto do...@csusb.edu said: For those who are working on a similar problem, I created new view controller object from -printOperationWithSettings:, and that view object in turn creates the view that I want to print. That view implements various other subviews, but I was still having problems breaking pages at appropriate points. The subviews, however, can say where they should be broken by using -adjustPageHeightNew:. Bravo. Wherever possible, this is one of the main ways I like to print! Typically, in this architecture, my printing NSView is created at print time (because its size depends upon the paper size) and its drawRect contains no code at all; it's the subviews who are doing the real work. And if they are built-in views, maybe *their* drawRect contains no code at all. And then way down at the bottom of the subview hierarchy there are the particular subviews who implement adjustPageHeightNew:; they are saying, I don't know what's going on at a higher level, but whatever you do, don't split me across pages! In my NSTableView subclass, which was the main element in the view, I implemented that method as follows: -(void)adjustPageHeightNew:(CGFloat *)newBottom top:(CGFloat)top bottom:(CGFloat)proposedBottom limit:(CGFloat)bottomLimit { *newBottom = proposedBottom; NSInteger indexCount = [deduction lineCount]-1; for (NSInteger i = indexCount; i0; i--) { NSRect rowRect = [self frameOfCellAtColumn:[self columnWithIdentifier:@MyColumn] row:i]; float bottomOfRow = rowRect.origin.y + rowRect.size.height; if (bottomOfRow proposedBottom) { *newBottom = bottomOfRow + 1.0; break; } } } So, the for loop just goes through the table and adjusts *newBottom so that it breaks at appropriate places. There is probably some more efficient way to check where the page should be broken, but the above implementation works just fine. Well, that looks horrible. :) I've never printed an NSTableView so I find this approach surprising. In the first place, as Graham Cox has already said, the loop is repulsive (okay, he didn't actually go that far); if row height is constant, a simple division and use of mod should tell you the answer instantly. (Put a log on your loop and I think you'll be amazed how many times it's being called in the course of printing.) But in the second place, instead of printing an NSTableView, what I would do is print the *data*. So each row - each piece of data - is an NSView of some sort. And of course it would implement adjustPageHeightNew. So when the printing framework is ready to paginate, it would just as *that one row* whether it is okay to split it across pages, that one row would say NO!, and the whole thing would happen instantly. No loop, no table view, no muss, no fuss. m. -- matt neuburg, phd = m...@tidbits.com, http://www.tidbits.com/matt/ A fool + a tool + an autorelease pool = cool! AppleScript: the Definitive Guide - Second Edition! http://www.tidbits.com/matt/default.html#applescriptthings ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post 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
Convention for class name prefixing . . .
So, what is the convention? I assume I should prefix my class names so that I minimize potential for name space conflict, but what should I use as a prefix? The options readily available to me are: 1) Developer or company name 2) Application or framework name Given that I have a Protocol Engine app or framework with a class called ProtocolDatabase, I would have the following options: MCProtocolDatabase MACProtocolDatabase CDEProtocolDatabase PEProtocolDatabase Using my name 'Michael A. Crawford' or my company name 'Crawford Design Engineering' or the app name 'ProtocolEngine'. Should the prefix be limited to a certain number of characters? 2 or 3, for example. Or, is it acceptable to use a higher number (4 or 5) of characters in the prefix? I'm used to namespaces, which I use in C++ and used to use when writing C# code. Discussion? Thanks. -Michael -- The united stand. The divided get played. -- Bernie MAC 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: Problems displaying an image in UIWebView
Forgot to add: I am accessing the image file like this NSString *imageName = [[NSBundle mainBundle] pathForResource:@myImage ofType:@png]; I have confirmed (using NSLog) the path printed in the img tag is correct img align=center src=/Users/hrishi/Library/Application Support/iPhone Simulator/User/Applications/87888BAB-2F9D-44F6-BEB8-FB7D65D2F1CC/Epicures.app/myImage.png / Hrishi On 7/16/09 8:57 PM, M.S. Hrishikesh wrote: I am trying to show an image from my Resources directory on a UIWebView along with toms text. I create the UIWebView using loadHTMLString:baseURL:. The string I pass has all of my content in html - the img tag and text. The text gets displayed but the image is shown as a broken link (in the simulator). When I copy the HTML string, paste it to a file, and open that under Safari it works fine. What could be going wrong in the simulator? Hrishi ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post 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: splitView not rendering correctly - where am I wrong ?
Hi Mario, Just want to add a short note to what Graham Cox said about using Interface Builder. Be sure to read the section Setting a View's Autosizing Behavior in Interface Builder User Guide and take some time to experiment with setting springs and struts for various views and subviews. You can make a window with split views containing scroll views, etc. and try out your settings with Simulate Interface, which is on IB's file menu. You don't even need to have Xcode running to do this. It's a bit confusing at first (at least it was for me), but once you see how it works, it will all make sense. Boyd On Jul 16, 2009, at 7:55 AM, Mario Kušnjer wrote: Hello everyone! So I have a little problem that I don't know how to fix so if somebody would be kind to help and explain the solution. Problem is that splitView displays subviews that are rendered outside from the visible area of the window so therefore are clipped (not visible). They are clipped after the splitView has been resized in that extend that (only right subview and/or both) subviews had been totally sized down. When resized back up, top (of both subviews) and/or right part (of right subview) are clipped. My guess it has something to do with bounds and/or position of subviews, but since I'm novice in Cocoa and Objective-C I can't see the solution. Here is the code that I'm using for displaying splitView. Thanks in advance! Mario -- - (void)splitView:(NSSplitView *)sender resizeSubviewsWithOldSize: (NSSize)oldSize { NSView *leftView = [[sender subviews] objectAtIndex:0]; NSView *rightView = [[sender subviews] objectAtIndex:1]; float dividerThickness = [sender dividerThickness]; NSRect splitViewFrame = [sender frame]; NSRect leftFrame = [leftView frame]; NSRect rightFrame = [rightView frame]; int differenceInWidth = splitViewFrame.size.width - oldSize.width; leftFrame.size.height = newFrame.size.height; leftFrame.origin = newFrame.origin; if (differenceInWidth 0) { rightFrame.size.width += differenceInWidth; } else if (differenceInWidth 0) { rightFrame.size.width += differenceInWidth; } rightFrame.size.width = splitViewFrame.size.width - leftFrame.size.width - dividerThickness; rightFrame.size.height = newFrame.size.height; rightFrame.origin.x = newFrame.origin.x + leftFrame.size.width + dividerThickness; [leftView setFrame:leftFrame]; [rightView setFrame:rightFrame]; [sender adjustSubviews]; [sender display]; } ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post 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/bcollier%40sunstroke.sdsu.edu This email sent to bcoll...@sunstroke.sdsu.edu ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post 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: Problems displaying an image in UIWebView
Post some code. What does your HTML look like? Does it use a relative or absolute URL for the image? What format is your image? What are you passing in for baseURL? On 16 Jul 2009, at 16:27, M.S. Hrishikesh wrote: I am trying to show an image from my Resources directory on a UIWebView along with toms text. I create the UIWebView using loadHTMLString:baseURL:. The string I pass has all of my content in html - the img tag and text. The text gets displayed but the image is shown as a broken link (in the simulator). When I copy the HTML string, paste it to a file, and open that under Safari it works fine. What could be going wrong in the simulator? Hrishi ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post 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/cocoadev%40mikeabdullah.net This email sent to cocoa...@mikeabdullah.net ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Windowed Video
On Jul 16, 2009, at 8:08 AM, Graham Cox wrote: In the absence of any other info, suggesting QTMovieView seems reasonable - doesn't the iPhone have an equivalent? No. The iPhone SDK does not support playing a movie in a window. Enhancement Request would be the best way to go here. -- David Duncan Apple DTS Animation and Printing ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post 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: Problems displaying an image in UIWebView
On 16 Jul 2009, at 17:28, M.S. Hrishikesh wrote: Forgot to add: I am accessing the image file like this NSString *imageName = [[NSBundle mainBundle] pathForResource:@myImage ofType:@png]; I have confirmed (using NSLog) the path printed in the img tag is correct img align=center src=/Users/hrishi/Library/Application Support/ iPhone Simulator/User/Applications/87888BAB-2F9D-44F6-BEB8- FB7D65D2F1CC/Epicures.app/myImage.png / Ah there we go then: Paths != URLs Construct an NSURL object for your resource and use a string representation of that in your HTML. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post 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: Problems displaying an image in UIWebView [solved]
Adding file:// to the src tag fixed it. I also replaces all spaces with %20 (example Application Support with Application%20Support) but I dont think that matters. img align=center src=/file://Users/hrishi/Library/Application Support/iPhone Simulator/User/Applications/87888BAB-2F9D-44F6-BEB8-FB7D65D2F1CC/Epicures.app/myImage.png / Hrishi On 7/16/09 9:58 PM, M.S. Hrishikesh wrote: Forgot to add: I am accessing the image file like this NSString *imageName = [[NSBundle mainBundle] pathForResource:@myImage ofType:@png]; I have confirmed (using NSLog) the path printed in the img tag is correct img align=center src=/Users/hrishi/Library/Application Support/iPhone Simulator/User/Applications/87888BAB-2F9D-44F6-BEB8-FB7D65D2F1CC/Epicures.app/myImage.png / Hrishi On 7/16/09 8:57 PM, M.S. Hrishikesh wrote: I am trying to show an image from my Resources directory on a UIWebView along with toms text. I create the UIWebView using loadHTMLString:baseURL:. The string I pass has all of my content in html - the img tag and text. The text gets displayed but the image is shown as a broken link (in the simulator). When I copy the HTML string, paste it to a file, and open that under Safari it works fine. What could be going wrong in the simulator? Hrishi ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post 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: Convention for class name prefixing . . .
On Thu, Jul 16, 2009 at 9:14 AM, Michael A. Crawfordmichaelacrawf...@mac.com wrote: So, what is the convention? I assume I should prefix my class names so that I minimize potential for name space conflict, but what should I use as a prefix? The options readily available to me are: Choose whatever makes you happy that isn't going to conflict with other things. You might want to use separate prefixes per project so that if you start sharing code between them you don't cause a conflict. I'm used to namespaces, which I use in C++ and used to use when writing C# code. Please join in the enhancement requests. The lack of ObjC namespaces is more than frustrating. --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
Sending actions with a custom NSControl subclass
Hello, During my recent encounter with custom NSControl and NSCell subclasses I found this amazing nugget on cocoadev.com. ..If you write an NSControl subclass without using cells, and you want to use target/actions, you have to link your Control with a NSActionCell? by adding in your NSControl subclass implementation eg +(Class) cellClass { return [NSActionCell? class]; } This works perfectly for me but why the question marks? Is there some uncertainty about whether this is the correct way to go? Thanks, Stephen. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post 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: Sending actions with a custom NSControl subclass
On Jul 16, 2009, at 1:42 PM, Stephen Blinkhorn wrote: During my recent encounter with custom NSControl and NSCell subclasses I found this amazing nugget on cocoadev.com. ... This works perfectly for me but why the question marks? Is there some uncertainty about whether this is the correct way to go? No uncertainty. It's a wiki. The camel notation MakesThatALink but there's NoPageByThatName? (because nobody ever filled in what it thinks is a stub) so there's a question mark beside it. -- I.S. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
System images in a UIImage
Is there any way to get a UIImage of the system images on the iPhone? i.e. how would I get a UIImage of the Play, Pause, Rewind, Fast Forward etc images used on UIBarButtonItems. I seem to recall seeing this in the earlier betas, but can't find it now... Thanks. Rick ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post 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: Sending actions with a custom NSControl subclass
On 16 Jul 2009, at 11:44, I. Savant wrote: No uncertainty. It's a wiki. The camel notation MakesThatALink but there's NoPageByThatName? (because nobody ever filled in what it thinks is a stub) so there's a question mark beside it. Oh yeah, so that's why it is a different colour and underscored.. thanks! Stephen ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post 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
Finder Kind Entry
I have searched the list archives and Google to no avail in trying to determine how the Kind value shown in the Finder is set. My initial thought was that the UTTypeDescription entry under UTExportedTypesDeclarations in the info.plist for a QuickLook Generator was the answer as the docs say this is a user viewable entry. But no, the Kind entry shows Plain Text. Recognizing this is not a Cocoa question I post here because of the wealth of knowledge available. Note, I have posted to the QuickLook list but the traffic there is minimal, no posts other than mine for over 24 hours. Any suggestions, directions or tips gladly accepted. Thanks. db ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post 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
When filing bugs with RADAR are attachments confidential?
If I attach sample code from my app, is it out there for all to see? -Michael -- We know as much about software quality problems as they knew about the Black Plague in the 1600s. We've seen the victims' agonies and helped burn the corpses. We don't know what causes it; we don't really know if there is only one disease. We just suffer - and keep pouring our sewage into our water supply. -- Unknown 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
Crash in ATIRadeonX2000GLDriver/IKImageFlowView - any workaround?
Hello, I hope it's OK to discuss an undocumented class on the list. You can set the background color of the IKImageFlowView in ImageKit with either -(void)setBackgroundColor: or -(void)_setBackgroundColorRed:green:blue:alpha:. This works fine on most machines, but will inevitably cause a crash on systems with the ATIRadeonX2000GLDriver. I have verified this on a number of machines (10). A crash log is pasted below - they all look the same. It seems the crash occurs in IKImageFlowCell's drawRect:inRect:fromRect... method. (Using the default black background works fine). I have tried setting the color with: NSColor *color = [NSColor colorWithDeviceRed:0.839f green:0.866f blue:0.898f alpha:1.0f]; [super setBackgroundColor:color]; as well as: [super _setBackgroundColorWithRed:0.839 green:0.866 blue:0.898 alpha:1.0]; Both methods result in a EXC_BAD_ACCESS in the ATIRadeonX2000GLDriver when drawing the image flow cell. I don't know if this is a bug in the driver or in Image Kit, but hope there might be someone on the list with some insights into this who can tell me if it is possible to avoid this crash somehow. Thanks in advance. Process: myApp [379] Path:/Users/User/Downloads/myApp.app/Contents/MacOS/myApp Identifier: com.my.app Version: ??? Code Type: X86 (Native) Parent Process: launchd [68] Date/Time: 2009-06-29 10:25:11.278 +0200 OS Version: Mac OS X 10.5.7 (9J61) Report Version: 6 Anonymous UUID: 728B0885-C3EB-47D1-BCF4-0E72ACE68FA8 Exception Type: EXC_BAD_ACCESS (SIGBUS) Exception Codes: KERN_PROTECTION_FAILURE at 0x Crashed Thread: 0 Thread 0 Crashed: 0 ...pple.ATIRadeonX2000GLDriver 0x0c410224 gldAllocVertexBuffer + 13252 1 ...pple.ATIRadeonX2000GLDriver 0x0c42a17b gldInitDispatch + 76315 2 ...pple.ATIRadeonX2000GLDriver 0x0c42ae40 gldInitDispatch + 79584 3 ...pple.ATIRadeonX2000GLDriver 0x0c42afa4 gldInitDispatch + 79940 4 ...pple.ATIRadeonX2000GLDriver 0x0c432ccb gldGetQueryInfo + 14107 5 ...pple.ATIRadeonX2000GLDriver 0x0c41747b gldUpdateDispatch + 2875 6 GLEngine0x0c260998 glBegin_Exec + 296 7 com.apple.imageKit 0x971d3cfa -[IKImageFlowCell drawImage:inRect:fromRect:alpha:fog:premultiplied:gradient:interpolate:shader:] + 1010 8 com.apple.imageKit 0x971d464f -[IKImageFlowCell drawImage:inRect:forAA:reflection:alpha:fog:baseline:] + 1842 9 com.apple.imageKit 0x971d4c8d -[IKImageFlowCell drawPlaceHolder:inRect:reflection:] + 675 10 com.apple.imageKit 0x971d542b -[IKImageFlowCell draw] + 1658 11 com.apple.imageKit 0x971dcc6f -[IKImageFlowView drawVisibleCells:] + 822 12 com.apple.imageKit 0x971db74f -[IKImageFlowView drawWithCurrentRendererInRect:] + 188 13 com.apple.imageKit 0x971dc070 -[IKImageFlowView drawRect:] + 491 14 com.apple.AppKit0x958c622c -[NSView _drawRect:clip:] + 3853 15 com.apple.AppKit0x958c4d23 -[NSView _recursiveDisplayAllDirtyWithLockFocus:visRect:] + 1050 16 com.apple.AppKit0x958c50ba -[NSView _recursiveDisplayAllDirtyWithLockFocus:visRect:] + 1969 17 com.apple.AppKit0x958c3679 -[NSView _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:] + 759 18 com.apple.AppKit0x958c44d3 -[NSView _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:] + 4433 19 com.apple.AppKit0x958c44d3 -[NSView _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:] + 4433 20 com.apple.AppKit0x958c2fbb -[NSThemeFrame _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:] + 306 21 com.apple.AppKit0x958bfadf -[NSView _displayRectIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:] + 3090 22 com.apple.AppKit0x958004b3 -[NSView displayIfNeeded] + 933 23 com.apple.AppKit0x95800061 -[NSWindow displayIfNeeded] + 189 24 com.apple.AppKit0x957ffe84 _handleWindowNeedsDisplay + 436 25 com.apple.CoreFoundation0x94ea7942 __CFRunLoopDoObservers + 466 26 com.apple.CoreFoundation0x94ea8c9c CFRunLoopRunSpecific + 844 27 com.apple.CoreFoundation0x94ea9c78 CFRunLoopRunInMode + 88 28 com.apple.HIToolbox 0x9274328c RunCurrentEventLoopInMode + 283 29 com.apple.HIToolbox 0x927430a5 ReceiveNextEventCommon + 374 30 com.apple.HIToolbox 0x92742f19 BlockUntilNextEventMatchingListInMode + 106 31 com.apple.AppKit0x957fdd0d _DPSNextEvent + 657 32 com.apple.AppKit0x957fd5c0 -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:] + 128
Re: When filing bugs with RADAR are attachments confidential?
On Thu, Jul 16, 2009 at 11:19 AM, Michael A. Crawfordmichaelacrawf...@mac.com wrote: If I attach sample code from my app, is it out there for all to see? Best to ask ADC folks directly for questions like these... but no radar's are currently only visible to those that submit them and those inside of Apple. -Shawn ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post 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 debugging (Fritz Anderson)
On 17 Jul 2009, at 00:13 AM, Fritz Anderson fri...@manoverboard.org wrote: On 15 Jul 2009, at 6:14 PM, tmow...@talktalk.net wrote: (gdb) po err Program received signal EXC_BAD_ACCESS, Could not access memory. Reason: KERN_PROTECTION_FAILURE at address: 0x 0x922e668c in objc_msgSend () (Earlier:) NSError *err; BOOL result = [moc save: err]; Are you sure moc isn't nil? Messages to nil yield zero-valued results, so result would be NO, but err would not be set. And I'm sure you've checked it, but have you made sure result is NO? Methods taking NSError ** don't return valid er ror objects unless they have failed. — F Thank you very much for your persistence. Of course it turned out that the moc reference was nil. The moc ivar was in my application controller which I was trying to set in the init method. Since both the application controller and the application delegate are instantiated from the main NIB the delegate was still nil when it was called. I have removed it completely and just called the longer winded [[NSApp delegate] managedObjectContext] when I need it. I suppose I could have set the ivar in the awakeFromNib when all NIB objects are guaranteed to have been instantiated. Being used to Java I tend to forget about the object being instantiated via the NIB and to be careful with lifetime issues surrounding it. If some others read this and avoid the same silly mistake then it will have been useful. Anyway once again thank you for your help. Tim Mowlem ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post 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 debugging
NSError *err; BOOL result = [moc save: err]; Make sure you initialize err: NSError *err = nil; Otherwise, you may be dealing with a bogus error object, since method-scope variables are not automatically initialized to 0. (Instance variables are initialized, btw.) I don't think that would affect the return value of save, but it's a good habit either way. -BJ ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post 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 in ATIRadeonX2000GLDriver/IKImageFlowView - any workaround?
On Thu, Jul 16, 2009 at 11:47 AM, slasktrattena...@gmail.comslasktrattena...@gmail.com wrote: I hope it's OK to discuss an undocumented class on the list. It's not. File a bug at http://bugreport.apple.com asking for this API. In the meantime, heed the Apple developers' humorous warning found here: http://ericasadun.com/iPhoneDocs300/_u_i_view_controller-_u_i_view_controller_class_dump_warning_8h-source.html --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: Core Data debugging
NSError *err; BOOL result = [moc save: err]; Make sure you initialize err: NSError *err = nil; Otherwise, you may be dealing with a bogus error object, since method-scope variables are not automatically initialized to 0. (Instance variables are initialized, btw.) I don't think that would affect the return value of save, but it's a good habit either way. It doesn't and the initial value of err is irrelevant unless your code is broken. You should *never* assume *anything* about the value of err across a call to -save: or any other similar method *unless* the result indicates an error. Similarly, you should *never* pass an instance of NSError into something like save: and assume that you'll get it back in the case of an error. (I have seen both bugs a number of times.) 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: Reference Count Underflow when Writing PDF
On Jul 15, 2009, at 6:25 PM, K. Darcy Otto wrote: (1) Contrary to my first message, it appears to me now that PDFDocument inherits from NSObject. So, i shouldn't have to do any special memory management, right? You shouldn't. It is a bug in the PDFKit framework. Please file a bug via http://bugreport.apple.com/. (2) The malloc error doesn't seem to stop the program, and everything is written to the appropriate file. Can I just leave the code as it is and ignore the error, or will it eventually catch up with me? Beyond spamming the console, it won't cause a problem. (3) Is there another way to do what I've tried to do, I guess not using PDFDocument (if that is indeed the culprit, and not my own code)? Nope -- it is the innards of PDFDocument that is busted and there isn't anything you can do about it (other than file a bug so we can capture that it is being encountered in The Real World). 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: Core Data debugging
On Thu, Jul 16, 2009 at 1:26 PM, Bill Bumgarnerb...@mac.com wrote: You should *never* assume *anything* about the value of err across a call to -save: or any other similar method *unless* the result indicates an error. This makes many people's lives difficult. It's kinda bogus that if I pass in the address of a pointer-to-NULL and receive back a YES that I have to turn around and re-NULL that pointer before reusing it. Many AppKit methods have a tendency to set the *error argument to 0x8 when they return YES, causing havoc with our error-wrapping macros. --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: Crash in ATIRadeonX2000GLDriver/IKImageFlowView - any workaround?
On Thu, Jul 16, 2009 at 10:27 PM, Kyle Sluderkyle.slu...@gmail.com wrote: On Thu, Jul 16, 2009 at 11:47 AM, slasktrattena...@gmail.comslasktrattena...@gmail.com wrote: I hope it's OK to discuss an undocumented class on the list. It's not. Oh, too bad... Well, thanks anyway. File a bug at http://bugreport.apple.com asking for this API. Yep, I did already. In the meantime, heed the Apple developers' humorous warning found here: http://ericasadun.com/iPhoneDocs300/_u_i_view_controller-_u_i_view_controller_class_dump_warning_8h-source.html Haha, very funny :) ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post 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 debugging
On Jul 16, 2009, at 1:37 PM, Kyle Sluder wrote: This makes many people's lives difficult. It's kinda bogus that if I pass in the address of a pointer-to-NULL and receive back a YES that I have to turn around and re-NULL that pointer before reusing it. Many AppKit methods have a tendency to set the *error argument to 0x8 when they return YES, causing havoc with our error-wrapping macros. Then your macros are buggy. Given: NSError *foo; result = [moc save: foo]; (1) if the result is NO, the value of foo is undefined. (2) If result is YES, foo *must* be set to a valid NSError (3) -save: *must not* assume anything about foo; must not treat it is a valid pointer to anything. Setting foo to NULL before the call is a wasted instruction. Checking foo for NULL after the call doesn't make sense since you have to test result to know if foo was set. For completeness, the above is distinct from [moc save: NULL]; -save: does check for a NULL and the common optimization is to not create an NSError at all. 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
movieFileTypes, imageFileTypes and Info.plist's
I'm using code something like this to build a list of file types that my application can read: NSArray *movieTypes = [[QTMovie movieFileTypes:QTIncludeCommonTypes] retain]; NSArray *imageTypes = [[NSImage imageFileTypes] retain]; allTypes = [[imageTypes arrayByAddingObjectsFromArray:movieTypes] retain]; Since I'm using QuickTime and NSImage to convert all of those formats into my own internal format, my application can handle most files that QuickTime or NSImage can. Because I'm using those image type lists in my open panel, users can open any of those filetypes from within my app. However, users can't drop image or movie files onto my application, or open them in my app using the Finder's 'Open With' menu item because my Info.plist file doesn't list all of them (or any of them, actually). Are there any options for having the Finder recognize that my app can read any file QuickTime can? Or do I need to manually maintain a list of filetypes in my Info.plist? Thanks! Andrew ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post 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
iTunes COM interface for Windows; need the equivalent for iTunes on the Mac
So, is there an SDK for accessing iTunes on the Mac? -Michael -Michael -- The united stand. The divided get played. -- Bernie MAC 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
ibtool and genstrings do nothing
I am trying to use genstrings: genstrings AppDelegate.m Appdel.strings from the terminal window and I get no errors and no output. Likewise when I do ibtoo -generate-strings-file MainWindow.nib MainWindow.xib I get no error and no output. I am in the terminal in the correct directory so I have no idea what I'm doing wrong ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Core Data debugging (Fritz Anderson)
On Jul 16, 2009, at 12:51 PM, tmow...@talktalk.net wrote: I have removed it completely and just called the longer winded [[NSApp delegate] managedObjectContext] when I need it. I suppose I could have set the ivar in the awakeFromNib when all NIB objects are guaranteed to have been instantiated. In general, you are discouraged from retrieving resources such as this from the application delegate. Instead, you should pass resources directly to view controllers. This is the pattern shown in the Core Data templates and related sample code, e.g. - (void)applicationDidFinishLaunching:(UIApplication *)application { RootViewController *rootViewController = (RootViewController *) [navigationController topViewController]; rootViewController.managedObjectContext = self.managedObjectContext; [window addSubview:[navigationController view]]; [window makeKeyAndVisible]; } This typically makes your view controllers more self-contained and reusable. 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
Re: iTunes COM interface for Windows; need the equivalent for iTunes on the Mac
On Jul 16, 2009, at 3:42 PM, Michael A. Crawford wrote: So, is there an SDK for accessing iTunes on the Mac? AppleScript? 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: movieFileTypes, imageFileTypes and Info.plist's
On 16 Jul 2009, at 22:12, Andrew Salamon wrote: I'm using code something like this to build a list of file types that my application can read: NSArray *movieTypes = [[QTMovie movieFileTypes:QTIncludeCommonTypes] retain]; NSArray *imageTypes = [[NSImage imageFileTypes] retain]; allTypes = [[imageTypes arrayByAddingObjectsFromArray:movieTypes] retain]; Since I'm using QuickTime and NSImage to convert all of those formats into my own internal format, my application can handle most files that QuickTime or NSImage can. Because I'm using those image type lists in my open panel, users can open any of those filetypes from within my app. However, users can't drop image or movie files onto my application, or open them in my app using the Finder's 'Open With' menu item because my Info.plist file doesn't list all of them (or any of them, actually). Are there any options for having the Finder recognize that my app can read any file QuickTime can? Or do I need to manually maintain a list of filetypes in my Info.plist? Pretty certain you do need to this manually. One option could perhaps be to declare your plist as just accepting public.image and public.movie though. It would be possible for the user to drop an unsupported file type, but it would cover everything your above code does. And presumably it would be fairly rare for someone to drop in a video format that QuickTime can't handle. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post 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: iTunes COM interface for Windows; need the equivalent for iTunes on the Mac
Or, if you want something more code-y, try the Scripting Bridge: http://developer.apple.com/documentation/Cocoa/Conceptual/ScriptingBridgeConcepts/UsingScriptingBridge/UsingScriptingBridge.html#//apple_ref/doc/uid/TP40006104-CH4-DontLinkElementID_11 -BJ On Thu, Jul 16, 2009 at 3:55 PM, Nick Zitzmann n...@chronosnet.com wrote: On Jul 16, 2009, at 3:42 PM, Michael A. Crawford wrote: So, is there an SDK for accessing iTunes on the Mac? AppleScript? 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/bjhomer%40gmail.com This email sent to bjho...@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: Core Data debugging
On Jul 16, 2009, at 1:58 PM, Bill Bumgarner wrote: Then your macros are buggy. According to the rules now, quite possibly. But the rules are kinda busted. One place that looking at *outError and being able to assume it would be nil on the *entry* to a NSError-returning method is when you are stacking errors. This is woefully underused in general, but NSUnderlyingError is very useful for diagnosing reports from users. I don't want to get a report from a user that says the document couldn't be saved. I want one that says the document couldn't be saved _because_ the file x couldn't be written _because_ the disk is full. NSUnderlyingError is *great* for this, so encouraging its use would make my life easier. As an aside, I'm not proposing displaying the full error stack to the novice user in an NSAlert, I just want it for debugging/support. So, if you have: - (BOOL)foo:(NSError **)outError; { if (![self bar:outError]) { xxx; return NO; } if (something else bad that doesn't use NSError) { yyy; return NO; } } then at xxx you'd like to build a new NSError that has *outError (if outError != NULL) as the underlying error. This is perfectly OK since we are on the failure side. Unless the developer of -bar: forgot to actually set *outError (clang should check this, see the Radar below) — so this is yet another case where a convention of setting it to nil and leaving it alone would be helpful. I'd rather get some less informative error stack than a crash. But, what would be really convenient, and thus reduce programmer error, would be to be able to use the same macro at yyy were we are creating a base NSError w/o any underlying error. As the calling convention stands now, we can't since we can't depend on the caller to have initialized *outError. So, instead we have to remember to use two different patterns of code depending on whether we are creating a stacked error or a base error. This is especially fragile under code motion when refactoring (can lose the hook to an underlying error or start mistakenly looking at pointer contents we shouldn't). Sure, the rules are the rules, and we should follow them or fear unexpected sudden termination. But, if these rules are the indented behavior, I would respectfully submit that the intension is the buggy bit =) Performance is a non-issue here. Correct behavior on the (relatively rarely tested) error path and programmer convenience are the issue. I love NSError, but a revised set of rules would make it less sucky to use. And, of course, with clang-sa we have some nice tools to help people migrate to a better set of rules (Radar 6990911: clang should check more NSError conventions), perhaps in some glorious 10.N future. I note the nil-initialization problem in that Radar, but I can happily log another Radar if you don't think it would be redundant. Or, you know, even if it is =) -tim ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post 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: ibtool and genstrings do nothing
genstrings does not produce output. It does, however, produce Appdel.strings. -BJ On Thu, Jul 16, 2009 at 3:51 PM, Development developm...@fornextsoft.comwrote: I am trying to use genstrings: genstrings AppDelegate.m Appdel.strings from the terminal window and I get no errors and no output. Likewise when I do ibtoo -generate-strings-file MainWindow.nib MainWindow.xib I get no error and no output. I am in the terminal in the correct directory so I have no idea what I'm doing wrong ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/bjhomer%40gmail.com This email sent to bjho...@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: Core Data debugging
On Jul 16, 2009, at 15:19, Timothy Wood wrote: then at xxx you'd like to build a new NSError that has *outError (if outError != NULL) as the underlying error. This is perfectly OK since we are on the failure side. Unless the developer of -bar: forgot to actually set *outError (clang should check this, see the Radar below) — so this is yet another case where a convention of setting it to nil and leaving it alone would be helpful. I'd rather get some less informative error stack than a crash. Aside: If the developer of bar forgot to set *outError, then the developer of bar forgot to set an output parameter, and that's not just a bug on the developer's part, but a *horrible* bug. Setting the error to nil wouldn't help if the bar then set it to something invalid. If bar has a horrible bug like that, you can't assume that you'll catch it with any strategy that involves setting *outError in advance. But, what would be really convenient, and thus reduce programmer error, would be to be able to use the same macro at yyy were we are creating a base NSError w/o any underlying error. As the calling convention stands now, we can't since we can't depend on the caller to have initialized *outError. So, instead we have to remember to use two different patterns of code depending on whether we are creating a stacked error or a base error. This is especially fragile under code motion when refactoring (can lose the hook to an underlying error or start mistakenly looking at pointer contents we shouldn't). It seems to be you have this precisely upside-down. outError is an output parameter, not an an input-output parameter. There *is* no input value of *outError that can become the underlying error. I'm assuming that you're following the frameworks usage pattern of outError. If you're not -- if you're implementing methods that use outError as an input-output parameter -- then *of course* your scheme is going to clash with Apple's. In that case, it's not so much a matter of inconvenience, it's a matter of incompatibility. If I've misunderstood your point, it would be helpful to see an example of how your code might look with the NSError-wrapping code in place. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post 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 debugging
On Thu, Jul 16, 2009 at 3:54 PM, Quincey Morrisquinceymor...@earthlink.net wrote: If I've misunderstood your point, it would be helpful to see an example of how your code might look with the NSError-wrapping code in place. The point is that convenience is increased if NSError-returning methods follow the childhood rule of if you have nothing useful to say, don't say it at all. IOW, if you're going to return YES, don't muck with *error. Then we don't have to worry about using different techniques for wrapping error objects at different points of the program's flow. --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: Core Data debugging
On Jul 16, 2009, at 15:54, Quincey Morris wrote: On Jul 16, 2009, at 15:19, Timothy Wood wrote: then at xxx you'd like to build a new NSError that has *outError (if outError != NULL) as the underlying error It seems to be you have this precisely upside-down. outError is an output parameter, not an an input-output parameter. There *is* no input value of *outError that can become the underlying error. Well, I did misunderstand, by not reading carefully enough. But I'd still be interested to see an example of the code with the macro in place. Is 'outError' a parameter to the macro at xxx? If so, why wouldn't you just pass nil as the parameter at yyy? ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post 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 debugging
On Jul 16, 2009, at 3:54 PM, Quincey Morris wrote: Aside: If the developer of bar forgot to set *outError, then the developer of bar forgot to set an output parameter, and that's not just a bug on the developer's part, but a *horrible* bug. Sure. And clang-sa should check for this and help you remember to do it. On Jul 16, 2009, at 4:16 PM, Quincey Morris wrote: On Jul 16, 2009, at 15:54, Quincey Morris wrote: On Jul 16, 2009, at 15:19, Timothy Wood wrote: then at xxx you'd like to build a new NSError that has *outError (if outError != NULL) as the underlying error It seems to be you have this precisely upside-down. outError is an output parameter, not an an input-output parameter. There *is* no input value of *outError that can become the underlying error. Well, I did misunderstand, by not reading carefully enough. But I'd still be interested to see an example of the code with the macro in place. Is 'outError' a parameter to the macro at xxx? If so, why wouldn't you just pass nil as the parameter at yyy? Yes, outError is a parameter to the macro. You'd not pass nil along at yyy since you don't want to have to remember to change your error creation code 3 months later when you are updating. This is error-prone — you'll forget to change it some percentage of the time — and it is easily avoidable with clang-sa and better rules in some future world. So, as an example, I might want do do something like: - (BOOL)saveSomething:(NSError **)outError; { NSData *data = build some data; if ([data writeToFile:path options:someOptions error:outError]) return YES; OBError(outError, ErrorCodeEnum, @some reason, ... other user info k/v pairs ...); return NO; } The OBError macro can then: - Look at outError. If it is NULL, do nothing. - Build a userInfo dictionary from the vararg list - Also including NSUnderlyingError = the old *outError - … perfectly valid here since I'm on the failure path and NSData should have set it - Also including file line number information for help in tracking this down in user reports - Build an NSError instance with the correct domain and the passed in code - Stuff the error in *outError This is all find and good. AND it gets it done in _one_ line of code. The problem comes when I decide someday that writing this as its own file isn't right and I switch to storing it using some NSError oblivious API. As a strawman, maybe NSUserDefaults: - (BOOL)saveSomething:(NSError **)outError; { NSData *data = build some data; // strawman, remember, I'd not do it this way… =) [defaults setObject:data forKey:someKey]; if ([defaults synchronize]) return YES; OBError(outError, ErrorCode, @some reason, ... other user info k/v pairs ...); return NO; } Well, now I'm screwed due to these NSError rules. I'm reading *outError for an optional chained NSUnderlyingError and it might be trash. Sure, I should remember to ignore it or initialize it to nil myself or have a OBBaseError macro, but one day I'll forget. The current rules make me write more and more fragile code than I'd need to if we could just all depend on setting NSError locals to nil before passing them down. I know we can't right now, but I'm saying that makes life harder than it could be. Cocoa is supposed to round off the rough corners in programming! =) -tim ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post 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: iTunes COM interface for Windows; need the equivalent for iTunes on the Mac
It's been a while since I dealt with this, but if I recall correctly, AppleScript gets you almost everything you can with the COM interface on Windows. The only exception was that you can't register to listen for player updates, though I believe there are undocumented distributed notifications that you can register for (with Cocoa). ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post 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: ibtool and genstrings do nothing
ibtool -generate-strings-file MainWindow.nib MainWindow.xib Will invoke ibtool, and tell it to open MainWindow.xib and then read all the localizable strings out of that XIB, and then write them into the argument of the -generate-strings-file argument. So after running that command, ibtool will produce the file MainWindow.nib, and it will contain a bunch of strings. It won't be a NIB. You should probably write that invocation like this to make it more clear: ibtool MainWindow.xib -generate-strings-file MainWindow.strings Good Luck - Jon Hess On Jul 16, 2009, at 2:51 PM, Development wrote: I am trying to use genstrings: genstrings AppDelegate.m Appdel.strings from the terminal window and I get no errors and no output. Likewise when I do ibtoo -generate-strings-file MainWindow.nib MainWindow.xib I get no error and no output. I am in the terminal in the correct directory so I have no idea what I'm doing wrong ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/jhess%40apple.com This email sent to jh...@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: Core Data debugging
On Jul 16, 2009, at 4:49 PM, Timothy Wood wrote: Sure, I should remember to ignore it or initialize it to nil myself or have a OBBaseError macro, but one day I'll forget. The current rules make me write more and more fragile code than I'd need to if we could just all depend on setting NSError locals to nil before passing them down. I know we can't right now, but I'm saying that makes life harder than it could be. Cocoa is supposed to round off the rough corners in programming! =) The alternative would be to require the caller to set `err=nil` before calling `whateverWithError:err`. And of course one day you would forget. The convention as described makes the method author handle more rough corners in order to simplify the method caller's job, which is the usual trade-off for this sort of thing. You could write an error macro pair that fails at compile time if you forget the first half. #define OBBaseError(var)\ const int you_forgot_OBBaseError_##var = 0; \ if (var) *var=0 #define OBError(var, whatever) \ if (you_forgot_OBBaseError_##var) abort(); \ /* do your stuff with var */ OBError(outError); // oops, forgot OBBaseError(outError); // test.m:18: error: 'you_forgot_OBBaseError_outError' undeclared -- 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: Core Data debugging
On Jul 16, 2009, at 16:49, Timothy Wood wrote: So, as an example, I might want do do something like: - (BOOL)saveSomething:(NSError **)outError; { NSData *data = build some data; if ([data writeToFile:path options:someOptions error:outError]) return YES; OBError(outError, ErrorCodeEnum, @some reason, ... other user info k/v pairs ...); return NO; } ... - (BOOL)saveSomething:(NSError **)outError; { NSData *data = build some data; // strawman, remember, I'd not do it this way… =) [defaults setObject:data forKey:someKey]; if ([defaults synchronize]) return YES; OBError(outError, ErrorCode, @some reason, ... other user info k/ v pairs ...); return NO; } Well, now I'm screwed due to these NSError rules. I'm reading *outError for an optional chained NSUnderlyingError and it might be trash. Sure, I should remember to ignore it or initialize it to nil myself or have a OBBaseError macro, but one day I'll forget. The current rules make me write more and more fragile code than I'd need to if we could just all depend on setting NSError locals to nil before passing them down. I know we can't right now, but I'm saying that makes life harder than it could be. Cocoa is supposed to round off the rough corners in programming! =) Well, it's a valid but terribly weak argument, if you don't mind my suggesting so. In the second case, you're not screwed because of these NSError rules but because you're using an output parameter of the method as an input parameter to the macro. It's a plain bug, unless you assert it not to be a bug (which is basically what you're doing, which is why I'm calling it weak). But your example is weak for another reason. If the methods were this simple, you'd be unlikely to leave outError uninitialized in the second method. It's only going be be an issue in a longer method that does a series of things that can fail, and then you're more likely to write: if (![... do something ... error: outError]) { OBError (outError, ...); return NO; } if (![... do something else ... error: outError]) { OBError (outError, ...); return NO; } ... and if there's something to do that doesn't return a NSError: if (![... do something ...]) { OBError (nil, ...); return NO; } What's so fragile about that? If you paste it somewhere else, the 'nil' goes with it. :) Is the return-YES-on-success pattern really reasonable for most non-trivial methods? I should confess my bias here. I'm a big fan of Wil Shipley's mainline code approach: http://www.wilshipley.com/blog/2005/07/code-insults-mark-i.html but you have to scroll down a bit to find it: What you should really do is write if statements that check for improperconditions, and if you find them, bail. This cleans your code immensely, in two important ways: (a) the main, normal execution path is all at the top level, so if the programmer is just trying to get a feel for the routine, all she needs to read is the top level statements, instead of trying to trace through indention levels figuring out what the normal case is, and (b) it puts the bail code right next to the correctness check, which is good because the bail code is usually very short and belongs with the correctness check. (But ignore the part further down where he goes right off the rails about self = [super init]. :) ) ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post 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 debugging
On Jul 16, 2009, at 5:39 PM, Greg Parker wrote: The alternative would be to require the caller to set `err=nil` before calling `whateverWithError:err`. Yes, and this would a code savings. Only at the top level invocations would you need to worry about this. There are far more methods that deal with errors that take an outError arg that they can just pass through to my children. So, there really aren't that many places that I end up declaring NSError *error = nil; And of course one day you would forget. Well, no. Since (a) it's always the same pattern rather than being different per call site and (b) as mentioned in my Radar, clang-sa can check this. As another aside, to some extent I don't care what the rules are as long as clang-sa can help enforce them. The convention as described makes the method author handle more rough corners in order to simplify the method caller's job, which is the usual trade-off for this sort of thing. I'm not sure I agree and I think it is a non-issue for the reason I stated above (pass through of outError from a parent method to stuff it calls). You could write an error macro pair that fails at compile time if you forget the first half. #define OBBaseError(var)\ const int you_forgot_OBBaseError_##var = 0; \ if (var) *var=0 #define OBError(var, whatever) \ if (you_forgot_OBBaseError_##var) abort(); \ /* do your stuff with var */ Ugh. This is even more code. Also, it doesn't fix the problem as I understand it: if (![self a:outError]) ... if (![self b:outError]) ... If -a: succeeds it might write some temporary crud into outError that I can't read when -b: fails. Of course, the other part of my Radar is that clang-sa should warn if you write to outError unless you have an unconditional path to return NO/nil/NULL/Nil/FALSE/... I forgot to mention that *even* two lines of code is too much, IMO: SomeErrorMacro(...); return NO; Really it would be nicer if this was shortened to: return SomeErrorMacro(...); with enough magic to determine which of the 1001 Versions of Zero to return. Of course, if I could get to two someday, then maybe I'll argue for one =) -tim ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post 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 debugging
On Jul 16, 2009, at 5:44 PM, Quincey Morris wrote: In the second case, you're not screwed because of these NSError rules but because you're using an output parameter of the method as an input parameter to the macro. It's a plain bug, unless you assert it not to be a bug (which is basically what you're doing, which is why I'm calling it weak). Yes, it is a bug -- maybe I've not been clear enough: I know we have to follow the rules Apple has set forth. This isn't in debate. My point is that the code *was* correct before someone came along and edited and the rules introduce needless fragility and verbosity. If the rules were changed, then the code would be shorter and less fragile in the face of editing. The ideal rules would lessen verbosity, fragility and aid static analysis with clang-sa. and if there's something to do that doesn't return a NSError: if (![... do something ...]) { OBError (nil, ...); return NO; } Um, no. This doesn't fill *outError if you pass nil. Either way, you'd end up having to tweak code more as it got moved about. What's so fragile about that? If you paste it somewhere else, the 'nil' goes with it. :) And if I move it to a place that does have a NSError-based API (or maybe I update the API its calling to have an outError), then I have to tweak it to avoid dropping the underlying error. Is the return-YES-on-success pattern really reasonable for most non- trivial methods? I should confess my bias here. I'm a big fan of Wil Shipley's mainline code approach: http://www.wilshipley.com/blog/2005/07/code-insults-mark-i.html Heh. I worked with Wil long enough that I can't be sure whether he started that approach at Omni, or Ken or me. Anyway, I've been doing early out for nearly two decades. I do, also sometimes early-out on YES if the remainder of the code is for final error handling. Sorry if it was distracting from the main point here. -tim ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post 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
UITextView Doesn't seem to function
Ok, I have tried: about.text = @About text; and [about setText:@About Text] but when I bring up the text view it is empty until I touch inside it and the KB appears. which ruins the whole point since it is suppose to be non editable. What am I doing wrong with this view that it will not display a simply NSString? I have even tried [about setNeedsDisplay] and nothing. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post 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: UITextView Doesn't seem to function
Have you verified that the about pointer is actually set to point to a text field? If it was nil, it would explain the behavior your describing. Jon Hess On Jul 16, 2009, at 6:52 PM, Development wrote: Ok, I have tried: about.text = @About text; and [about setText:@About Text] but when I bring up the text view it is empty until I touch inside it and the KB appears. which ruins the whole point since it is suppose to be non editable. What am I doing wrong with this view that it will not display a simply NSString? I have even tried [about setNeedsDisplay] and nothing. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post 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/jhess%40apple.com This email sent to jh...@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: UITextView Doesn't seem to function
Actually its a UITextView, it is linked in IB and when I NSLog(@%@,about.text) it shows me that it has the string stored in the object, however it is not updating the onscreen view. On Jul 16, 2009, at 6:58 PM, Jonathan Hess wrote: Have you verified that the about pointer is actually set to point to a text field? If it was nil, it would explain the behavior your describing. Jon Hess On Jul 16, 2009, at 6:52 PM, Development wrote: Ok, I have tried: about.text = @About text; and [about setText:@About Text] but when I bring up the text view it is empty until I touch inside it and the KB appears. which ruins the whole point since it is suppose to be non editable. What am I doing wrong with this view that it will not display a simply NSString? I have even tried [about setNeedsDisplay] and nothing. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post 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/jhess%40apple.com This email sent to jh...@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: Core Data debugging
On Jul 16, 2009, at 18:33, Timothy Wood wrote: and if there's something to do that doesn't return a NSError: if (![... do something ...]) { OBError (nil, ...); return NO; } Um, no. This doesn't fill *outError if you pass nil. Either way, you'd end up having to tweak code more as it got moved about. Well, I admit I wasn't thinking straight when I wrote that, but I'm gonna stand by it (except it should be NULL not nil). If I was doing something like this, I'd have the macro *assume* the method's output parameter is called 'outError', and make the first macro parameter be the thing to encapsulate instead. That covers some useful ground: First, it allows cases where you need to use an auxiliary NSError: NSError* error; if (![... error: error] error.code != something) { OBError (error, ...) return NO; } and, second, it produces a compile error if the enclosing method *doesn't* have an outError parameter, which addresses the concern in your other post. I don't know about you, but *all* my outErrors *are* called outError anyway, because it cheaply documents the error handling protocol in effect. Anyway, perhaps we've done this to death. I understand your point of view now. (But by all means have the last word if you wish.) Heh. I worked with Wil long enough that I can't be sure whether he started that approach at Omni, or Ken or me. Ah, apologies for not apportioning the credit fairly ... and thanks for foisting this on the world. :) ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post 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 debugging
On Jul 16, 2009, at 4:49 PM, Timothy Wood wrote: Sure, I should remember to ignore it or initialize it to nil myself or have a OBBaseError macro, but one day I'll forget. The current rules make me write more and more fragile code than I'd need to if we could just all depend on setting NSError locals to nil before passing them down. I know we can't right now, but I'm saying that makes life harder than it could be. Cocoa is supposed to round off the rough corners in programming! =) The alternative would be to require the caller to set `err=nil` before calling `whateverWithError:err`. And of course one day you would forget. The caller must initialize the NSError to nil anyway. Leaving uninitialized local variables lying around waiting to bite you is simply crazy. The original problem in this thread was: NSError* err; BOOL result = [someObj whateverWithError:err]; if (!result) { // do something with error } Now, you're hosed when someObj is nil. Lots of people, especially people new to Cocoa unused to ObjC helping you will nil dispatch, make this mistake. Unless you always check for nil too, which I've never seen anyone do. Basically you either must do: NSError* err = nil; or every check must be if (!result receiver) What with all this one day you would forget silliness, leaving an uninitialized local variable lying around is begging for failure to come smack you in the face. - Ben ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post 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: UITextView Doesn't seem to function
On Jul 16, 2009, at 9:09 PM, Development wrote: Actually its a UITextView, it is linked in IB and when I NSLog (@%@,about.text) it shows me that it has the string stored in the object, however it is not updating the onscreen view. Make sure that your text view is large enough to show the size of text that you are displaying in it. Otherwise the word wrap might be causing the text to seem to disappear. If necessary, make your text view too big just to make sure that the text is showing. Also make sure that the text color of the view is not white. Scott ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post 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: iTunes COM interface for Windows; need the equivalent for iTunes on the Mac
ApleScript/Scripting-Bridge it is. Thanks, guys. -Michael -- There are two ways of constructing a software design. One way is to make it so simple that there are obviously no deficiencies. And the other way is to make it so complicated that there are no obvious deficiencies. -- C.A.R. Hoare On Jul 16, 2009, at 5:42 PM, Michael A. Crawford wrote: So, is there an SDK for accessing iTunes on the Mac? -Michael -Michael -- The united stand. The divided get played. -- Bernie MAC ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post 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/michaelacrawford%40mac.com This email sent to michaelacrawf...@mac.com 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: Problems displaying an image in UIWebView [solved]
On 16 Jul 2009, at 09:55, M.S. Hrishikesh wrote: img align=center src=/file://Users/hrishi/Library/Application Support/iPhone Simulator/User/Applications/87888BAB-2F9D-44F6-BEB8- FB7D65D2F1CC/Epicures.app/myImage.png / Although it may display correctly, that's still not correct. The URI scheme goes first, like this: img align=center src=file:///Users/hrishi/like/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/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Windowed Video
On 16 Jul 2009, at 05:15, Eric E. Dolecki wrote: I would like to play a m4v from my bundle and I am using MPMoviePlayerController to do this. Works great. However in my view the designer would like the video to playback overlaid on top of a graphic of a television set. I don't seem to be able to do this with MPMoviePlayerController. How can I play that asset from my main bundle in a windowed fashion? (ie. I give the x,y and width, height), etc.? In the absence of any API for framing a video, how about just making the television set graphic part of the video? As long as it's not changing, it shouldn't impact file size too severely. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post 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 Grouped Table View for Settings
I don't want to use the Settings app as I need a clean way for the user to get to the settings from within my app and then return to my app. So I need to build a grouped table view, with each cell containing a single control (and a label) like the settings app does. For example, I need a table with two rows, each row needs a label, slider and text (numeric value of slider). How can I do this? There seems to be no way to build it in IB directly. I need a way to make the two sliders IBOutlets so that I can manipulate them. As my cells will be static (just the label, slider, text), it seems simple, but I have found no examples of this. I also need another group - same as above but with switches. Thanks for any leads to examples or the best way to achieve this. Trygve ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post 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
Multiple cells selection in NSTableView
Hi All, I need following functionality to be implemented in NSTableView. Selecting Multiple cells of single column in NSTableView. I subclassed NSTableView and created class TestTableView. I have done following 3 things. 1)I have overriden mouseDown method With the help of mouse point, I am getting currentSelectedColumn and currentSelectedRow. I am using frameOfCellAtColumn:row: method to determine frame of selected cell and adding cell's rect to selectedCellsRectArray array. 2)I have overriden highlightSelectionInClipRect: method I observed that this method will be called for a) Entire table rect b) For selected rows rect. a) In this case, I am taking each cell rect from alreadyDrawnCells array and highlighting corresponding rect. b) In this case, I am taking intersection of rowRect and cellRect If intersection rect is equalTo cellRect, then I am highlighting cell. I am adding Highlighted cell's rect to alreadyDrawnCells array. 3) I created custom class for NSTextFieldCell and overriden following method - (NSColor *)highlightColorWithFrame:(NSRect)cellFrame inView:(NSView *)controlView { return nil; } Above implementation is working fine, if my application is active. If i switch to other app and come back to my App, selection is not working properly. Something is going wrong in highlightSelectionInClipRect: method implementation. Any help would be appreciated. Thanks, Dinakar P ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post 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
2 IKImageBrowserView behaving differently
Hi all, I have 2 tabs, with an IKImageBrowserView in each tab. I have implemented imageBrowser:writeItemsAtIndexes:toPasteboard: so I can drag images from one IKImageBrowserView to another, and have also implemented imageBrowser:removeItemsAtIndexes: so images can be removed. However, reordering doesn't work: - (BOOL) imageBrowser:(IKImageBrowserView *) view moveItemsAtIndexes: (NSIndexSet *)indexes toIndex:(NSUInteger)destinationIndex { NSLog(@we are moving items); return YES; } This method isn't even called when I drag to reorder. There's also no cursor that shows up when I move the images to a position. Any idea what I can be doing wrong? ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Cells selection in NSTableView
Hi All, I need following functionality to be implemented in NSTableView. Selecting Multiple cells of single column in NSTableView. I subclassed NSTableView and created class TestTableView. I have done following 3 things. 1)I have overriden mouseDown method With the help of mouse point, I am getting currentSelectedColumn and currentSelectedRow. I am using frameOfCellAtColumn:row: method to determine frame of selected cell and adding cell's rect to selectedCellsRectArray array. 2)I have overriden highlightSelectionInClipRect: method I observed that this method will be called for a) Entire table rect b) For selected rows rect. a) In this case, I am taking each cell rect from alreadyDrawnCells array and highlighting corresponding rect. b) In this case, I am taking intersection of rowRect and cellRect If intersection rect is equalTo cellRect, then I am highlighting cell. I am adding Highlighted cell's rect to alreadyDrawnCells array. 3) I created custom class for NSTextFieldCell and overriden following method - (NSColor *)highlightColorWithFrame:(NSRect)cellFrame inView:(NSView *)controlView { return nil; } Above implementation is working fine, if my application is active. If i switch to other app and come back to my App, selection is not working properly. Something is going wrong in highlightSelectionInClipRect: method implementation. Any help would be appreciated. Thanks, Dinakar P ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post 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
Process crash while using NSURLConnection
Hi, I am currently investigating a crash we experienced in our application. We have a daemon process running in the background, and it crashed, writing the attached report as it did so. This only happened once, which suggest that this is a sporadic problem. In case it is useful, we use NSURLConnection with SSL and redirections. Trying to analyze the crash report, it seems like the main thread is waiting on the KeychainCore while the third thread is also using it. At the same time, the threads 3 and 5 are using NSURLConnection. It is currently not clear to me if we can safely use NSURLConnection in multiple threads, or if there are known issues with this class that I should be aware of. The documentation for that class does not appear to mention thread-safety. Also, it looks like at least one other person has had a similar crash: http://lists.apple.com/archives/cocoa-dev/2009/Feb/msg02054.html. Any insight on what is causing this issue would be greatly appreciated. Best regards, Jean-Francois Dontigny Here is the crash report: Process: RPSecurityDaemon [7107] Path:/Library/Application Support/Verizon/Verizon Internet Security Suite/RPSecurityDaemon.app/Contents/MacOS/RPSecurityDaemon Identifier: RPSecurityDaemon Version: ??? (???) Code Type: X86 (Native) Parent Process: launchd [1] Date/Time: 2009-07-06 12:34:30.260 -0700 OS Version: Mac OS X 10.5.6 (9G2030) Report Version: 6 Exception Type: EXC_BAD_ACCESS (SIGSEGV) Exception Codes: KERN_INVALID_ADDRESS at 0xc450535f Crashed Thread: 3 Application Specific Information: objc[7107]: garbage collection is ON NSCFType Thread 0: 0 libSystem.B.dylib 0x9350720e semaphore_wait_signal_trap + 10 1 libSystem.B.dylib 0x9350ece5 pthread_mutex_lock + 569 2 com.apple.security0x90911d82 Security::Mutex::lock() + 20 3 com.apple.security0x9081be5c Security::KeychainCore::KeychainImpl::removeItem(Security::KeychainCore::Pri maryKey const, Security::KeychainCore::ItemImpl*) + 84 4 com.apple.security0x908179d9 Security::KeychainCore::ItemImpl::~ItemImpl() + 71 5 com.apple.security0x90912771 Security::CFClass::finalizeType(void const*) + 41 6 com.apple.Foundation 0x90b15291 -[NSCFType finalize] + 49 7 libobjc.A.dylib 0x917e26b6 finalizeOneObject + 56 8 libauto.dylib 0x960eed9b foreach_block_do(auto_zone_cursor*, void (*)(void*, void*), void*) + 123 9 libobjc.A.dylib 0x917e287b batchFinalize + 220 10 libauto.dylib 0x960efefe auto_collect_internal(Auto::Zone*, int) + 782 11 libauto.dylib 0x960f0c0d auto_collect + 45 12 libobjc.A.dylib 0x917e29d5 objc_collect_if_needed + 110 13 com.apple.Foundation 0x909b3cc7 NSPopAutoreleasePool + 39 14 com.apple.Foundation 0x909dce48 __NSConnectionDoQueuedWork + 344 15 com.apple.CoreFoundation 0x96a979a2 __CFRunLoopDoObservers + 466 16 com.apple.CoreFoundation 0x96a98cfc CFRunLoopRunSpecific + 844 17 com.apple.CoreFoundation 0x96a99cd8 CFRunLoopRunInMode + 88 18 com.apple.Foundation 0x909ecd75 -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 213 19 ...adialpoint.RPSecurityDaemon0x3076 0x1000 + 8310 20 ...adialpoint.RPSecurityDaemon0x24ea 0x1000 + 5354 Thread 1: 0 libSystem.B.dylib 0x935566f2 select$DARWIN_EXTSN + 10 1 libSystem.B.dylib 0x93538095 _pthread_start + 321 2 libSystem.B.dylib 0x93537f52 thread_start + 34 Thread 2: 0 libSystem.B.dylib 0x93507226 semaphore_timedwait_signal_trap + 10 1 libSystem.B.dylib 0x935391ef _pthread_cond_wait + 1244 2 libSystem.B.dylib 0x9353aa73 pthread_cond_timedwait_relative_np + 47 3 com.apple.Foundation 0x909fe75c -[NSCondition waitUntilDate:] + 236 4 libEventLogging.dylib 0xb5fe 0x9000 + 9726 5 com.apple.Foundation 0x909b8394 __NSThread__main__ + 308 6 libSystem.B.dylib 0x93538095 _pthread_start + 321 7 libSystem.B.dylib 0x93537f52 thread_start + 34 Thread 3 Crashed: 0 libstdc++.6.dylib 0x9616ca03 __dynamic_cast + 15 1 com.apple.security0x9080c45a Security::CssmClient::CLImpl Security::CssmClient::Object::implSecurity::CssmClient::CLImpl() const + 54 2 com.apple.security0x9080a535 Security::KeychainCore::Certificate::clHandle() + 151 3 com.apple.security0x9080a881 Security::KeychainCore::Certificate::copyFirstFieldValue(cssm_data const) + 19 4 com.apple.security0x9084c834 Security::KeychainCore::UserTrustItem::makeCertIndex(Security::KeychainCore: :Certificate*, Security::CssmOwnedData) + 42 5 com.apple.security
Why do CFType instances respond to NSObject messages?
Hi all, I'm new to the Cocoa framework, and puzzled why the following code would work: CGLayerRef layer = ...assume we have a layer created. printf(Retain count after creation: %i\n, CFGetRetainCount(layer)); [(NSObject*)layer retain]; printf(Retain count after sending a retain message: %i\n, CFGetRetainCount(layer)); [(NSObject*)layer release]; printf(Retain count after sending a release message: %i\n, CFGetRetainCount(layer)); The code above gives the following output: Retain count after creation: 1 Retain count after sending a retain message: 2 Retain count after sending a release message: 1 Since a CGLayer is not a subclass of NSObject, its instances shouldn't respond to retain/release messages. Yet the code works. ciao, wils ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post 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
Initiating a To-many entity
Hello, Imagine the following example: Entity Attributes Relationships ----- WeeklyMenu date menuItems (To-many Destination: MenuItems) MenuItemsdish week (Destination: WeeklyMenu) chef cost Category chef dish I pre-populate Category from a .plist. ChefDish -- --- LunchChef BLT LunchChef Soup DinnerChef Soup DinnerChef Salad DinnerChef Steak When a new date is created, I want MenuItems to automatically have records corresponding to all of the categories. How would you do this? The example is a bit contrived but is analogous to my actual application. The idea is to have the same categories every week with varying prices. Feel free to suggest a different model if mine is not appropriate. I am able to construct an interface which allows for new dates and displays the pre-populated categories, but I am having difficulty figuring out how to create the MenuItems automatically. Thanks, S ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post 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
NSMutableArray Category as NSComboBoxDataSource?
Cocoa-devListMembers, In my AppController I have a NSMutableArray which stores all user request/response objects made by the application. The requests are a subclass of NSObject with two NSDictionaries. The first NSDictionary has three key value pairs which comprise the request portion of the root object. I would like to use the objects for each [[rootObject firstDict] objectForKey:@key1] for one combobox and the values for [[rootObject firstDict] objectForKey:@key2] for another combobox. Finally, as [[rootObject firstDict] objectForKey:@key3] is a NSDictionary; I would like to store these objects in a NSTableView. Instead of subclassing NSArray I created a Category! I am not able to get the Category methods to perform NSLog after setting my data source in the App Controller and reloading data (I'm pretty sure a few of those methods should fire to reloadData). From the below view, is there something I'm missing? Or should I not be using Categories for this purpose (I do understand Categories add these methods to all MutableArrays, but I don't see any negative impact at this point in my app)? I know my use of code punctuation is not per documentation's example, but it's how i parse it best. Thanks to all who read this far ;) Frank Here is what I have: //### DPExtra_NSComboBoxDataSource.h @interface NSMutableArray(DPMutableArrayAdditions) -(NSString *)comboBox:(NSComboBox *)aComboBox completedString: (NSString *)uncompletedString; -(NSUInteger)comboBox:(NSComboBox *)aComboBox indexOfItemWithStringValue:(NSString *)aString; -(id)comboBox:(NSComboBox *)aComboBox objectValueForItemAtIndex: (NSInteger)index; -(NSInteger)numberOfItemsInComboBox:(NSComboBox *)aComboBox; //### End DPExtra_NSComboBoxDataSource.h //### DPExtra_NSComboBoxDataSource.m @implementation NSMutableArray(DPMutableArrayAdditions) -(NSString *)comboBox:(NSComboBox *)aComboBox completedString: (NSString *)uncompletedString{ NSLog(@comboBox: %@ completedString: %@, aComboBox, uncompletedString); return [super comboBox:aComboBox completedString:uncompletedString]; } -(NSUInteger)comboBox:(NSComboBox *)aComboBox indexOfItemWithStringValue:(NSString *)aString{ NSLog(@comboBox: %@ indexOfItemWithStringValue: %@, aComboBox, aString); return [super comboBox:aComboBox indexOfItemWithStringValue:aString]; } -(id)comboBox:(NSComboBox *)aComboBox objectValueForItemAtIndex: (NSInteger)index{ NSLog(@comboBox: %@ objectValueForItemAtIndex: %i, aComboBox , index); return [super comboBox:aComboBox objectValueForItemAtIndex:index]; } -(NSInteger)numberOfItemsInComboBox:(NSComboBox *)aComboBox{ NSLog(@numberOfItemsInComboBox: %@, [aComboBox description]); return [super numberOfItemsInComboBox:aComboBox]; } //### End DPExtra_NSComboBoxDataSource.m //### DPAppController.m init // Create the array to hold all rest requests in cache // ** recursively release header dicts and restRequests in dealloc restRequests = [[NSMutableArray alloc] init]; // This is test data in place a cache loading NSDictionary *firstHeader = [NSDictionary dictionaryWithObjectsAndKeys:@application/json, @Accept, @text, @Content-type, nil]; DPRestRequest *firstRequest = [[DPRestRequest alloc] initWithUrl:@http://localhost andMethod:@GET andHeader:firstHeader]; NSDictionary *secondHeader = [NSDictionary dictionaryWithObjectsAndKeys:@application/json, @Accept, @text, @Content-type, @cREST/0.1, @User-Agent, @Sunday, 01-01-69 00:00:00 EST, @If-Modified-Since-Date, nil]; DPRestRequest *secondRequest = [[DPRestRequest alloc] initWithUrl:@http://localhost andMethod:@GET andHeader:secondHeader]; // Add the test data to the array [restRequests addObject:firstRequest]; [restRequests addObject:secondRequest]; // End init // -(void)applicationDidFinishLaunching:(NSNotification *)aNotification{ [urlInput setDataSource:restRequests]; [urlInput reloadData]; //### End DPAppController.h ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post 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
Codesign from Buid Server
Hi, We have a TeamCity build server setup to produce automatic builds for our cocoa application. We also code sign our apps but this part has to be done on a dev box as the build agent (OS X 10.5) doesn¹t recognize the certificate in the system keychain (there is no login keychain when the build agent runs the post-build signing script). Has anyone else setup a build server which code signs their apps? If so, was there a trick to getting the certificate / keychain to play nicely. Thanks, Richard ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post 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] Custom -sizeWithFont: and CGContextRef question
Hello all, For various reasons I'd like to implement a method similar in function to NSString's -sizeWithFont: (UIKit addition). The difference is it takes a CGFontRef. Here's a rough idea of the code (a slight adaptation of Timothy Ritchey's TTFontCell code, and I apologize because I can't find a link to it right now): - (CGSize)sizeWithFont:(CGFontRef)font ofSize:(CGFloat)size withKerning:(CGFloat)kerning { CGContextRef context = UIGraphicsGetCurrentContext(); CGContextSetFont(context, font); CGContextSetFontSize(context, fontSize); CGContextSetCharacterSpacing(context, kerning); } The code works — however, it can only be called within a UIView's drawRect: method, for a valid context to be returned in UIGraphicsGetCurrentContext(); This method is only useful really if it can be called *before* the drawing code, for laying out views and such. I know that I need to create a CGContextRef and push it on the UIGraphics stack. My question is, what might be the best way to do this? I see I can use CGPDFContextCreate or CGBitmapContextCreate... which makes sense here? All I need to do is determine the size of a string w/ specified font, not actually draw it. Thanks, Michael Hoy michael.john@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
hide main menu, not appear in dock, run in background.
Hello Everyone, For some time I wanted my cocoa application not to appear in the dock, nor to show the main menu bar. After some searching and screaming, I managed to achieve this by adding keyNSBGOnly/key string1/string to the Info.plist, now my question is: is this the usual way of doing it? I am sure that there are some apps that hide differently, but I have no idea how.. thanx, pg ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post 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 Grouped Table View for Settings
I haven't played with sliders, but here is an example for a switch: UITableViewCell *yourCell = [tableView dequeueReusableCellWithIdentifier:YourCellIdentifier]; if (yourCell == nil) { yourCell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:YourCellIdentifier] autorelease]; UISwitch *switchView = [[UISwitch alloc] init]; [switchView setOn: your boolean criteria]; [switchView addTarget:self action:@selector(yourMethod:) forControlEvents:UIControlEventValueChanged]; [yourCell setAccessoryView: switchView]; [switchView release], switchView = nil; } There are probably several ways of getting there. Hope this helps. Brian On Jul 17, 2009, at 12:34 AM, Trygve Inda wrote: I don't want to use the Settings app as I need a clean way for the user to get to the settings from within my app and then return to my app. So I need to build a grouped table view, with each cell containing a single control (and a label) like the settings app does. For example, I need a table with two rows, each row needs a label, slider and text (numeric value of slider). How can I do this? There seems to be no way to build it in IB directly. I need a way to make the two sliders IBOutlets so that I can manipulate them. As my cells will be static (just the label, slider, text), it seems simple, but I have found no examples of this. I also need another group - same as above but with switches. Thanks for any leads to examples or the best way to achieve this. Trygve ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post 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/brianslick%40mac.com This email sent to briansl...@mac.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
Why do CFType instances respond to NSObject messages?
1) Forget -retainCount exists. Never call it. 2) Look up toll-free bridging. --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: hide main menu, not appear in dock, run in background.
http://www.cocoadev.com/index.pl?LSBackgroundOnly On 17/07/2009, at 10:43 AM, Piotr Grzybowski wrote: Hello Everyone, For some time I wanted my cocoa application not to appear in the dock, nor to show the main menu bar. After some searching and screaming, I managed to achieve this by adding keyNSBGOnly/key string1/string to the Info.plist, now my question is: is this the usual way of doing it? I am sure that there are some apps that hide differently, but I have no idea how.. thanx, pg ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post 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/kiel.gillard%40gmail.com This email sent to kiel.gill...@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: hide main menu, not appear in dock, run in background.
This question seems to come up every week. If you search the list archives you'll see that you want to create an LSUIElement. --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 Grouped Table View for Settings
Look at the table view programming guide for how to build custom table cells. Just think of each cell as a custom view. They can even be built in IB easily enough. Drag UITableViewCell objects into your nib and lay them out however you like. Luke Sent from my iPhone. On Jul 16, 2009, at 9:34 PM, Trygve Inda cocoa...@xericdesign.com wrote: I don't want to use the Settings app as I need a clean way for the user to get to the settings from within my app and then return to my app. So I need to build a grouped table view, with each cell containing a single control (and a label) like the settings app does. For example, I need a table with two rows, each row needs a label, slider and text (numeric value of slider). How can I do this? There seems to be no way to build it in IB directly. I need a way to make the two sliders IBOutlets so that I can manipulate them. As my cells will be static (just the label, slider, text), it seems simple, but I have found no examples of this. I also need another group - same as above but with switches. Thanks for any leads to examples or the best way to achieve this. Trygve ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post 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: Iphone Grouped Table View for Settings
Also - on iPhone OS 3.0 this is even simpler. You don't need custom table cells. UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellDetailIdentifier]; if (cell == nil) { cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:CellDetailIdentifier] autorelease]; } This sets up a Settings style cell with a regular label on the left and a detail label on the right. On Jul 17, 2009, at 12:10 AM, Luke Hiesterman wrote: Look at the table view programming guide for how to build custom table cells. Just think of each cell as a custom view. They can even be built in IB easily enough. Drag UITableViewCell objects into your nib and lay them out however you like. Luke Sent from my iPhone. On Jul 16, 2009, at 9:34 PM, Trygve Inda cocoa...@xericdesign.com wrote: I don't want to use the Settings app as I need a clean way for the user to get to the settings from within my app and then return to my app. So I need to build a grouped table view, with each cell containing a single control (and a label) like the settings app does. For example, I need a table with two rows, each row needs a label, slider and text (numeric value of slider). How can I do this? There seems to be no way to build it in IB directly. I need a way to make the two sliders IBOutlets so that I can manipulate them. As my cells will be static (just the label, slider, text), it seems simple, but I have found no examples of this. I also need another group - same as above but with switches. Thanks for any leads to examples or the best way to achieve this. Trygve ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post 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/alex%40webis.net This email sent to a...@webis.net Alex Kac - President and Founder Web Information Solutions, Inc. If at first you don't succeed, skydiving is not for you. -- Francis Roberts ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post 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: UITextView Doesn't seem to function
Ok google showed me a couple articles on how textviews within scrollviews dont work right. so I tried to implement a bit of code but it still didnt work and I had to move the text view so that it was on the view screen from the start. That really cramped the style of the interface but for now its the only fix that seems to work. I tried what's below and also just plain [about setNeedsDisplay] in the delegate method below and no luck... Very frustrating. -(void)scrollViewDidScroll:(UIScrollView*)scrollView { for (UIView *childView in about.subviews) { [childView setNeedsDisplay]; } for (UIView *childView in onlineAbout.subviews) { [childView setNeedsDisplay]; } } On Jul 16, 2009, at 8:17 PM, Scott Thompson wrote: On Jul 16, 2009, at 9:09 PM, Development wrote: Actually its a UITextView, it is linked in IB and when I NSLog(@%@,about.text) it shows me that it has the string stored in the object, however it is not updating the onscreen view. Make sure that your text view is large enough to show the size of text that you are displaying in it. Otherwise the word wrap might be causing the text to seem to disappear. If necessary, make your text view too big just to make sure that the text is showing. Also make sure that the text color of the view is not white. Scott ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post 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: Why do CFType instances respond to NSObject messages?
On Jul 16, 2009, at 5:24 AM, Wilson Chen wrote: Since a CGLayer is not a subclass of NSObject, its instances shouldn't respond to retain/release messages. Yet the code works. The toll-free bridging documentation isn't very clear on this, unless it's changed recently. At least for retain/release, any CFType can be treated as an NSObject. http://www.cocoabuilder.com/archive/message/cocoa/2004/2/7/95680 http://www.cocoabuilder.com/archive/message/cocoa/2008/7/5/212058 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: Process crash while using NSURLConnection
Yeah, the NSURLConnection docs aren't too heavy on details when it comes to threads, and what it does say about its threading behavior seems purely consequential to the fact that NSURLConnection relies on NS/CFRunLoop facilities, rather than NSUC implementing its own thread-safe logic. So from the limited information available, as usual, I wouldn't make any assumptions about the thread safety of it. (As I side note, I'll say I've also experienced some very reproducible crashes with NSURLConnection without doing anything fancy - I don't remember all the details, but if you search Google for NSURLConnection crash, you'll get a fair number of hits. Which speaks for itself, I guess.) I just finished moving some non-thread-safe code into a separate helper utility that's launched on-demand, and it's worked peachy for me. While it takes some time and a lot more code than it would otherwise, it's really the only way to deal with situations where something needs to run outside of the main thread, but doesn't play nice with threads. So that's what I suggest... Hope that helps, 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: Initiating a To-many entity
On Jul 16, 2009, at 07:28, Sean Kline wrote: Imagine the following example: Entity Attributes Relationships WeeklyMenu date menuItems (To-many Destination: MenuItems) MenuItemsdish week (Destination: WeeklyMenu) chef cost Category chef dish ChefDish LunchChef BLT LunchChef Soup DinnerChef Soup DinnerChef Salad DinnerChef Steak When a new date is created, I want MenuItems to automatically have records corresponding to all of the categories. How would you do this? The example is a bit contrived but is analogous to my actual application. The idea is to have the same categories every week with varying prices. Feel free to suggest a different model if mine is not appropriate. I am able to construct an interface which allows for new dates and displays the pre-populated categories, but I am having difficulty figuring out how to create the MenuItems automatically. (I compressed blank lines from your example for brevity.) Since you always want to add menu items for the same set of categories, it's easiest to implement an override of awakeFromInsert:, then create them and set their week relationship in there. Note that your MenuItems entity should really be called MenuItem, since there's a different instance for each chef/dish combination (assuming I'm reading your example right.) Typically, it's correct for a to-many relationship to be plural and the related-to entity to be singular. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post 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
Activating and deactivating core layer animation
Greetings! I was looking at core animation in interface builder, and I really like what one can do there. I need a quick tip... when i define a shadow, or an animation, i would like to be able to control in code or bindings when the shadow appears or when the animation will start in response to user mouse input. where should i look for these informations or tutorial. I hope I'm being clear. thank you all! Sandro Noël sandro.n...@mac.com Mac OS X : Swear by your computer, not at it. P -Pensez vert! avant d’imprimer ce courriel. -Go Green! please consider the environment before printing this email. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post 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: Why do CFType instances respond to NSObject messages?
On Jul 16, 2009, at 7:24 AM, Wilson Chen wrote: Hi all, I'm new to the Cocoa framework, and puzzled why the following code would work: CGLayerRef layer = ...assume we have a layer created. printf(Retain count after creation: %i\n, CFGetRetainCount(layer)); [(NSObject*)layer retain]; printf(Retain count after sending a retain message: %i\n, CFGetRetainCount(layer)); [(NSObject*)layer release]; printf(Retain count after sending a release message: %i\n, CFGetRetainCount(layer)); The code above gives the following output: Retain count after creation: 1 Retain count after sending a retain message: 2 Retain count after sending a release message: 1 Since a CGLayer is not a subclass of NSObject, its instances shouldn't respond to retain/release messages. Yet the code works. This code works in a non-garbage collected environment. In a garbage collected environment, the Objective-C retain and release calls would be ignored while CFRetain and CFRelease would not. Your best bet is to not mix the two paradigms. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post 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