EXC_BAD_ACCESS on NSImageView::setImage
I have a window that contains a NSImageView that displays pictures. here is the code : =CODE= NSBitmapImageRep *rawPic = [[[NSBitmapImageRep alloc] initWithBitmapDataPlanes:NULL pixelsWide:thisFrame.width pixelsHigh:thisFrame.height bitsPerSample:8 samplesPerPixel:3 hasAlpha:NO isPlanar:NO colorSpaceName:NSCalibratedRGBColorSpace bitmapFormat:NSAlphaFirstBitmapFormat bytesPerRow:0 bitsPerPixel:0] autorelease]; unsigned char *DestinationRawData = [rawPic bitmapData]; memcpy(DestinationRawData, CurrentFrame, SzCurrentFrame); [self RGB2BGR:DestinationRawData Sz:SzCurrentFrame]; NSImage *NewDisplayImage = [[[NSImage alloc] initWithSize:thisFrame] autorelease]; [NewDisplayImage addRepresentation:rawPic]; [ExternalView setImage:NewDisplayImage]; =CODE= The ExternalView display correctly what i want for a while, no memory leak appears but after few seconds the program gives me a bad EXC_BAD_ACCESS. After commenting the last line (setImage) there is absolutely no crash. Thinking of a side-effect i checked all sizes and everything seams to fit. I also tried to remove the autorelease and replace them by some release after the set image but nothing seams to work. Can anybody see something wrong ? Is there any other way to do what i m doing ? Thanks for the peolple that will help me. Sincerely, -- I. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: EXC_BAD_ACCESS on NSImageView::setImage
On Wed, Mar 11, 2009 at 9:33 AM, Scott Ribe wrote: > Does your setImage method retain the image? > The object ExternalView is a NSImageView so the setImage is the one of NSImageView. The doc says nothing about it, but i added some debug log like this : NSLog(@"BEFORE : %d", [NewDisplayImage retainCount]); [CameraView setImage:NewDisplayImage]; NSLog(@"AFTER : %d", [NewDisplayImage retainCount]); 2009-03-13 17:17:35.105 xxx[2281:e503] BEFORE : 1 2009-03-13 17:17:35.106 xxx[2281:e503] AFTER : 3 So i guess the image have been retained 2 times -- I. _______ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: EXC_BAD_ACCESS on NSImageView::setImage
I just change my NSWindow from NSBackingStoreBuffered to a NonRetain one and my application do not crash anymore. Unfortunatly, as expected, my window is clipping how ever i just realize that the crash might have a relation with the NSWindow double buffer mechanism. So my solution to the problem was instead of replacing the NSImage using setImage, i grab directly my NSImage from the View, then pick the representation and write directly into it. It is as a matter of fact, a way better effective way of doing what i was doing and it's avoiding all my release problems. thx -- I. On Sat, Mar 14, 2009 at 12:37 PM, Volker in Lists wrote: > Hi, > > retainCount is not in anyway useful when debugging - I had many cases of rc >> 5 with the object being gone the next instance. your error sounds like you > loose the image at some point in time. retain it and use Instruments to see > if you leak or over alloc. > > Volker > > Am 14.03.2009 um 01:23 schrieb Dev: > >> On Wed, Mar 11, 2009 at 9:33 AM, Scott Ribe >> wrote: >>> >>> Does your setImage method retain the image? >>> >> The object ExternalView is a NSImageView so the setImage is the one of >> NSImageView. >> The doc says nothing about it, but i added some debug log like this : >> >> NSLog(@"BEFORE : %d", [NewDisplayImage retainCount]); >> [CameraView setImage:NewDisplayImage]; >> NSLog(@"AFTER : %d", [NewDisplayImage retainCount]); >> >> 2009-03-13 17:17:35.105 xxx[2281:e503] BEFORE : 1 >> 2009-03-13 17:17:35.106 xxx[2281:e503] AFTER : 3 >> >> So i guess the image have been retained 2 times >> -- >> I. >> _______ >> >> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) >> >> Please do not post admin requests or moderator comments to the list. >> Contact the moderators at cocoa-dev-admins(at)lists.apple.com >> >> Help/Unsubscribe/Update your Subscription: >> http://lists.apple.com/mailman/options/cocoa-dev/volker_lists%40ecoobs.de >> >> This email sent to volker_li...@ecoobs.de > > ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: EXC_BAD_ACCESS on NSImageView::setImage
For people that might have the same issue : =NEW CODE= NSImage *NewDisplayImage = [ExternalView image]; if (NewDisplayImage == nil) { NSBitmapImageRep *rawPic = [[[NSBitmapImageRep alloc] initWithBitmapDataPlanes:NULL pixelsWide:thisFrame.width pixelsHigh:thisFrame.height bitsPerSample:8 samplesPerPixel:3 hasAlpha:NO isPlanar:NO colorSpaceName:NSCalibratedRGBColorSpace bitmapFormat:NSAlphaFirstBitmapFormat bytesPerRow:0 bitsPerPixel:0] autorelease]; unsigned char *DestinationRawData = [rawPic bitmapData]; memcpy(DestinationRawData, CurrentFrame, SzCurrentFrame); [self RGB2BGR:DestinationRawData Sz:SzCurrentFrame]; NewDisplayImage = [[[NSImage alloc] initWithSize:thisFrame] autorelease]; [NewDisplayImage addRepresentation:rawPic]; [ExternalView setImage:NewDisplayImage]; } else { NSArray *representations = [NewDisplayImage representations]; NSBitmapImageRep *rawPic = [representations objectAtIndex:0]; if (rawPic != nil) { unsigned char *DestinationRawData = [rawPic bitmapData]; memcpy(DestinationRawData, CurrentFrame, SzCurrentFrame); [self RGB2BGR:DestinationRawData SzCurrentFrame]; [CameraView setNeedsDisplay]; } } =CODE= On Sun, Mar 15, 2009 at 10:08 AM, Dev wrote: > I just change my NSWindow from NSBackingStoreBuffered to a NonRetain one and > my > application do not crash anymore. > > Unfortunatly, as expected, my window is clipping how ever i just > realize that the crash might have a relation with the NSWindow double > buffer mechanism. > > So my solution to the problem was instead of replacing the NSImage > using setImage, > i grab directly my NSImage from the View, then pick the representation > and write > directly into it. > > It is as a matter of fact, a way better effective way of doing what i > was doing and > it's avoiding all my release problems. > > thx > -- > I. > > On Sat, Mar 14, 2009 at 12:37 PM, Volker in Lists > wrote: >> Hi, >> >> retainCount is not in anyway useful when debugging - I had many cases of rc >>> 5 with the object being gone the next instance. your error sounds like you >> loose the image at some point in time. retain it and use Instruments to see >> if you leak or over alloc. >> >> Volker >> >> Am 14.03.2009 um 01:23 schrieb Dev: >> >>> On Wed, Mar 11, 2009 at 9:33 AM, Scott Ribe >>> wrote: >>>> >>>> Does your setImage method retain the image? >>>> >>> The object ExternalView is a NSImageView so the setImage is the one of >>> NSImageView. >>> The doc says nothing about it, but i added some debug log like this : >>> >>> NSLog(@"BEFORE : %d", [NewDisplayImage retainCount]); >>> [CameraView setImage:NewDisplayImage]; >>> NSLog(@"AFTER : %d", [NewDisplayImage retainCount]); >>> >>> 2009-03-13 17:17:35.105 xxx[2281:e503] BEFORE : 1 >>> 2009-03-13 17:17:35.106 xxx[2281:e503] AFTER : 3 >>> >>> So i guess the image have been retained 2 times >>> -- >>> I. >>> ___ >>> >>> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) >>> >>> Please do not post admin requests or moderator comments to the list. >>> Contact the moderators at cocoa-dev-admins(at)lists.apple.com >>> >>> Help/Unsubscribe/Update your Subscription: >>> http://lists.apple.com/mailman/options/cocoa-dev/volker_lists%40ecoobs.de >>> >>> This email sent to volker_li...@ecoobs.de >> >> > ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. 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
CIImage resize optimisation
Hello, I use QTKit to grab an image from my webcam. Then i need to resize it into a smaller image. Going from My CIImage, i use two filter "CILanczosScaleTransform" and "CICrop" to get my image at the correct size. (640x480 to 320x240+crop). Doing only that, my CPU go up to 30% of usage while it is at 12% without the transformations. I have a set of C function that works on Bitmaps that is very specialized to what i m doing, and would allow me to earn a lots of unnecessary transformations (on windows that makes my CPU usage to raise to +5% max only) ... but here the problem, the rendering of CIImage to a bitmap is worse than the filter usage. here my question, Is there a way of accessing directly the CIImage representation so that i can pick my pixels very quickly ? the aim is to be very efficient of course ... thanks to all that will help me. -- Dev _______ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. 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
Matching braces and [NSTextView selectionRangeForProposedRange:granularity:];
I'm currently trying to match braces in a text editor and intend to use selectionRangeForProposedRange:granularity: for that. While I don't see any problem in finding the matching brace, I'm a bit surprised by the way this method is called repeatedly. So far, I don't see a good way to tell a double-click occurred and just a double-click: If you double-click and release the mouse button, this method is invoked 2 times (from the double-click event). If you double-click and do not release the mouse button, this method is invoked 1 time but if you move the mouse cursor, it is invoked again and the number of clickCount is still 2. It might be possible to use some time measures to differentiate these 2 paths but this does not look like a good solution at all. Any idea? _______ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. 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
[SOLVED] Re: Matching braces and [NSTextView selectionRangeForProposedRange:granularity:];
Using - (void) textViewDidChangeSelection:(NSNotification *) inNotification instead. Works fine. On Sep 14, 2009, at 11:53 PM, Iceberg-Dev wrote: I'm currently trying to match braces in a text editor and intend to use selectionRangeForProposedRange:granularity: for that. While I don't see any problem in finding the matching brace, I'm a bit surprised by the way this method is called repeatedly. So far, I don't see a way to tell a double-click occurred and the mouse was release _______ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
[NSTextView] Shift left / Undo manager
I am currently busy re-inventing the wheel in the form a code editor. I support Shift Left and Shift Right. I would like to support Undo on Shift Left. I'm wondering how this should be done as this operation modifies both the selected range(s) and the text. I searched the archives, the NSTextView header, documentation, looked at some source code. I am able to support the undo operation for the text changes but the selected range(s) is/are not reverted to the correct value(s). From what I can see, Xcode (on Tiger) does not handle the selection correctly in this case either (though the result is better than mine) Any idea? ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. 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
[Performance issue] Resizing an alert sheet => blinks
Is it the intended behavior that resizing an Alert Sheet in Mac OS X 10.5.8 on a MacBook Pro produces a lot of blinking? I have a custom alert sheet that can be resized and when I resize it on a MacBook Pro (either 9400 or 9600 GPU), the resize operation produces flicking. I tried with some Apple's applications and with the standard save sheet and it's also blinking (less though). I removed almost every widget in the sheet, disabled the default button, it's still blinking. This does not happen with standard window and I am not experiencing this phenomenon on a PowerMac G5 running Mac OS X 10.4.11. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. 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: [Performance issue] Resizing an alert sheet => blinks
On Oct 6, 2009, at 1:29 AM, Jens Alfke wrote: On Oct 5, 2009, at 3:12 PM, Iceberg-Dev wrote: Is it the intended behavior that resizing an Alert Sheet in Mac OS X 10.5.8 on a MacBook Pro produces a lot of blinking? I have a custom alert sheet that can be resized and when I resize it on a MacBook Pro (either 9400 or 9600 GPU), the resize operation produces flicking. No, it should be smooth. Is the entire sheet window appearing and disappearing, or just the contents? The contents. It's a bit as if there was a patchwork of rectangles and a random set of these rectangles would not be redrawn when the window size increases by 1 pixel and then another set for the following pixel. I used Quartz Debug to check that there was not too much refresh and it looks fine. I tried both with a 64 bit executable and a 32 bit executable. Finally, I tried running the same code on Snow Leopard on the same MacBook and it's working correctly there. So definitely an issue with Leopard. Is anything being logged to the console while resizing, like error/ exception messages? Nope. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. 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
[UTI] Anyway to retrieve the UTI of a file without having to use a FSRef?
From what I've found in the documentation, the UTI type of a file can be retrieved using the LaunchServices APIs. This requires to provide a FSRef. Wouldn't there be an API I didn't see in Foundation that lets you obtain the type without having to convert, at least, a NSURL to a FSRef? I'm mainly interested in finding the type of a text file (txt, html, rtfd, rtf) from its path. Mac OS X 10.5. _______ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. 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: [UTI] Anyway to retrieve the UTI of a file without having to use a FSRef?
On Oct 13, 2009, at 12:42 AM, Jim Correia wrote: On Mon, Oct 12, 2009 at 6:36 PM, Iceberg-Dev wrote: From what I've found in the documentation, the UTI type of a file can be retrieved using the LaunchServices APIs. This requires to provide a FSRef. Wouldn't there be an API I didn't see in Foundation that lets you obtain the type without having to convert, at least, a NSURL to a FSRef? See, on NSWorkspace: - (NSString *)typeOfFile:(NSString *)absoluteFilePath error:(NSError **)outError; Thanks. Unfortunately, I need a solution that is daemon-safe. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. 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 open / close notifications
Hello, I'm trying to receive a notification when a file is opened basically like the main Recent Items menu. I'd like to poll a directory and monitor file operations for certain file types. Specifically open / close operations ... just looking for suggestions, I've dabbled with Uli UKKQueue but don't seem to receive open / close notifications. Was wondering is there a way to register for the finders notifications? possibly something new in 10.6? any suggestions would be greatly appreciated. _______ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Limiting the area of an NSShadow
Hello, I'm trying to mimic the background of Time Machine's large On/Off switch ( http://zcr.me/l/n2 ) by drawing it via code. This is my code so far: cellFrame.size.height = 27; NSBezierPath *border = [NSBezierPath bezierPathWithRoundedRect:cellFrame > xRadius:5.0 yRadius:5.0]; [border setLineWidth:1.0]; [[CZColor colorWithCalibratedWhite:0.246 alpha:1.000] set]; NSGradient *backGradient = [[NSGradient alloc] > initWithStartingColor:[CZColor colorWithCalibratedWhite:0.387 alpha:1.000] > endingColor:[CZColor colorWithCalibratedWhite:0.73 alpha:1.000]]; [backGradient drawInBezierPath:border angle:90.0]; NSShadow *innerShadow = [[NSShadow alloc] init]; [border addClip]; [innerShadow setShadowColor:[CZColor colorWithCalibratedWhite:0.0 > alpha:0.60]]; [innerShadow setShadowOffset:NSMakeSize(0.0, -0.75)]; [innerShadow setShadowBlurRadius:1.5]; [innerShadow set]; [border stroke]; Note: CZColor is a subclass of NSColor with no modifications, only additions. It shouldn't cause any issues. This code produces the following: http://zcr.me/l/n3 The result is close to Apple's Time Machine image, but not quite: the shadow is drawn all the way around the bezier path, and not just on the top. Is there a way for my to limit the NSShadow so that it only draws on the top part of the bezier path? Thanks so much, Carter Allen _______ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. 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
[textView:shouldChangeTextInRanges:replacementStrings:] When does this type of event occur?
What kind of event can trigger a non-linear selection to be replaced by multiple strings in different ranges? ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. 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: [textView:shouldChangeTextInRanges:replacementStrings:] When does this type of event occur?
On Dec 23, 2009, at 10:58 PM, Dave DeLong wrote: In many apps, you can hold down the option key to change the cursor into a crosshair, and do a vertical selection. In addition, in apps like Pages, you can hold down the command key to do a non- contiguous selection. I'd imagine that both of these scenarios might result in that method getting invoked. That explains how to get a non-continuous selection but not how you can change the text in multiple locations. Let's say you have a non-continuous selection and you type or paste some text, it just delete the selection and insert the new text in the first selection range (tested in TextEdit). ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. 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
[NSOpenPanel] Is there a way to access the contextual information?
[Case] You display an Open Panel with the method: - [NSOpenPanel beginSheetForDirectory:file:types:modalForWindow:modalDelegate:didEndSel ector:contextInfo:]; and you set a delegate for the panel so that you can filter out some files with the delegate method - (BOOL) panel:(id)sender shouldShowFilename:(NSString *) inFileName; Problem: what if you need to access the contextual info from the panel:shouldShowFilename: method? I haven't found a method to access the contextual information in NSSavePanel, NSPanel, NSWindow. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. 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: [NSOpenPanel] Is there a way to access the contextual information?
On Dec 27, 2009, at 11:48 PM, Graham Cox wrote: On 28/12/2009, at 9:40 AM, Iceberg-Dev wrote: Problem: what if you need to access the contextual info from the panel:shouldShowFilename: method? I haven't found a method to access the contextual information in NSSavePanel, NSPanel, NSWindow. Typically the delegate is the controller that calls beginSheet... so whatever it passed as contextInfo is available to any delegate method because it's something internal to this controller object. Can't disagree with that. If you've organised your code in such a way that the controller is not the delegate, you might want to reconsider that. I could but isn't the purpose of a contextual info to be "contextual" and so not attached to the controller instance? _______ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. 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
Commit Editing Changes as I Type
I have two controls (NSTextField and a NSTableView column) that are bound to the same attribute in core data. I've set up a timer that starts after the NSTextField starts editing and I'd like it to periodically commit the editing as the user is typing. If the user hits the Enter key I do see the text in both places but I want those updates to go as the user is typing so the text will show in both fields as the typing is happening. When my timer launches I tried calling: [myTextField commitEditing] // but this didn't work, nothing happened. I then tried: [[myTextField window] endEditingFor:nil] // which worked but the NSTextField loses focus so that's not a good solution. Any ideas?_______ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. 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
Better Way to Add an Entity to an ArrayController
I have a core data app with a model where there is a one-to-many relationship between CD and Track (CD has an NSSet called tracks). The tracks are shown in an NSTableView and the content set is managed by an NSArrayController. To manually add a track the user presses the add button which runs the "add:" selector of the arrayController. Right now, to programmatically add a track I do: [arrayController performSelector:@selector(add:) withObject:nil afterDelay:0.0]; That doesn't feel right to me. I want to create a new Track entity and add it to the CD attribute tracks which is an NSSet . I **think** I have to do the following but I don't know how exactly: 1) "willChangeValueForKey" to the CD entity, tracks attribute, from the managedObjectContext to let it know I'm going to change the tracks attribute 2) create a new Track entity 3) add that new entity to the tracks NSSet attribute in the CD entity 4) "didChangeValueForKey" That's what I've been trying to do and it's not working. I can get the tracks attribute. I retrieve it as an NSMutableSet. To create the new Track entity with the following I get a nil: Track *newTrack = [[Track alloc] init]; Assuming I do successfully create a new Track entity do I just add it to the tracks set? You can see I'm confused. Any help would be appreciated. Thank you_______ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Localization help
On Jan 27, 2010, at 3:05 PM, lorenzo7...@gmail.com wrote: [...] Of course, sorry. Instead of the localization value, I get the localization key instead, which is an English string. Here's a list of things to check: - Check that there's no missing ';' - Check that you do not have "key" ="something" = "something else"; - Check the spelling of the keys in your Italian.strings file ___________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. 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
Help with NSData dataWithContentsOfURL
I have an app that attaches a file to a document like when you attach a file to mail. I use the following to store the file as data in an iVar: fileData = [NSData dataWithContentsOfURL:url options:NSDataReadingUncached error:(NSError **)errorPtr]; This works fine for regular files but not for fileWrappers or folders (EXEC_BAD_ACCESS). I haven't found anything in the documentation that will work and am now thinking I need to use an alternate strategy like storing the files in a fileWrapper and abandoning storing them as data all together. Is there an alternative to capture the data of a wrapper and a folder? Thanks___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. 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: Help with NSData dataWithContentsOfURL
Thanks Graham, here's what I'm thinking. The documents for my app are fileWrappers. Before the document is saved for the first time I can copy the files to a temp folder and during a save move them into the fileWrapper. I guess I need to just abandon the whole NSData idea altogether. Too bad. On Feb 3, 2010, at 9:19 AM, Graham Cox wrote: > > On 04/02/2010, at 1:08 AM, cocoa-dev wrote: > >> Is there an alternative to capture the data of a wrapper and a folder? > > Not really, because of what these things are. At best a folder could be > reduced to a tree of data objects, which is what a wrapper is. But to reduce > an arbitrary folder to a single data item is inadvisable as the size of that > data is potentially unbounded. > > You could copy the file/folder to a location within your app's support > directory and save the path to it, perhaps? > > --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
NSViewAnimation vs Distributed Notification: Bug?
[Q] Is there a known bug in NSViewAnimation on Mac OS X 10.4 when it comes to Distributed Notifications? Scenario: - If I animate a window resizing through a NSViewAnimation, some Distributed Notifications are only taken into account after I click in the window resized through a NSViewAnimation. If I animate the window with setFrame:dispplay:animate:, the problem does not occur. --->8--->8--->8--->8--->8--->8--->8--- // This does not work correctly tAnimationDictionary=[NSDictionary dictionaryWithObjectsAndKeys:IBwindow_,NSViewAnimationTargetKey, [NSValue valueWithRect: tNewWindowFrame], NSViewAnimationEndFrameKey, nil]; tAnimation=[[NSViewAnimation alloc] initWithViewAnimations: [NSArray arrayWithObject:tAnimationDictionary]]; if (tAnimation!=nil) { [tAnimation setAnimationBlockingMode:NSAnimationBlocking]; [tAnimation setDuration: 0.15f]; [tAnimation startAnimation]; [tAnimation autorelease]; } // This works fine [IBwindow_ setFrame:tNewWindowFrame display:YES animate:YES]; _______ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. 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: NSViewAnimation vs Distributed Notification: Bug?
On Feb 28, 2010, at 12:35 AM, Steven Degutis wrote: Firstly, you do not need to check if tAnimation is nil, since sending a message to nil is valid in ObjC. So I would personally remove that if() and just de-indent all the code that's inside it. Actually, in the real implementation there's an else after the if. Secondly, I *think* what you're running into is the fact that "blocking mode" means the main thread blocks, and thus does not receive any distributed notifications. The second snippet of code (the one that works fine) does not animate on the main thread, thus everything works correctly. If you want to use NSViewAnimation for some reason (but I wouldn't), then you can change the mode away from blocking-mode to something more background-thready. The more I investigate this, the more it looks also linked to having 10 NSTimer with a 1/16.0f period. _______ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. 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: Custom view attached to a menu bar NSStatusItem application
I think what you want is something like MAAttachedWindow which can be found at http://mattgemmell.com/source. HTH, Tim 29 maj 2009 kl. 10.37 skrev John Ku: Ah, but that just sets a customView for that particular menu item correct?Im trying to built a full pop up menu from scratch. Im looking to change the menu borders, background, add buttons, drop down lists, etc. Its actually less of a menu in terms of function, more of a pop up window that acts like a menu and attaches underneath the icon on the menu bar. If I subclass NSMenu, is there a way to draw my own background, border, add custom buttons on this Menu? ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. 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
Getting the list of users and groups (anything new?)
On Leopard and later, is Directory Services still the official solution to retrieve the list of users and groups on the OS? Starting with Leopard, we now have the Identity Service or Collaboration Framework but it apparently can't provide all the uid and gid on the system, only provide metadata for them. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. 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
Is it possible to detour a drag and drop operation?
Problem: Let's say I have 2 windows: +---++---+ +---++---+ | || | | +-+ || | | | A | || | | +-+ || | | || | +---++---+ When I drag item A from the window on the left to the window on the right, I want to do this: When the drop is validated in the right window (type of item accepted), I would like to either display a window above the right window or change the right window content to give the user a list of more detailed possible drop locations. Something like this: +---++---+ +---+++--+ | ||| | | +-+ ||| | | | A | || Left | Right | | +-+ ||| | | ||| | +---+++--+ There's something like this in Final Cut Pro (http://www.geniusdv.com/ news_and_tutorials/assets_c/2009/04/superimpose3- thumb-394x397-2264.gif). Question: - How could this be achieved in Cocoa? I have tried with a window but the target of the drop does not get changed. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. 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: Is it possible to detour a drag and drop operation?
On Aug 16, 2009, at 2:03 AM, Jerry Krinock wrote: On 2009 Aug 15, at 12:51, Iceberg-Dev wrote: When the drop is validated in the right window (type of item accepted), I would like to either display a window above the right window or change the right window content to give the user a list of more detailed possible drop locations. Seems like a "sheet" would be appropriate. http://developer.apple.com/documentation/Cocoa/Conceptual/Sheets/ Sheets.html It's not appropriate in this case and it would make the operation less transparent to the user. The sheet solution would require these additional things: - showing the sheet - clicking at least one - hiding the sheet The solution I'm looking into just requires moving the mouse. I have tried with a window but the target of the drop does not get changed. Probably no one understands what you mean by that. I don't. When the drop is validated, if you display a new window under the current position of the mouse, the target of the drop is not moved to the new window even if you move the mouse. _______ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. 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
LSUIElement vs applicationShouldTerminate:
As far as I can tell, when LSUIElement is set to 1, applicationShouldTerminate: is not called when a Cocoa application receive a terminate request. Is there a way in this case to prevent the application from being terminated by friend terminate requests (SIGTERM would be accepted)? Mac OS X 10.6.4. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. 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 10 UI
On Sep 2, 2010, at 5:28 AM, John C. Randolph wrote: On Sep 1, 2010, at 8:15 PM, Eric E. Dolecki wrote: Top left, the traffic lights have been turned to the vertical. Is this something new or was this easy to do before? Is it just a custom implementation, or? It's pretty easy to implement that kind of thing. NSWindow has a - standardWindowButton: method that will give you a close button, zoom button, etc. It's not easy. 1. If you retrieve a NSButton with the official API, you will not be able to get the mouse over effect. This is a bug since Mac OS X 10.4 and it has still not been fixed in Mac OS X. 2. The NSButton Apple uses for NSWindow buttons are not simple NSButtons. And you can not display the mouse over version of the button rendering (as far as I've tried and Apple's DTS was not able to provide a solution either). _______ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
how to set the value of NSLevelIndicatorCell in tableView
I drag NSLevelIndicatorCell to tableView,and use it like this: -(IBAction)levelAction:(id)sender { NSLog(@"Level clicked: %ld", [senderintValue]); [levelCellsetIntValue:[senderintValue]]; [levelCellsetWarningValue:[senderintValue]]; } - (void)tableView:(NSTableView *)aTableView setObjectValue:(id)anObject forTableColumn:(NSTableColumn *)aTableColumn row:(NSInteger)rowIndex{ if([[aTableColumnidentifier]isEqualToString:@"evaluate"]){ [levelCellsetAction:@selector(levelAction:)]; } } But i cannot change it in the tableView,it means that when i change it it displays but then it has nothing.How can i set the value ?any suggestion?_______ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. 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
[NSImage] Bug in System Preferences?
I'm currently playing with a screen saver. Problem: It draws correctly in fullscreen mode or in SaverLab but does not in the preview mode of the 'Desktop & Screen Saver' pane of the System Preferences. Basically, in #fail mode, it draws the first frame and then does not refresh. It works on Mac OS X 10.4 but does not on Mac OS X 10.5 and 10.6. Details: An animation frame is drawn in - [ScreenSaverView animateOneFrame] by drawing a NSImage using the - drawInRect:fromRect:operation:fraction: method. The NSImage contains one bitmap representation. I have access to the buffer of the bitmap representation and I update it for each new frame. What I've checked: -- o The problem is not with the size of the preview view, it works fine with this size, I tested it in SaverLab and in a custom Screen Saver testing app. o The problem is not with the NSRect parameters passed to the drawInRect:fromRect:operation:fraction: method. I've traced their values in gdb. o The problem is not with the bytes buffer not being updated, I checked in gdb that the values were correctly updated. o The problem is not with the view not being refreshed. I draw a rectangle with an increasing lighter color (for testing purpose) before calling the drawInRect:... method and the rectangle color is correctly updated. Where I think the problem lies: --- There must be some kind of (annoying here) optimization made by the Cocoa APIs. Since this works in fullscreen mode, it must be an optimization not enabled in fullscreen mode (and which was not in Mac OS X 10.4). QUESTION: - What can be done to address this behavioral incoherence in System Preferences? Code snippet: - Here is how the NSImage and NSBitmapImageRep are created (self is a NSView subclass instance): imageRect_=[self bounds]; realWidth_=(((unsigned long) floor(imageRect_.size.width))/ DIVIDER)*DIVIDER; origin_=imageRect_.origin; origin_.x=origin_.x+((unsigned long) (imageRect_.size.width- realWidth_))/2; imageRect_.size.width=realWidth_; pixelHeight_=imageRect_.size.height; imageRep_ = [[NSBitmapImageRep alloc] initWithBitmapDataPlanes:NULL pixelsWide: realWidth_ pixelsHigh: imageRect_.size.height bitsPerSample:8 samplesPerPixel:4 hasAlpha:YES isPlanar:NO colorSpaceName:NSDeviceRGBColorSpace bytesPerRow:0 bitsPerPixel:0 ]; buffer_=[imageRep_ bitmapData]; image_=[[NSImage alloc] initWithSize:imageRect_.size]; [image_ addRepresentation:imageRep_]; _______ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: [NSImage] Bug in System Preferences? [solved]
On Oct 22, 2010, at 12:48 AM, Iceberg-Dev wrote: I'm currently playing with a screen saver. Problem: It draws correctly in fullscreen mode or in SaverLab but does not in the preview mode of the 'Desktop & Screen Saver' pane of the System Preferences. Basically, in #fail mode, it draws the first frame and then does not refresh. It works on Mac OS X 10.4 but does not on Mac OS X 10.5 and 10.6. [...] QUESTION: - What can be done to address this behavioral incoherence in System Preferences? I solved the issue on Mac OS X 10.6 by calling lockFocusOnRepresentation: and unlockFocus before and after I refresh the bitmap buffer. Funnily enough, this bug also exists with the CoreGraphics API. CopyBits, I miss you. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: [NSImage] Bug in System Preferences? [solved]
On Oct 23, 2010, at 2:41 AM, Ken Ferry wrote: On Oct 22, 2010, at 4:07 PM, Iceberg-Dev wrote: On Oct 22, 2010, at 12:48 AM, Iceberg-Dev wrote: I'm currently playing with a screen saver. Problem: It draws correctly in fullscreen mode or in SaverLab but does not in the preview mode of the 'Desktop & Screen Saver' pane of the System Preferences. Basically, in #fail mode, it draws the first frame and then does not refresh. It works on Mac OS X 10.4 but does not on Mac OS X 10.5 and 10.6. [...] QUESTION: - What can be done to address this behavioral incoherence in System Preferences? I solved the issue on Mac OS X 10.6 by calling lockFocusOnRepresentation: and unlockFocus before and after I refresh the bitmap buffer. Funnily enough, this bug also exists with the CoreGraphics API. Hi- This isn't a bug, and your workaround could break under you at any time. If you think about what has to happen, you'll realize you cannot just have permanent direct access to the backing store. The image has to be colormatched and possibly uploaded to the graphics card, for example. How are the frameworks to know if you toggled a bit and that work must be redone? The basic CG model for an image is that it's immutable. Thanks for the hints. I tried them this weekend. When working with NSBitmapImageRep, calling -bitmapData is a signal that you may be editing the data. It is not repackaged until the bitmap is drawn, or somesuch. It's illegal to just stash a pointer to the data and use it arbitrarily later - that won't necessarily be the same data as now backs the image. This is described in the 10.6 AppKit release notes. Calling -bitmapData works on Mac OS X 10.5, it does not work on Mac OS X 10.6. On 10.6, it's slow and the data gets zeroed. Bug? In CG, you may be interested in the relationship of CGBitmapContext to CGBitmapContextCreateImage. The latter makes a copy-on-write vm copy of the data from bitmap context. So it's cheap until real copying is forced by a write to the context data. I tried this solution and it's way too slow (or I'm doing it incorrectly). Having to create a CGImageRef and then releasing it is killing the framerate. Basically, the only solution to get a decent framerate (25 fps) and a real refresh is to: - call -bitmapData on Mac OS X 10.5. - call lockFocusOnRepresentation: on Mac OS X 10.6. _______ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: [NSImage] Bug in System Preferences? [solved]
Le 27 oct. 10 à 02:09, Gregory Weston a écrit : On Oct 26, 2010, at 16:29, Stephane Sudre wrote: On Tue, Oct 26, 2010 at 4:14 AM, Gregory Weston wrote: Iceberg-Dev wrote: When working with NSBitmapImageRep, calling -bitmapData is a signal that you may be editing the data. It is not repackaged until the bitmap is drawn, or somesuch. It's illegal to just stash a pointer to the data and use it arbitrarily later - that won't necessarily be the same data as now backs the image. This is described in the 10.6 AppKit release notes. Calling -bitmapData works on Mac OS X 10.5, it does not work on Mac OS X 10.6. On 10.6, it's slow and the data gets zeroed. Bug? It would seem, but where is uncertain. I just threw something together to access every byte of a 3MPixel image sequentially. It consistently took just over 0.02s and did not result in data loss. Well, on my MacBook Pro: - it's slow - it zeroes the data and it crashes: ... Without calling - bitmapData, it's reasonably fast and does not crash. Can you post your sample code? I could, but I'm not sure how much value it would have. All I've got is a degenerate case demonstrating that -bitmapData can work as expected. It'd be, I think, much more useful to see your actual misbehaving code and figure out what it's doing that's leading to it. (Which may or may not be your bug.) Sure: http://s.sudre.free.fr/Software/Source/SwirlSourceCode_SL.dmg ___________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. 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
[CFBundleIdentifier] Is is really a hyphen or a minus?
According to the documentation here: http://developer.apple.com/library/mac/#documentation/General/ Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html%23// apple_ref/doc/uid/TP40009249-102070-TPXREF105 a CFBundleIdentifier value can accept alphanumeric, period and hyphen characters. By "hyphen", does the documentation actually mean a minus glyph (like the one on the numeric keypad) or really the hyphen typographic glyph? If the latter, how do you type one on an Apple keyboard? If the former, why not just write minus? ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. 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: [CFBundleIdentifier] Is is really a hyphen or a minus?
On Dec 4, 2010, at 7:55 PM, Ken Thomases wrote: On Dec 4, 2010, at 12:42 PM, Iceberg-Dev wrote: By "hyphen", does the documentation actually mean a minus glyph (like the one on the numeric keypad) or really the hyphen typographic glyph? If the former, why not just write minus? That character's Unicode name is HYPHEN-MINUS. OK. I didn't know that. Calling it "hyphen" seems legitimate and in accord with typical usage. You're being excessively pedantic to assume that only U2010 (HYPHEN) can be called "hyphen". I'm not trying to be pedantic here, I'm trying to figure out exactly which characters are accepted and which patterns are supposedly correct. I'm still wondering whether using the word "hyphen" means that: "com.apple.quicktime-movie" is correct but com.apple.quicktime-" is not. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Calculating file size
Hello, I was wondering what was the best way to calucate folder size with cocoa? I was able to do this but it does not include resource forks: #import int main() { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; NSString *path = [@"/Folder" stringByExpandingTildeInPath]; NSDirectoryEnumerator *e = [[NSFileManager defaultManager] enumeratorAtPath :path]; NSString *file; unsigned long long totalSize = 0; while ((file = [e nextObject])) { NSDictionary *attributes = [e fileAttributes]; NSNumber *fileSize = [attributes objectForKey:NSFileSize]; totalSize += [fileSize longLongValue]; } printf("Total size: %lld\n", totalSize); [pool release]; } or from the example in documentation - (IBAction)calculateSize:(id)sender { NSFileManager *fileManager = [NSFileManager defaultManager]; NSString *path = @"/Folder"; NSDictionary *fileAttributes = [fileManager fileAttributesAtPath:path traverseLink:YES]; if (fileAttributes != nil) { NSNumber *fileSize; if (fileSize = [fileAttributes objectForKey:NSFileSize]) { NSLog(@"File size: %qi\n", [fileSize unsignedLongLongValue]); [label setIntValue:[fileSize unsignedLongLongValue]]; } } But I was unsure on how to traverse the entire file tree within that directory, and give the same size results as the finder. Thanks, -Mike ___________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. 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 [EMAIL PROTECTED]
How to transform a NSString to a NSString C string format?
Problem: I would like to transform a NSString to a NSString conforming to the C string format. Examples: - toto -> toto "toto -> \"toto toto -> toto\ntiti titi My Current Solution: I can do this using a NSMutableString and a series of call to: - replaceOccurrencesOfString:withString:options:range: The problem I see with this solution is that I will probably forget some cases. Question: - Would there be a better solution? (I couldn't find a method in NSString, NSMutableString CFStringRef APIs but I might missed it). _______ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
NSNotificationCenter : multiple messages sent to the same observer?
I just discovered something recently. If you register an observer with the same name/object/selector twice, you get the notification twice when you post it. Isn't the NSNotificationCenter supposed to prevent 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
NSOutlineView : Incorrect Drag and Drop drawing?
I have a NSOutlineView and its highlight mode is "SourceList". When I drag a selected item (the cell is a subclass of NSTextField from the DargAndDropOutlineView sample code) from the list, its text is drawn in white. This means you can't see it since most the of the windows background are white usually. This does not happen with a NSOutlineView with a standard highlight mode. Is this a known bug? (Mac OS X 10.5.6 clean install) ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. 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: NSNotificationCenter : multiple messages sent to the same observer?
On Feb 22, 2009, at 1:37 AM, Michael Ash wrote: On Sat, Feb 21, 2009 at 6:06 PM, Iceberg-Dev wrote: I just discovered something recently. If you register an observer with the same name/object/selector twice, you get the notification twice when you post it. Isn't the NSNotificationCenter supposed to prevent this? Why, is there some place in the documentation where it says that? There isn't. But it would make sense in 99% of cases. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. 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: NSNotificationCenter : multiple messages sent to the same observer?
On Feb 22, 2009, at 6:39 PM, Bill Bumgarner wrote: On Feb 22, 2009, at 8:59 AM, Iceberg-Dev wrote: On Feb 22, 2009, at 1:37 AM, Michael Ash wrote: On Sat, Feb 21, 2009 at 6:06 PM, Iceberg-Dev wrote: I just discovered something recently. If you register an observer with the same name/object/selector twice, you get the notification twice when you post it. Isn't the NSNotificationCenter supposed to prevent this? Why, is there some place in the documentation where it says that? There isn't. But it would make sense in 99% of cases. Actually, the behavior is documented in the Cocoa Notifications programming topic: It is possible for an observer to register to receive more than one message for the same notification. In such a case, the observer will receive all messages it is registered to receive for the notification, but the order in which it receives them cannot be determined. Thanks for the pointer. It would be nice to have this explanation available in the description of the addObserver:selector:name:object: as it might be where one could expect to find it. I filed an enhancement suggestion. The current behavior makes it possible to implement architectures where a client could take "more action" for any given notification by registering more than once. Not supporting this pattern would make such a pattern significantly more inconvenient to implement. As well, any kind of a coalescing in the notification center is going to increase the complexity/overhead of the observer and, in particularly, might likely impact notification delivery speed (or, alternatively, require the notification center to use a bunch more memory to differentiate between "set of registered observers" and "list of observers that I actually deliver stuff to"). I think it would just require to make the search once on registration, not every time a notification is sent. _______ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. 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: NSNotificationCenter : multiple messages sent to the same observer?
On Feb 22, 2009, at 7:06 PM, Bill Bumgarner wrote: On Feb 22, 2009, at 9:59 AM, Iceberg-Dev wrote: [...] The current behavior makes it possible to implement architectures where a client could take "more action" for any given notification by registering more than once. Not supporting this pattern would make such a pattern significantly more inconvenient to implement. As well, any kind of a coalescing in the notification center is going to increase the complexity/overhead of the observer and, in particularly, might likely impact notification delivery speed (or, alternatively, require the notification center to use a bunch more memory to differentiate between "set of registered observers" and "list of observers that I actually deliver stuff to"). I think it would just require to make the search once on registration, not every time a notification is sent. Assuming that your statement is made in light of trying to avoid the bloat I alluded to in the previous paragraph, this would lead to some very surprising behavior. Imagine this sequence of calls... - (void)addObserver:self selector:(SEL)aSelector name:BobsYourUncleNotification object:(id)anObject; - (void)addObserver:self selector:(SEL)aSelector name:BobsYourUncleNotification object:(id)anObject; - (void)removeObserver:self name:BobsYourUncleNotification object: (id)anObject; If the notification center coalesced observers on registration, the above would mean that the notification would no longer be sent. If anObject is the same object in the 3 calls, this is probably already the case if I am to believe the documentation. Which is the behavior I would expect/wish for. _______ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. 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
AddressBook (Repost from objc-language)
Hi! I am reposting this as I mistakenly sent it to objc-language...oops. Documentation for ABAddressBook exposes a new method for 10.5: [ABAddressBook addressBook].(ABAddressBook Class Reference) Doc says that it "Returns a new instance of ABAddressBook". As I am in need of using a "private" addressbook for a project, I thought this would be perfect. With a quick test I attempted: ... ab = [ABAddressBook addressBook]; //ab= [ABAddressBook sharedAddressBook]; ABPerson *aPerson = [[[ABPerson alloc] init] autorelease]; [aPerson setValue:@"Remy" forProperty:kABFirstNameProperty]; [aPerson setValue:@"Lebeau" forProperty:kABLastNameProperty]; [ab addRecord:aPerson]; [ab save]; ... What I found out was that both sharedAddressBook and addressBook accomplished the same thing, that is adding a new person into my existing user addressbook, as opposed to generating a new addressbook... Did I misunderstand the documentation? TIA! Jeremy ___________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. 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 [EMAIL PROTECTED]
[NSOpenPanel] How to disable folder selection but still access their contents?
Solution not found in the cocoabuilder archive. Problem: I have a list of files and folders. I can add items to this list through a standard NSOpenPanel dialog. When a folder is already in the list, I want to prevent the user from selecting it from the NSOpenPanel dialog. I can do this with: - (BOOL) panel:(id)sender shouldShowFilename:(NSString *) inFileName; The problem is that this prevents the user from selecting a file within this folder from the NSOpenDialog. Question: - Is there a way to prevent a folder from being selected but still allow a file within this folder to be selected? I could use - (BOOL)panel:(id)sender isValidFilename:(NSString *) filename; and always allow to select the folder but I want the user to know that the folder can not be selected and not just discover this when the Open button gets clicked. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. 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 [EMAIL PROTECTED]
Re: [NSOpenPanel] How to disable folder selection but still access their contents?
On Oct 24, 2008, at 1:20 AM, Corbin Dunn wrote: On Oct 23, 2008, at 1:38 PM, Iceberg-Dev wrote: Solution not found in the cocoabuilder archive. Problem: I have a list of files and folders. I can add items to this list through a standard NSOpenPanel dialog. When a folder is already in the list, I want to prevent the user from selecting it from the NSOpenPanel dialog. I can do this with: - (BOOL) panel:(id)sender shouldShowFilename:(NSString *) inFileName; The problem is that this prevents the user from selecting a file within this folder from the NSOpenDialog. Question: - Is there a way to prevent a folder from being selected but still allow a file within this folder to be selected? Yes; I think just calling setCanChooseDirectories:NO will work. If not, then: 1. Don't use shouldShowFilename: 2. Call setCanChooseDirectories:NO 3. Call beginForDirectory:.. types:(your types) If you have to do some specific dynamic processing to turn on/off enabled types, then you may be out of luck. Feel free to log a bug requesting to make this process easier. (I already do have some bugs logged for this ability to be easier, so I am aware of the problem). Hmm. Actually, I want the user to be able to choose a folder/ directory as long as it's not already in my list of files/folders. Otherwise, setCanChooseDirectories:NO would work, Or am I missing something and you're suggesting to call setCanChooseDirectories:NO:NO from the panel:shouldShowFilename: delegate method? ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. 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 [EMAIL PROTECTED]
Re: [NSOpenPanel] How to disable folder selection but still access their contents?
On Oct 24, 2008, at 11:51 PM, Corbin Dunn wrote: On Oct 24, 2008, at 2:26 PM, Iceberg-Dev wrote: On Oct 24, 2008, at 1:20 AM, Corbin Dunn wrote: On Oct 23, 2008, at 1:38 PM, Iceberg-Dev wrote: Solution not found in the cocoabuilder archive. Problem: I have a list of files and folders. I can add items to this list through a standard NSOpenPanel dialog. When a folder is already in the list, I want to prevent the user from selecting it from the NSOpenPanel dialog. I can do this with: - (BOOL) panel:(id)sender shouldShowFilename:(NSString *) inFileName; The problem is that this prevents the user from selecting a file within this folder from the NSOpenDialog. Question: - Is there a way to prevent a folder from being selected but still allow a file within this folder to be selected? Yes; I think just calling setCanChooseDirectories:NO will work. If not, then: 1. Don't use shouldShowFilename: 2. Call setCanChooseDirectories:NO 3. Call beginForDirectory:.. types:(your types) If you have to do some specific dynamic processing to turn on/off enabled types, then you may be out of luck. Feel free to log a bug requesting to make this process easier. (I already do have some bugs logged for this ability to be easier, so I am aware of the problem). Hmm. Actually, I want the user to be able to choose a folder/ directory as long as it's not already in my list of files/folders. Okay - I assumed you wanted only files. Otherwise, setCanChooseDirectories:NO would work, Or am I missing something and you're suggesting to call setCanChooseDirectories:NO:NO from the panel:shouldShowFilename: delegate method? No; don't do that. You have to use shouldShowFilename: and implement -isValidFilename to validate the file when the user hits enter. Sorry -- there isn't any other way around it -- you can't have a folder disabled and still browseable with the current API. I'd recommend just accepting all folders, and if it is already in your list, then just let the user choose the duplicate, and handle it as a nop. OK, I will file an enhancement request because I think being able to disable a folder yet allow access to its contents can make sense in multiple cases. It would just require disabling the Open button. Maybe something like [NSNavView setCanSeeContentsOfDisabledDirectories:YES]; _______ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. 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 [EMAIL PROTECTED]
Re: RE : How are we supposed to retrieve th e generic bundle icon?
On Nov 11, 2008, at 6:17 PM, Etienne Guérard wrote: Did you take a look at IconServices GetIconRef() function using one of the generic Finder icons constant? I did. That's part of the "because:" section. On Nov 11, 2008, at 8:15 PM, Gregory Weston wrote: What are you really trying to illustrate with this icon? Are you sure the Lego® block is the right thing to show? Standard Apple Plugins that use this icon. Yes, I'm sure. Message d'origine De: [EMAIL PROTECTED] de la part de Iceberg-Dev Date: mar. 11/11/2008 17:36 À: cocoa-dev@lists.apple.com Objet : How are we supposed to retrieve the generic bundle icon? I need to get a NSImage of the generic bundle icon. (Mac OS X 10.4 or later) I'm currently using this: [[NSImage alloc] initWithContentsOfFile:@"/System/Library/ CoreServices/CoreTypes.bundle/Contents/Resources/KEXT.icns"] because: - NSFileTypeForHFSTypeCode('BNDL') does not work. It returns a generic document icon. - I haven't found an appropriate constant for NSFileTypeForHFSTypeCode. _______ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. 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 [EMAIL PROTECTED]
How are we supposed to retrieve the generic bundle icon?
I need to get a NSImage of the generic bundle icon. (Mac OS X 10.4 or later) I'm currently using this: [[NSImage alloc] initWithContentsOfFile:@"/System/Library/ CoreServices/CoreTypes.bundle/Contents/Resources/KEXT.icns"] because: - NSFileTypeForHFSTypeCode('BNDL') does not work. It returns a generic document icon. - I haven't found an appropriate constant for NSFileTypeForHFSTypeCode. - I can't rely on -[NSWorkspace iconForFileType:@".bundle"] because, for instance, as soon as Microsoft Word is installed, icons for .bundle can display a Word bundle icon instead of the correct one. - I haven't found so far a better solution while googling for one. Question: Is there a better way to retrieve the generic bundle icon? ___________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. 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 [EMAIL PROTECTED]
Re: RE : How are we supposed to retrieve the generic bundle icon?
On Nov 11, 2008, at 9:39 PM, Kyle Sluder wrote: On Tue, Nov 11, 2008 at 2:50 PM, Iceberg-Dev <[EMAIL PROTECTED]> wrote: Standard Apple Plugins that use this icon. Yes, I'm sure. Are you attempting to use this icon for your own purposes, like plugins for your own app? No, I'm not. I just want to display it in a case very similar to the Finder Info Window. _______ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. 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 [EMAIL PROTECTED]
Re: How are we supposed to retrieve the generic bundle icon?
On Nov 11, 2008, at 9:44 PM, Gregory Weston wrote: Iceberg-Dev wrote: On Nov 11, 2008, at 8:15 PM, Gregory Weston wrote: What are you really trying to illustrate with this icon? Are you sure the Lego® block is the right thing to show? Standard Apple Plugins that use this icon. Yes, I'm sure. Perhaps I'm missing something, but why not then retrieve the icon for the file rather than for the type? I don't want to display a custom icon if someone eventually copy- pasted one on the bundle. Or if the file doesn't actually exist, use NSWorkspace's iconForFileType: with the extension (such as @"kext"). I would if this was reliable. But it's apparently not as described with .bundle vs Microsoft Word. ___________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. 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 [EMAIL PROTECTED]
Re: How are we supposed to retrieve the generic bundle icon?
On Nov 11, 2008, at 10:39 PM, Stephen J. Butler wrote: On Tue, Nov 11, 2008 at 3:34 PM, Iceberg-Dev <[EMAIL PROTECTED]> wrote: On Nov 11, 2008, at 9:44 PM, Gregory Weston wrote: Perhaps I'm missing something, but why not then retrieve the icon for the file rather than for the type? I don't want to display a custom icon if someone eventually copy- pasted one on the bundle. The question is not really whether you want to display a custom icon, but rather if the user wants one displayed. If they went to the trouble to change the icon, I imagine they really want it changed everywhere. In this case, no. Because it won't be visible at the end of the process. I will stick to my solution then. _______ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. 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 [EMAIL PROTECTED]
Re: Detect the login window is being displayed
On Nov 12, 2008, at 10:56 PM, Maggie Zhang wrote: Hi, Is there a way (like a notification or API) that the daemon can figure out when the login window is being displayed after the user logs out? SystemConfiguration Framework. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. 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 [EMAIL PROTECTED]
Re: NSView positioning problems
On Nov 16, 2008, at 7:25 PM, Andre Masse wrote: Hi all, In a nib, I have a view (OutputView) which contains a table view and a custom view (OutputToolbarView) which will be loaded from another nib. This view will end up in a NSTabView. So in IB, I placed a dummy custom view above the table view like this: - | custom| - | | | table view | | | |___| In the window controller -windowDidLoad method, I load the the OutputView which loads the OutputToolbarView (each have their own NSViewControllers). Now, I tried to make the replacement in the OutputView's controller awakeFromNib method but this puts the custom view on top of the table view, positioned at the origin specified for the custom view in the nib. That's because the replacement happens before the table view had the chance to resize itself according to the window's height (I think). If instead of replacing the custom view, I add it as a subview of the dummy custom view, the origin is correct but it doesn't fill the window's width. I've read the documentation about NSView and it's companion guide but it's a big chunk to swallow and I would like to see a simple example on where to put the code for replacing a view. In both cases, you can't just replace or insert a view and hope its frame will be correct. If you want to replace the custom view, you need to: 1) Get the frame of the custom view 2) Set this frame to be the one of your replacement view (better if done before adding the view) If you want to insert your view inside the custom view, you need to: 1) Get the bounds of the custom view 2) Set these bounds to be the frame of your view (better if done before adding the view). ___________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. 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 [EMAIL PROTECTED]
Re: Simple single file renaming application ...
On Nov 19, 2008, at 8:09 PM, vince wrote: Thanks for the help ... I want to build a simple single file re-namer. Just a window and a textField that displays the current filename, and a text Field and Save option for the edit. So right click a file/"open with" ... the app runs and loads up the current file name prepared for the edit. Does anyone know of any sample code that I can take a look at? NSFileManager: - (BOOL)movePath:(NSString *)source toPath:(NSString *)destination handler:(id)handler ? ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. 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 [EMAIL PROTECTED]
Re: Best way to Change Window
On Nov 23, 2008, at 9:44 PM, Gordon Apple wrote: What is the best way to change to a different window? I have a main window nib with a lot of controllers in it. Currently the main view is in a scrolling window. I want to live-switch between that and a borderless (optionally full screen) window or a resizable (non-scrolling) window. I'm sure I could do this by duplicating or triplicating the nib, changing what is necessary, closing the window, change out the window controller in my document, open the new window. However, I don't like the duplicity of this approach and the need to synchronize future changes in similar nibs. Is there a better way? NSWindowController has "setWindow", but it also says: "This method releases the old window and any associated top-level objects in its nib file and assumes ownership of the new window. You should generally create a new window controller for a new window and release the old window controller instead of using this method." What are "associated top-level objects"? I don't want anything else to go away, although I would have to code a few wiring changes. When you needed to change between a brushed metal window and an Aqua window, a solution was to keep the content view of the current window, delete the window and create a new one with the appropriate theme and then replace the content view. In your case, it might be interesting to wonder if you want the control inside the window to look the same as non full-screen. If you take a look at iPhoto for instance, the look of the controls differs between fullscreen and standard mode. If you want the controls to look different, then maybe another nib is a solution. ___________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. 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 [EMAIL PROTECTED]
Re: open package installer in bundle resources directory not working
On Dec 13, 2008, at 12:46 PM, Kyle Sluder wrote: 3) Why all this trouble of launching executables? There's a reason Launch Services is a public framework; use that. Don't use -[NSWorkspace openFile:], because that's not guaranteed to open the package in Installer.app. Instead, use LSOpenURLsWithRole: http://developer.apple.com/DOCUMENTATION/Carbon/Reference/ LaunchServicesReference/Reference/reference.html#//apple_ref/doc/ uid/TP3998-CH1g-TPXREF104 Just in case: I've been using NSWorkspace exactly for this for more than 6 years now. Still waiting for a report from a user stating it does not open Installer.app but another application... _______ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. 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: Drawing NSTextFieldCell subclass in table view
On Dec 13, 2008, at 11:11 PM, Andre Masse wrote: Hi, I want to display a cell like mail's message count in a table view but with a fixed size and centered on both axes. I've created a NSTextFieldCell subclass and its doing fine except that it draws in the first row only, which could mean I'm drawing at the wrong coordinates. Obviously, this is not what I want :-) Drawing without modifying the cellFrame (commenting out the first 2 lines and changing the argument to "frame") produces the expected result: a nice oval in every row but filling the entire cell space... Any help, pointer to doc or tutorial are welcome. Thanks, Andre Masse - (void)drawWithFrame:(NSRect)cellFrame inView:(NSView *)controlView { // we want 36x20 CGFloat y = cellFrame.size.height/2.0 - 10.0; NSRect frame = NSMakeRect(cellFrame.origin.x, y, 36.0, 20.0); CGFloat lineWidth = 1.5; frame = NSInsetRect(frame, lineWidth, lineWidth); //draw frame CGFloat radius = NSHeight(frame)*0.45; NSBezierPath *backgroundPath = [NSBezierPath bezierPathWithRoundedRect:frame xRadius:radius yRadius:radius]; [backgroundPath setLineWidth:lineWidth]; [frameColor set]; [backgroundPath stroke]; // fill it frame.size.height -= 2; frame.origin.y += 1; frame = NSInsetRect(frame, 1, 0); [fillColor set]; [[NSBezierPath bezierPathWithRoundedRect:frame xRadius:radius yRadius:radius] fill]; // draw text [super drawWithFrame:frame inView:controlView]; } NSTextFieldCell is flipped. This has an impact on the y value. It might be the cause of the issue in your case. _______ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
[NSTableView] How should a grid be drawn?
I'm trying to draw a custom grid for a table view. I' using the code at the end of this post. The problem is that when I scroll the tableview, some of the horizontal lines are not drawn. I looked at different sample code on the net including the GNUStep source code and found none that was working correctly. I displayed the clipRect to check out which parts were being refreshed. Still some of the lines are not drawn. I also tried doing the drawing in highlightSelectionInClipRect: without better results. What's wrong with the code? --8<--8<---8<---8<---8<- --8<---8<--- /* Grid should looks like this: -- -- -- -- ---- --- -- -- -- -- ---- --- */ - (void) drawGridInClipRect:(NSRect) clipRect { float rowHeight = [self rowHeight] + [self intercellSpacing].height; NSRect visibleRect = [self visibleRect]; NSRect highlightRect; float tColumWidth; NSBezierPath * tBezierPath; const float tPattern[2]={2.0,5.0}; highlightRect.origin = NSMakePoint(NSMinX(visibleRect), (int)(NSMinY (clipRect)/rowHeight)*rowHeight); highlightRect.size = NSMakeSize(NSWidth(visibleRect), rowHeight + [self intercellSpacing].height); tColumWidth=[[self tableColumnWithIdentifier:ICDOCUMENT_LANGUAGE] width] + [self intercellSpacing].width; [[self gridColor] set]; tBezierPath=[NSBezierPath bezierPath]; while (NSMinY(highlightRect) < (NSMaxY(visibleRect)/*+[self intercellSpacing].height*/)) /* Extending to the whole visibleRect */ { NSRect clippedHighlightRect = NSIntersectionRect(highlightRect, visibleRect); int tRowIndex; tRowIndex = (int)((NSMinY(highlightRect)+rowHeight*0.5f)/rowHeight); if ((tRowIndex%2)==0) { [tBezierPath setLineDash:tPattern count:0 phase:0]; [tBezierPath moveToPoint:NSMakePoint(NSMinX (clippedHighlightRect),NSMinY(clippedHighlightRect)-0.5f)]; [tBezierPath lineToPoint:NSMakePoint(NSMaxX (clippedHighlightRect),NSMinY(clippedHighlightRect)-0.5f)]; } else { [tBezierPath setLineDash:tPattern count:2 phase:0]; [tBezierPath moveToPoint:NSMakePoint(NSMinX(clippedHighlightRect) +tColumWidth,NSMinY(clippedHighlightRect)-0.5f)]; [tBezierPath lineToPoint:NSMakePoint(NSMaxX (clippedHighlightRect),NSMinY(clippedHighlightRect)-0.5f)]; } [tBezierPath stroke]; [tBezierPath removeAllPoints]; highlightRect.origin.y += rowHeight; } } _______ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: How to make letters appear in italics?
On Mar 17, 2009, at 10:16 PM, Jim Correia wrote: On Mar 17, 2009, at 10:14 AM, Li Fumin wrote: Hi,all.I am new to cocoa. I am reading Aaron Hillegass's Book "Cocoa Programming for Mac OS X". I have got some problems with challenge 2 of Chapter 20.I have a custom NSView called BigLetterView, and then it show the input letter on the view.Now I want to make the letter which I just inputted appears in italics. So, I define this method: - (IBAction) isItalic: (id) sender { if ([italicBox state]) { NSFontManager *fontManager = [NSFontManager sharedFontManager]; [fontManager convertFont: [NSFont fontWithName: @"Helvetica" size: 75] toHaveTrait: NSItalicFontMask]; }else { NSFontManager *fontManager = [NSFontManager sharedFontManager]; [fontManager convertFont: [NSFont fontWithName: @"Helvetica" size: 75] toHaveTrait: NSUnitalicFontMask]; } [self setNeedsDisplay: YES]; } When I click the italics check button. Nothing happens. How do I suppose to make this wok? How can I get the font the letter is using? Look at the API doc and method prototype for - convertFont:toHaveTrait:. It returns a new font. You discard the return value, and don't update any of your own state, so I'm not sure how you envisioned this to work. In the case where you want to remove the italic attribute, you should be using -convertFont:toNotHaveTrait:. Does one get the same results (Italic) when you use the NSObliquenessAttributeName attribute? Or are these totally different? ___________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: [NSTableView] How should a grid be drawn?
On Mar 17, 2009, at 12:45 AM, Corbin Dunn wrote: On Mar 16, 2009, at 4:06 PM, Iceberg-Dev wrote: I'm trying to draw a custom grid for a table view. I' using the code at the end of this post. The problem is that when I scroll the tableview, some of the horizontal lines are not drawn. I looked at different sample code on the net including the GNUStep source code and found none that was working correctly. I displayed the clipRect to check out which parts were being refreshed. Still some of the lines are not drawn. I also tried doing the drawing in highlightSelectionInClipRect: without better results. What's wrong with the code? Draw your grid based on the [self bounds], not [self visibleRect]. Don't use the clipRect either, just use [self visibleRect] (I think you are using the clip rect like the visible bounds, which isn't wrong -- it isn't the part you see, but it is the dirty part). Works fine after applying your suggestions. Thanks. _______ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. 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
[BUG?] - [NSLayoutManager usedRectForTextContainer:] returns incorrect value
Problem: I'm seeing incorrect results when I try to get the height of a string with a particular font and maximum width. Context: I'm running the code below. I have a single NSWindow with a checkbox and a button. In the awakeFromNib method of the main controller, I change the attribute of the checkbox string. In the compute: method, I compute the height requested to display a string for a specific font and maximum width. If I run this code as is, I get 17.0 as the required height. That's incorrect. If I comment the awakeFromNib code, I get 34.0f as the required height. That's correct. Questions: - Is it a bug in NSLayoutManager? If so, is there a workaround? If it's not, what am I missing? -8<-8<8<8<8<8<8< #import "MainController.h" @implementation MainController - (void) awakeFromNib { NSAttributedString * tAttributedString; tAttributedString=[[NSAttributedString alloc] initWithString: [IBcheckBox_ title] attributes:[NSDictionary dictionaryWithObjectsAndKeys:[IBcheckBox_ font],NSFontAttributeName, [NSNumber numberWithInt:NSUnderlineStyleSingle],NSStrikethroughStyleAttributeName, nil]]; if (tAttributedString!=nil) { [IBcheckBox_ setAttributedTitle:tAttributedString]; [tAttributedString release]; } } - (IBAction) compute:(id) sender { float tHeight=0; NSString * tString=@"It's a long list title, don't you think?"; float tMaxWidth=134.0f; NSFont * tFont; tFont=[NSFont systemFontOfSize:13.0f]; if (tString!=nil) { NSTextStorage * tTextStorage; tTextStorage=[[NSTextStorage alloc] initWithString:tString]; if (tTextStorage!=nil) { NSTextContainer * tTextContainer; tTextContainer = [[NSTextContainer alloc] initWithContainerSize: NSMakeSize(tMaxWidth, FLT_MAX)]; if (tTextContainer!=nil) { NSLayoutManager * tLayoutManager; tLayoutManager = [[NSLayoutManager alloc] init]; if (tLayoutManager!=nil) { [tLayoutManager setTypesetterBehavior:NSTypesetterBehavior_10_2_WithCompatibility]; [tLayoutManager addTextContainer:tTextContainer]; [tTextStorage addLayoutManager:tLayoutManager]; [tTextStorage addAttribute:NSFontAttributeName value:tFont range:NSMakeRange(0, [tTextStorage length])]; [tTextContainer setLineFragmentPadding:0.0f]; [tLayoutManager glyphRangeForTextContainer:tTextContainer]; tHeight=NSHeight([tLayoutManager usedRectForTextContainer:tTextContainer]); [tLayoutManager release]; } [tTextContainer release]; } [tTextStorage release]; } } NSLog(@"%@: %f %f %@",tString,tHeight,tMaxWidth,tFont); } @end ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. 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: [BUG?] - [NSLayoutManager usedRectForTextContainer:] returns incorrect value
On Mar 30, 2009, at 3:55 PM, Benjamin Stiglitz wrote: I'm running the code below. I have a single NSWindow with a checkbox and a button. In the awakeFromNib method of the main controller, I change the attribute of the checkbox string. In the compute: method, I compute the height requested to display a string for a specific font and maximum width. If I run this code as is, I get 17.0 as the required height. That's incorrect. If I comment the awakeFromNib code, I get 34.0f as the required height. That's correct. Is this the code exactly as it is in the app? e.g. compute: doesn't depend in any way on the values you set in -awakeFromNib? (I think this is your complaint, but I'm just verifying.) Yes. Not that this fixes your problem, but -[NSAttributedString boundingRectWithSize:options:] would probably be a bit easier for you to use. I tried it. It apparently does not work for multi-line text. I should probably add that additional tests show that the bug appears in Mac OS X 10.4.11 but not in Mac OS X 10.5.6. I also thought of a ugly workaround (strike the text with a bezier path instead of relying on the Cocoa Text Engine) but if there is a better solution, I'm still interested. _______ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. 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: hud panel tiger
20 apr 2009 kl. 18.15 skrev Rick C.: Hello, Just to be sure the HUD panel in IB3 cannot be used if the app is for tiger correct? Is there any workaround or basically it has to be done in code? As a note I notice all the 3rd party frameworks seem to be leopard only as well? Thank you, Rick Hi, I believe you are correct on your first point. As a substitution you could use Matt Gemmell's HUDWindow (which can be found at http://mattgemmell.com/source) . Cheers, Tim Andersson ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
[NSOutlineView] _outlineCell and _trackingOutlineCell vs 64-bit
What's the official way to replace _outlineCell and _trackingOutlineCell in Cocoa 64-bit? I do this for 32-bit: @implementation NSOutlineView (PrivateCells) - (NSButtonCell *) outlineCell { return _outlineCell; } - (void) setOutlineCell:(NSButtonCell *) inButtonCell { if (_outlineCell!=inButtonCell) { [_outlineCell release]; _outlineCell=[inButtonCell retain]; } } - (NSButtonCell *) trackingOutlineCell { return _trackingOutlineCell; } - (void) setTrackingOutlineCell:(NSButtonCell *) inButtonCell { if (_trackingOutlineCell!=inButtonCell) { [_trackingOutlineCell release]; _trackingOutlineCell=[inButtonCell retain]; } } @end But 64-bit is not happy with it at all. --- I need to replace among other things the drawWithFrame:inView: method to get a different rendering. - (void)outlineView:(NSOutlineView *)outlineView willDisplayOutlineCell:(id)cell forTableColumn:(NSTableColumn *) tableColumn item:(id)item; is probably not what I'm looking for. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. 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: [NSOutlineView] _outlineCell and _trackingOutlineCell vs 64-bit
On Apr 22, 2009, at 5:50 PM, Corbin Dunn wrote: Howdy, On Apr 22, 2009, at 4:37 AM, Iceberg-Dev wrote: What's the official way to replace _outlineCell and _trackingOutlineCell in Cocoa 64-bit? I do this for 32-bit: @implementation NSOutlineView (PrivateCells) - (NSButtonCell *) outlineCell { return _outlineCell; } Note that what you are doing is not an official way to make things work in 32-bit. It is strongly discouraged to access the ivars to AppKit classes, and what you are doing may break in the future. Well, the future is already there. You can't do for 64-bit applications what you can do for 32-bit ones. There is no way to replace the outlinecell How could one then draw the disclosure triangle in white (and correctly centered vertically) instead of black/dark gray (and incorrectly centered)? -- please log a bug requesting the ability to do so. Will do. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. 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: [NSOutlineView] _outlineCell and _trackingOutlineCell vs 64-bit
On Apr 22, 2009, at 8:16 PM, Corbin Dunn wrote: [...] There is no way to replace the outlinecell How could one then draw the disclosure triangle in white Leopard has a bug with them looking too dark; that is a known issue, and it will be fixed. There is no easy way to make them white, but in the -willDisplayOutlineCell method you can replace the image on the NSButtonCell. (and correctly centered vertically) instead of black/dark gray (and incorrectly centered)? Override frameOfOutlineCellAtRow: and place it where you want. Your solution works. Thanks. The only issues I have with it are: - independence of resolution lost: By using code, I was able to have independence of resolution through bezier path. By changing the images, I'm stuck with fixed size image. I don't have Illustrator to create a PDF version of the triangles. - feedback is not perfect: The non highlighted images can be changed. The highlighted state can not be changed or tuned. But since it now builds and runs in 64-bit, I can't really complain. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. 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
FSPathCopyObjectSync and symbolic links?
Is it possible to copy a symbolic link (the symbolic link file and not the item it references) using the FSPathCopyObjectSync API? No valuable info was found in the documentation, the list archive, google results. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. 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: FSPathCopyObjectSync and symbolic links?
On Apr 26, 2009, at 4:05 PM, Michael Hall wrote: On Apr 26, 2009, at 8:22 AM, Iceberg-Dev wrote: Is it possible to copy a symbolic link (the symbolic link file and not the item it references) using the FSPathCopyObjectSync API? No valuable info was found in the documentation, the list archive, google results. The File Manager Reference http://developer.apple.com/documentation/Carbon/Reference/ File_Manager/Reference/reference.html#//apple_ref/c/func/ FSCopyObjectSync saying A pointer to the source object to copy. The object can be a file or a directory. would suggest to me that a symlink file would be OK. From what I'm seeing it's not. My test case being like this: I copy a symlink (pointing to a file that does not exist anymore) to a destination. When I use FSPathCopyObjectSync, it returns with error -43 (file not found). Not sure if your searching came across "FSCopyObject - /Sources/ FSCopyObject.c" http://developer.apple.com/SampleCode/FSCopyObject/listing3.html but it might be informative to your question. This is the solution I've been using till now. And it's a great solution if you need to get a solution that runs on Mac OS X 10.2 and later. But since I need 64-bit compatibility, I'm looking for solutions that I don't have to support if possible. I was into these or similar links for a problem of my own yesterday but "the documentation, the list archive and google results" did lead to a resolution which they often do. I wasn't aware symlinks might be a problem until I started getting -1407 File Manager errors that seemed related to these files. Since you are aware in advance they might be a concern a little testing might give you a more definite answer and save some searching. (Fwiw, I eliminated the use in one place of an FSSpec since these seem to be getting more and more deprecated these days and I used FSPathMakeRefWithOptions (10.4+) in another place which looked like it would default resolve symlinks and these changes seemed to correct my own problem. No -1407 errors). My solution so far is to go with FSCopyObjectSync and make the FSRef conversion. I was hoping I would escape the conversion by using the path version. _______ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. 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
[Moderator] iPhone SDK is still under NDA - Do not discuss openly.
Until an announcement is made otherwise, developers should be aware that the iPhone SDK is still under non-disclosure. It can't be discussed here, or anywhere publicly. This includes other mailing lists, forums, and definitely blogs. This situation is somewhat different than a Mac OS X release, in that a Mac OS X release includes a copy of the developer tools with the distribution. The iPhone OS 2.0 release on devices and as an upgrade does _not_ include the development tools. As a result, the SDK is not automatically considered public because the release has occurred. When the SDK is lifted an announcement will be made here. Thanks for your understanding Scott [moderator] comments should be sent to [EMAIL PROTECTED] ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. 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 [EMAIL PROTECTED]
[Moderator] iPhone SDK is still under NDA - Do not discuss here
iPhone SDK -- Until an announcement is made otherwise, developers should be aware that the iPhone SDK is still under non-disclosure (section 5.3 of the iPhone Development Agreement). It can't be discussed here, or anywhere publicly. This includes other mailing lists, forums, and definitely blogs. This situation is somewhat different than a Mac OS X release, in that a Mac OS X release includes a copy of the developer tools with the distribution. The iPhone OS 2.0 release on devices and as an upgrade does _not_ include the development tools. As a result, the SDK is not automatically considered public because the release has occurred. Section 5.3 of the iPhone Development Agreement remains in force at this time, and will so remain until iPhone Developer Program members are specifically and personally notified by an authorized representative of Apple. When the SDK is lifted members of the iPhone Developer Program will be specifically and personally notified by an authorized representative of Apple. Thanks for your understanding Scott [moderator] ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. 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 [EMAIL PROTECTED]
Calendar Store with non AddressBook participants?
Hello List, I am investigating the possibility to use icalserver to store medical appointments. This means either: - a physician (a user of the calendar) - a patient - a given day and time or - a resource (XRay material, etc...) - a patient - a given day and time Now, I have two problems: 1) It looks like I can only have participants which come from AddressBook. In my situation, participants are patients and come from a central database. They are identified by a GUUID. Obviously, I need to be able to search for all events for a given patient or add an event for a patient. Patients can't be users (I may have thousands of them). How would you do this from the Cocoa API? Or, if not possible from the Cocoa API, is this possible some other way through the CalDAV protocole? Maybe it is not as "participants" but as some additional info I should register a patient for an event? 2) It looks like I can't register through iCal an event with only a resource and a participant. I need a user. However, if a patient comes for an XRay, I know he will be using a given resource (the XRay machine), I know the patient, but the technician who will be in charge of handling the XRay is unknown (or at least, not important at that stage of setting up the appointment). I need to be able to know where there is still room with a resource for a given exam. And as for question 1, I need to be able to search for all future exams for a given patient or add an exam for a patient. Again, how can I do this through the Cocoa API? Or, if not possible, through the CalDAV protocole. Thanks for any hint, Alexander _______ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. 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 [EMAIL PROTECTED]
Loading mechanism with NSAtomicStore
Hello List, As I understand, when using NSAtomicStore, there is only a "load" method to load the data. It looks like it is an "all or nothing" operation. However, if I want to load data from a server through some kind of HTTP/XML/Whatever method and only receive a subset of data. How would I implement this? For example, I want to retrieve a list of patients from a hospital system. Obviously, I am not going to load all the patients of the hospital! Now, I can imagine having some king of global variable read by the "load" method I implement to load only the list of patients I need. But then, how is the faulting handled? A patient will refer to a list of medications, a list of visits, etc... My load method, again, can't deeply fetch all the objects potentially needed because I would end up with all the objects in memory. So I suspect, if a fault is triggered on an object in memory and the object is not (yet) in the local cache, I need my NSAtomicStore (subclass) to be notified to read from my distant store (HTTP/XML...) the missing object(s). Is this possible currently? Any thoughts or solutions for this problem are welcome! Thanks, Alexander _______ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. 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 [EMAIL PROTECTED]
Re: [NSCFNumber intValue]: unrecognized selector
On Sep 26, 2008, at 11:22 AM, j o a r wrote: On Sep 25, 2008, at 6:22 AM, Steve Rossi wrote: I've deduced that he crash seems to be something timing related which occurs only at application startup, and only under certain conditions (i.e. reproduce occassionlly by opening an NSOpenPanel modal dialog before the application is fully up and running). When I say the application is fully up and running, I mean a secondary thread has retrieved data from a network source and populated a model class. This secondary thread cyclically updates the data about 8x per second by means of a timer in the secondary thread's run loop. I use Cocoa bindings to display the data in the UI. I'm sure the problem is happening in the bindings, but I'm having trouble finding where. In the general case, and with few exceptions, you can't call your UI on non-main threads. This means that you can't drive UI updates based on KVO notifications from non-main threads. Could this be your problem? j o a r Yes, that is correct. A separate thread is spawned which updates the model - consequently driving UI updates based on KVO notifications. It is the only thread that is updating the model - the main thread does very little except respond to fairly minimal UI events. It works very reliably it seems ... except on these occassions when the OpenPanel is opened from the main thread. I can think through whether I really need that separate thread. But is there a way to make the model updates from the 2nd thread safe? _______ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. 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 [EMAIL PROTECTED]
Notarization error: The signature algorithm used is too weak
Hi all, I wonder if anyone's familiar with this error which only happens when I send my apps for notarization: "AppName.zip/AppName.app/Contents/Resources/EWSMacCompress.tar.gz/EWSMacCompress.tar/EWSMac.framework/Versions/A/EWSMac83886082" "The signature algorithm used is too weak." Additional info: -I've been signing my apps for years with no issues. The error only happens when sending the apps for notarization. -I submitted a bug back in November 2018, provided Apple all the info they asked for - but it was never addressed further. -I recently contacted Apple again and they pointed me to some resource page that was created back in 2016. It briefly mentions a similar error - but still without any info on how to solve it: https://developer.apple.com/library/archive/technotes/tn2206/_index.html#//apple_ref/doc/uid/DTS40007919-CH1-TNTAG301 -A search on this error didn't produce anything useful. -The tar.gz file in question is an eSellerate licensing framework. As many people may know, it's been a popular licensing??platform for Mac software for over a decade. While I switched to a different licensing platform some time ago, I still have thousands of customers with eSellerate licenses (as I'm sure is the situation with many other Mac developers). As far as I understand, this whole situation has to do something with signing files inside tar.gz archives - on which I couldn't find any info either Any help will be appreciated! Thanks, Leo ___________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Is the list alive?
Hmm... my earlier message today never got through. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Notarization error: The signature algorithm used is too weak
On 5/28/19 9:26 PM, Richard Charles wrote: On May 28, 2019, at 3:43 PM, Leo via Cocoa-dev wrote: -I recently contacted Apple again and they pointed me to some resource page that was created back in 2016. It briefly mentions a similar error - but still without any info on how to solve it: https://developer.apple.com/library/archive/technotes/tn2206/_index.html#//apple_ref/doc/uid/DTS40007919-CH1-TNTAG301 -A search on this error didn't produce anything useful. -The tar.gz file in question is an eSellerate licensing framework. As many people may know, it's been a popular licensing??platform for Mac software for over a decade. While I switched to a different licensing platform some time ago, I still have thousands of customers with eSellerate licenses (as I'm sure is the situation with many other Mac developers). As far as I understand, this whole situation has to do something with signing files inside tar.gz archives - on which I couldn't find any info either Looks to me like your eSellerate framework is signed with a version 1 signature. You need to resign the framework with a version 2 signature. --Richard Charles Thanks Richard, Can you please elaborate on this... I'm on Xcode 10 and Mojave. As far as I understand, ever since Mavericks it's always version 2 signature. Or am I missing something? I don't see any option in codesign to specify the signature version. Thanks, Leo _______ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Is the list alive?
On 5/29/19 9:02 AM, Steve Mills via Cocoa-dev wrote: On May 28, 2019, at 19:46:26, Leo via Cocoa-dev wrote: Hmm... my earlier message today never got through. Supposedly, these lists are to be done away with at some point. Someone started co...@apple-dev.groups.io, which many of us have moved to. Or use the annoying and inferior dev forums.developer.apple.com. -- Steve Mills Drummer, Mac geek Thanks for the info. Now I see that my emails do get through - however, it takes HOURS for them to show up (like 5+ hours). I wonder if it's normal - or should I adjust something on my end? Leo ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Notarization error: The signature algorithm used is too weak
On 5/29/19 1:53 PM, Richard Charles wrote: On May 28, 2019, at 8:18 PM, Leo via Cocoa-dev wrote: Can you please elaborate on this... Perhaps this will help. https://stackoverflow.com/questions/25152451/are-mac-app-store-code-sign-resource-envelopes-always-version-1 Thanks Richard, The issue is now solved - thanks to someone's advice on Stack Overflow: https://stackoverflow.com/questions/56351428/macos-notarization-error-the-signature-algorithm-used-is-too-weak I need to sign the actual framework first, then re-package it as tar.gz. I added this process as Run Script phase in Xcode - and the app is finally notarized. Leo ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: How to get log from user
___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
'altool' cannot be found
Hi all, I wanted to start building a notarization automation script. However, when I try to use the 'xcrun altool' in Terminal, I get the following error: xcrun: error: unable to find utility "altool", not a developer tool or in PATH I'm on macOS 10.14.5, Xcode 10.2.1. I then especially downloaded and installed Xcode Command Line Tools - still get same error. Other tools like stapler do work. I checked this dir and altool is not there: /Library/Developer/CommandLineTools/usr/bin Any idea what's going on? Thanks for any help! Leo _______ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: 'altool' cannot be found
Thanks Keary, You helped me solve the issue. altool was indeed in this folder: /Applications/Xcode.app/Contents/Developer/usr/bin/ However, xcode-select -p returned /Library/Developer/CommandLineTools I reset the path with xcode-select -r. Now everything seems to work. Thanks, Leo On 6/15/19 9:56 AM, Keary Suska wrote: I am using that Xcode version and for a while now all Xcode utilities and command line tools are installed in the Xcode app package. My copy is at /Applications/Xcode.app/Contents/Developer/usr/bin/altool. Do you find it in that location? If so, xcrun should be able to find it. If you run xcode-select -p does it show the expected path? Keary Suska Esoteritech, Inc. "Demystifying technology for your home or business" On Jun 15, 2019, at 12:12 AM, Leo via Cocoa-dev wrote: Hi all, I wanted to start building a notarization automation script. However, when I try to use the 'xcrun altool' in Terminal, I get the following error: xcrun: error: unable to find utility "altool", not a developer tool or in PATH I'm on macOS 10.14.5, Xcode 10.2.1. I then especially downloaded and installed Xcode Command Line Tools - still get same error. Other tools like stapler do work. I checked this dir and altool is not there: /Library/Developer/CommandLineTools/usr/bin Any idea what's going on? Thanks for any help! Leo ___________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/cocoa-dev%40esoteritech.com This email sent to cocoa-...@esoteritech.com ___________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Alerts in Xcode 11
I'm by no means an expert but if I understand what you're trying to do, I think the approach I would take is to make an extension on UIViewController: extension UIViewController { func notificationAlert(_ msg1: String, _ msg2: String) { // create the UIAlertAlertController // and then do as David Duncan said and do: self.present(, animated: completion: …) } } Now all your UIViewController subclasses can call that method (and because it's a method, they have access to self which is a subclass of UIViewController). HTH, Dave > On Sep 30, 2019, at 11:27 PM, Doug Hardie via Cocoa-dev > wrote: > > I tried that and swift complains that self is not defined. This is not in a > view controller but a stand alone function used in many view controllers. > Generally it is used during a segue, but I added one in a view controller to > a button action, not part of a segue and it dismissed the alert also. > > -- Doug > >> On 30 September 2019, at 19:48, David Duncan wrote: >> >> Instead of creating a new window and a root view controller in order to >> present your alert, just use (assuming self is a UIViewController) >> self.present(, animated: completion: …) >> >>> On Sep 30, 2019, at 5:48 PM, Doug Hardie wrote: >>> >>> Not sure how to do that. It's not in any view controller as it is used in >>> virtually all of the various view controllers. That's why I wanted it as a >>> function. >>> >>> -- Doug >>> >>>> On 30 September 2019, at 14:44, David Duncan >>>> wrote: >>>> >>>> What happens if you present it over your normal view controller hierarchy >>>> instead of using another window? >>>> >>>> Has your application adopted UIWindowScene? >>>> >>>>> On Sep 30, 2019, at 5:36 PM, Doug Hardie via Cocoa-dev >>>>> wrote: >>>>> >>>>> I have some code that presents an alert to the user with information they >>>>> need, and an OK button to clear it. It works fine in the previous Xcode >>>>> versions. However, after upgrading to 11, it now displays the alert and >>>>> then immediately clears it. This happens both in the simulator and on a >>>>> real device. I have played around with the code and can't figure out how >>>>> to make it leave the alert on the screen. This is in Swift. It is a >>>>> function that is called from numerous places in the app. >>>>> >>>>> func NotificationAlert (_ msg1: String, _ msg2: String) { >>>>> let ErrorAlert = UIAlertController(title: msg1, message: msg2, >>>>> preferredStyle: .alert) >>>>> let dismiss = UIAlertAction(title: "Ok", style: .default, handler: nil) >>>>> ErrorAlert.addAction(dismiss) >>>>> ErrorAlert.presentInOwnWindow(animated: true, completion: nil) >>>>> } >>>>> >>>>> extension UIAlertController { >>>>> func presentInOwnWindow(animated: Bool, completion: (() -> Void)?) { >>>>>let alertWindow = UIWindow(frame: UIScreen.main.bounds) >>>>>alertWindow.rootViewController = UIViewController() >>>>>alertWindow.windowLevel = UIWindow.Level.alert + 1; >>>>>alertWindow.makeKeyAndVisible() >>>>>alertWindow.rootViewController?.present(self, animated: animated, >>>>> completion: completion) >>>>> } >>>>> } >>>>> >>>>> >>>>> -- Doug >>>>> >>>>> _______ >>>>> >>>>> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) >>>>> >>>>> Please do not post admin requests or moderator comments to the list. >>>>> Contact the moderators at cocoa-dev-admins(at)lists.apple.com >>>>> >>>>> Help/Unsubscribe/Update your Subscription: >>>>> https://lists.apple.com/mailman/options/cocoa-dev/david.duncan%40apple.com >>>>> >>>>> This email sent to david.dun...@apple.com >>>> >>> >> > > ___ > > Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) > > Please do not post admin requests or moderator comments to the list. > Contact the moderators at cocoa-dev-admins(at)lists.apple.com > > Help/Unsubscribe/Update your Subscription: > https://lists.apple.com/mailman/options/cocoa-dev/davelist%40mac.com > > This email sent to davel...@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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Thoughts on Cocoa
There’s a (short, I think) chapter missing from this story. I attended a public (technical) talk in Town Hall (I think it’s called) at Apple shortly before or after I went to work there. It would have been around 2000-2001. The speaker’s message was that the future of the desktop was Java. A pretty big surprise and unwelcome news for those of us who saw Apple as the future of Objective-C and the NeXTStep lineage rather than the other way around. As the talk went on, it came out that the speaker was the manager of the compiler group responsible for Java and Objective-C — and had been going back to early NeXT days. So one had to conclude that he was committed to the course he described. People tried to ask about Objective-C (vs. Java) and he said that Objective-C was done, he clearly didn’t want to talk about that. This before the public release of Mac OS X 10.0. Another effort that sank in the deep blue sea. I think one has to assume that technology strategy at Apple is less disciplined by the business side than at companies like IBM, Microsoft, Intel, Oracle, etc. And within Apple, there is a certain amount of chaos within Engineering that gets exposed from time to time. I think they might feel that’s a good thing. If you’re thinking like a business person, you should accept this as a given and make your decisions accordingly. If you’re thinking like a person who likes the technology, you may or may not reach the same conclusions. But I don’t think you’re going to change the way Apple does things. Me, I still don’t understand why, given the long history of support at Apple/NeXT for C++ and the maturity of the compilers available, there is any need for Swift. But there it is. Or, there they are. Perhaps this is the way the younger generation overtthrows the older? Or not, but I’m pretty sure there is no compelling business argument for it. Tom > On Oct 11, 2019, at 2:54 PM, Charles Srstka via Cocoa-dev > wrote: > >> On Oct 11, 2019, at 12:44 AM, Jens Alfke wrote: >> >> >>> On Oct 10, 2019, at 6:18 PM, Richard Charles via Cocoa-dev >>> wrote: >>> >>> Just a guess but perhaps management had an awakening when they found the >>> time and effort expended to write the next even better version of Finder in >>> Carbon was substantially more difficult and costly that the prior Cocoa >>> version. >> >> The only Cocoa—>Carbon Finder transition I know of was before 10.0 shipped. >> The development versions had a NeXT file manager with a Mac UI skin, but >> before release that was replaced with a Carbon-ized port of (a subset of) >> the MacOS 9 Finder. That Finder lived on for a few years before being >> replaced by a new rewritten Cocoa version. >> >> —Jens > > The NeXT/Rhapsody file manager was what I was referring to. > > As for the 10.0 Finder, I’m sure it shared code with the OS 9 finder, but it > was an essentially new app based on PowerPlant (which the OS 9 Finder, to the > best of my knowledge, was not). It did not feel much like the OS 9 Finder, > and it was missing a lot of basic functionality that the OS 9 Finder had had, > much of which was gradually reintroduced over the years. The Cocoa rewrite of > the Finder did not appear until Snow Leopard was released in 2009. Notably, > the Finder was still Carbon when Apple suddenly out of nowhere (again, from > the perspective of an outsider) dropped the previously promised 64-bit Carbon > support in 2007. > > As for the Dock, there was no OS 9 analogue to that at all, so the only > conclusion can be that it was rewritten in Carbon from the ground up, when a > Cocoa one had been previously available. This is difficult to explain other > than as a statement of confidence in Carbon. > > Charles > > ___ > > Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) > > Please do not post admin requests or moderator comments to the list. > Contact the moderators at cocoa-dev-admins(at)lists.apple.com > > Help/Unsubscribe/Update your Subscription: > https://lists.apple.com/mailman/options/cocoa-dev/blenko%40martingalesystems.com > > This email sent to ble...@martingalesystems.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Thoughts on Cocoa source code
> 2019. 10. 12. 오전 9:55, Richard Charles via Cocoa-dev > 작성: > > >> On Oct 11, 2019, at 1:14 PM, Turtle Creek Software via Cocoa-dev >> wrote: >> >>>> I know this is the Cocoa devs list... but why not make a website? >>>> It would be easier to develop, completely crossplatform, no app store >>>> complications, you would be in total control of your stack, etc. >> >> QuickBooks has gone that route. They still grudgingly sell desktop apps, >> but really push people towards their cloud version. Besides all the >> benefits you mention, it's a steady monthly income. Hence why Microsoft >> and Adobe are also going that route. Apple too. > > If I understand this correctly. > > Microsoft Office Web apps (Word, Excel, PowerPoint) are simplified versions > of desktops apps that run in a web browser along with a subscription service. > > Apple iWork web apps (Pages, Numbers, Keynote) are feature complete versions > of desktop and mobile apps that run in a web browser. Apple has never > released the details of how they do this. Microsoft Office & Apple iWork web apps could be complex due to compatibility with the offline ones, and that they have a feature set that only has steadily expanded for a ten to twenty years. They also need to have their app integrated with their other services. > Adobe Creative Cloud apps (Lightroom and Photoshop) are native apps for > desktop and mobile with cloud based storage and a subscription service. They > are not cross-platform browser based web apps. > > None but the biggest of companies can do this. That’s not true, web apps aren’t really complex if you get to use the npm ecosystem. There are high quality libraries that do much of the heavy lifting, so writing ones usually are wiring glue code between the libraries. > One alternative for native desktop apps is a Box Integration. > > https://support.apple.com/en-us/HT207876 > > --Richard Charles > > ___ > > Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) > > Please do not post admin requests or moderator comments to the list. > Contact the moderators at cocoa-dev-admins(at)lists.apple.com > > Help/Unsubscribe/Update your Subscription: > https://lists.apple.com/mailman/options/cocoa-dev/pcr910303%40icloud.com > > This email sent to pcr910...@icloud.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Thoughts on Cocoa source code
> 2019. 10. 12. 오후 7:52, Jean-Daniel 작성: > > >>> Le 12 oct. 2019 à 03:07, 조성빈 via Cocoa-dev a >>> écrit : >>> >>> >>> 2019. 10. 12. 오전 9:55, Richard Charles via Cocoa-dev >>> 작성: >>> >>> >>>> On Oct 11, 2019, at 1:14 PM, Turtle Creek Software via Cocoa-dev >>>> wrote: >>>> >>>>>> I know this is the Cocoa devs list... but why not make a website? >>>>>> It would be easier to develop, completely crossplatform, no app store >>>>>> complications, you would be in total control of your stack, etc. >>>> >>>> QuickBooks has gone that route. They still grudgingly sell desktop apps, >>>> but really push people towards their cloud version. Besides all the >>>> benefits you mention, it's a steady monthly income. Hence why Microsoft >>>> and Adobe are also going that route. Apple too. >>> >>> If I understand this correctly. >>> >>> Microsoft Office Web apps (Word, Excel, PowerPoint) are simplified versions >>> of desktops apps that run in a web browser along with a subscription >>> service. >>> >>> Apple iWork web apps (Pages, Numbers, Keynote) are feature complete >>> versions of desktop and mobile apps that run in a web browser. Apple has >>> never released the details of how they do this. >> >> Microsoft Office & Apple iWork web apps could be complex due to >> compatibility with the offline ones, and that they have a feature set that >> only has steadily expanded for a ten to twenty years. >> They also need to have their app integrated with their other services. >> >>> Adobe Creative Cloud apps (Lightroom and Photoshop) are native apps for >>> desktop and mobile with cloud based storage and a subscription service. >>> They are not cross-platform browser based web apps. >>> >>> None but the biggest of companies can do this. >> >> That’s not true, web apps aren’t really complex if you get to use the npm >> ecosystem. There are high quality libraries that do much of the heavy >> lifting, so writing ones usually are wiring glue code between the libraries. > > I’m not quite sure what your definition of complex is, but on my side, I > consider that an app that use hundred (if not thousand) of dependencies that > have to be review To be optimal, all of the npm dependencies should be reviewed... but I’ve never seen a codebase that reviews all of its deps. Mostly, if it is done, it’s usually the direct ones, and to be honest, it really doesn’t matter if you want to get things done. I’m pretty sure most Cocoa codebases don’t review its cocoapods deps as well. > and properly managed to avoid conflict I’ve never seen npm dependencies conflict. > and can disappear without notice and break your app, After the left-pad fiasco, packages with dependents cannot be removed without npm’s consent. > is a complex system. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: FYI: info on our scary Mac rebooting iOS testing crash.
> 2019. 10. 19. 오전 9:17, Alex Zavatone via Cocoa-dev > 작성: > > Wow was this ever fun. > > Woo hoo! > > Let this be an exercise in the dangers of memory leaks. > > Our team uses VIPER with everything being strongly linked. Also in > Objective-C, there are cases where private instance variables are used, not > the wrapping properties, not to mention strongly referenced delegates. Who > needs memory management, right? Well, guess what? When you do this, it's > really easy to leak lots of objects and this means lots of mach ports are > requested from Xcode and this means that there are lots of mach ports > requested by the WindowServer and this means that the GPU driver, (SkyLight) > requests more mach ports - until the system says, "no, you can not have any > more.” That happens around 260,000+ mach ports in the WindowServer. This > restarts the GPU. And when the GPU restarts, the system either restarts the > Mac or crashes the user session out to the login screen. > > After a night fixing memory bugs until midnight, I ran our 280 KIF tests and > no more than 20,000 mach ports were requested. And the full test ran all the > way through without rebooting the Mac or crashing out to the login screen. > > Memory leaks matter! > > Oh, and if anyone wants video of watching the Mac reboot when the > WindowServer has over 260,000 mach ports allocated, I'll happily post a link. Just for curiosity: I would like the link :-) > Cheers, > > Alex Zavatone > >> On Oct 17, 2019, at 12:07 PM, Alex Zavatone via Cocoa-dev >> wrote: >> >> As a background, I mentioned that we occasionally have these scary crashes >> while running our iOS tests that either reboot your Mac or crash the user >> process out to the login screen. >> >> Yesterday, I noticed that I could not run our tests at all without crashing >> around a certain area and on 3 different Macs, all with 24 GB or more of RAM. >> >> My speculation that it, might be related to mach ports was entirely correct >> as after 8 crashes, some debug logs finally appeared - but not all the time. >> >> Our iOS UI tests are run by KIF which uses XCTest as its foundation. When >> running these 280+ UI automation scripts in the Simulator, the amount of >> ports used by Xcode increased rapidly as the tests ran for 30 mins and the >> WindowServer process appeared to have about 20,000 more Mach ports allocated >> than Xcode over that time. >> >> Right before the crash happened, the WindowServer had allocated over 256,000 >> ports and Xcode was just behind by a few thousand. Then, all operation >> pauses for a few seconds, the displays go black, and a few seconds later, >> the user login screen appears as the previous user session crashed out. >> >> What happened is that Xcode asked for more ports and asked the WindowServer >> to allocate more ports and the WindowServer asked the GPU driver for more >> ports and thread com.apple.SkyLight.mtl_submit to crash with either a SIGSEV >> or SIGILL. Either the WindowServer or the Skylight framework for >> MetalDevice and caused a GPU restart. The OS then crashed the user session >> out to the login screen. >> >> Now, the question. Why the hell is XCTest causing Xcode to request so many >> Mach ports and never release them until the app is quit or the system >> crashes? >> >> I tested this last night outside of our app with XCTest and KIF simply going >> back and forth between two screens in an iOS app several thousand times In >> the Simulator. The mach ports of both Xcode and the WindowServer go up and >> are not released until the app quits, but not nearly as fast as in our >> tests. >> Is this a mach port leak in XCTest? >> >> Does anyone know the details on the guts of this? >> >> Thanks a lot and I hope this helps someone else. >> >> Alex Zavatone >> >> Sent from my iThing. >> ___ >> >> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) >> >> Please do not post admin requests or moderator comments to the list. >> Contact the moderators at cocoa-dev-admins(at)lists.apple.com >> >> Help/Unsubscribe/Update your Subscription: >> https://lists.apple.com/mailman/options/cocoa-dev/zav%40mac.com >> >> This email sent to z...@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 moder
Re: Thoughts on Objective-C++
‘It’s like giving a glass of ice water to somebody in hell’ - Jobs (; > Am 12.11.2019 um 21:00 schrieb Richard Charles via Cocoa-dev > : > > >> On Nov 11, 2019, at 6:05 PM, Turtle Creek Software via Cocoa-dev >> wrote: >> >> Unfortunately, software for any vertical or specialty market has to deal >> with Mac market share. >> > > > I just downloaded iTunes 12.10.2.3 (64 bit) for Windows 10 Pro. It runs > great, looks great, no crashes. An examination of application files shows > dlls for CoreFoundation, CoreText, Foundation, CoreGraphics, Objective-C, > etc. This is a Cocoa application. > > Why can't Apple provide tools so that outside developers can also do this? > > --Richard Charles > > ___ > > Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) > > Please do not post admin requests or moderator comments to the list. > Contact the moderators at cocoa-dev-admins(at)lists.apple.com > > Help/Unsubscribe/Update your Subscription: > https://lists.apple.com/mailman/options/cocoa-dev/e%40gndgn.dev > > This email sent to e...@gndgn.dev ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Thoughts on Objective-C++
Because they want us devs to stay in their own ecosystem .. which is a pretty right move imo. > Am 12.11.2019 um 21:30 schrieb Richard Charles : > > >> On Nov 12, 2019, at 1:16 PM, GNDGN wrote: >> >> ‘It’s like giving a glass of ice water to somebody in hell’ - Jobs >> > > Apple released iTunes for Windows in October 2003. Apparently Cocoa and any > supporting frameworks were ported to Windows 16 years ago. So what is the > problem providing this to outside developers? > > --Richard Charles > ___________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: NSDatePicker display format
Have you tried adding a NSDateFormatter to the DatePickerCell (in code or in the xib) and setting its format string to what you want? Haven't tried it, but might work... > On Jan 21, 2020, at 5:22 PM, Marco S Hyman via Cocoa-dev > wrote: > > Is there a way to change the date format used by NSDatePicker? > > The dateValue I’m seeing, for example, is "1/20/2020 1:41:42 PM”. At a > minimum I’d like the time displayed in 24 hour mode instead of AM/PM. > Ideally I’d like the date to be “:MM:dd HH:mm:ss” because that is how it > is used elsewhere in the user interface. > > Marc _______ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Sharing code between screensaver and regular app
Hi, You need to create a project with the right template to start with. In XCode: File/New Project - Select MacOS and then “App” (from the New Project Dialog). On XCode 11.0 and MacOS 10.14.6, this results in a new project Setup with a view controller. There are a number of ways to share code between Apps. I usually have a folder structure like this: CommonSource ScreenSaver StandaloneApp Put the code that is common between the two into “CommonSource” and the App Specific Stuff into either “ScreenSaver” or “StandaloneApp”. Then add the common files to both projects and compile as normal. All the Best Dave > On 1 Mar 2020, at 23:26, Gabriel Zachmann via Cocoa-dev > wrote: > > I am trying to replicate what this guy suggests: > > https://medium.com/better-programming/how-to-make-a-custom-screensaver-for-mac-os-x-7e1650c13bd8 > under section "Additional Debugging". > > The idea is to create a standalone app that shares as much code with the > screensaver as possible. > > I am using Xcode 11, macOS Catalina, Objective-C. > > Now, I have created a new project as "App". > But, unlike on the web page, Xcode has not created an NSViewController, but > instead an NSObject: > the .h-file contains > >@interface AppDelegate : NSObject > >@end > > > Could some kind should please shed light on what to do to make my > ScreenSaverView a subview of the new stand-alone app? > > > Best regards, Gabriel > > > ___ > > Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) > > Please do not post admin requests or moderator comments to the list. > Contact the moderators at cocoa-dev-admins(at)lists.apple.com > > Help/Unsubscribe/Update your Subscription: > https://lists.apple.com/mailman/options/cocoa-dev/dave%40looktowindward.com > > This email sent to d...@looktowindward.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Sharing code between screensaver and regular app
Hi, All I can think of that this behaviour has changed on your version of MacOS/XCode. You can do the same thing as the template by manually adding the files, e.g copy your “ViewController” file, rename it and then add it to the new project. You will need to make sure that the Storyboard/Nibs are the same too. Ether add the elements needed yourself or copy the existing storyboard/nib(s) rename and add to the new project. All the Best Dave > On 2 Mar 2020, at 12:36, Gabriel Zachmann wrote: > > Thanks a lot for your response! > >> >> File/New Project - Select MacOS and then “App” (from the New Project Dialog). > > That is what I did: see this screen recording: > > https://owncloud.informatik.uni-bremen.de/index.php/s/br8rN3HGYfj9w3d > <https://owncloud.informatik.uni-bremen.de/index.php/s/br8rN3HGYfj9w3d> > > Still I get this boilerplate code > > > @interface AppDelegate : NSObject > > @end > > > No NSView. > > > > Best regards, Gabriel > ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
RE: Re: Problem in the creation of Graphics context(NSGraphicsContext)
___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Sharing NIB/XIB between different apps?
Hi, If you decide to use multiple targets then it’s still better to have a folder for common files and one for each target, both targets include the Common folder but you only include the folders appropriate for each Target. By “include” I mean you check/uncheck the targets that the file builds against, so Common files are checked for to project and the specific files only for the target they belong to. You can also use a “Workspace”, which is what I tend to do, you then add projects to the work-project (which can have sub-projects), it’s all a bit complicated to be honest, but the docs are pretty good. The best way to find out more, is to find a Sample project that uses a Workspace and go from there. Hope this helps Dave > On 6 Mar 2020, at 16:19, Steve Mills via Cocoa-dev > wrote: > >> On Mar 6, 2020, at 09:04, Gabriel Zachmann via Cocoa-dev >> wrote: >> >> Is it possible to share one NIB/XIB between two different apps? >> If yes, what would be the best approach for development: different Xcode >> projects, or different targets within the same Xcode project? > > Sure. The easiest way is to have both products in the same project, but > different targets, of course. The targets can share anything in the project. > The harder way is to put all the common code and resources into a framework, > then add the framework to each project. I use the first method in my > screensaver and desktop image randomizer to share the UI as a self-contained > view controller. > >> .Dummy question on the side: >> so far, the screensaver framework opens the options sheet for me when the >> user clicks "Screen saver options". >> How would I open it "manually" in my standalone app? > > The same way you load and show any window. You could add a custom view to > your app’s window, then load the shared view controller from its nib and add > it to the custom view. Look for Apple examples/docs for loading nibs, using > view controllers, etc. > > Steve via iPhone > > ___ > > Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) > > Please do not post admin requests or moderator comments to the list. > Contact the moderators at cocoa-dev-admins(at)lists.apple.com > > Help/Unsubscribe/Update your Subscription: > https://lists.apple.com/mailman/options/cocoa-dev/dave%40looktowindward.com > > This email sent to d...@looktowindward.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: applicationDidFinishLaunching not being called
Look at the Application Object in the Workspace/NIB file, is the class AppDelegate? If not it should be! Do you have an AppDelegate in the project/target and is the correct target set for it? BTW, these questions are better posted to the Xcode list. All the Best Dave > On 9 Mar 2020, at 17:55, Gabriel Zachmann via Cocoa-dev > wrote: > > I must have done something very stupid, accidentally, > but the method applicationDidFinishLaunching in my AppDelegate is not being > called any more. > > I have googled and tried a few things, of course, to no avail. > > Does anyone have an idea what it might be? > Maybe, some kind soul can take a quick look at my source code: > https://owncloud.informatik.uni-bremen.de/index.php/s/Yc67zM8ikBZFnRc > which is still pretty bare. > > Thanks a lot in advance. > > Best regards, Gabriel > > ___________ > > Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) > > Please do not post admin requests or moderator comments to the list. > Contact the moderators at cocoa-dev-admins(at)lists.apple.com > > Help/Unsubscribe/Update your Subscription: > https://lists.apple.com/mailman/options/cocoa-dev/dave%40looktowindward.com > > This email sent to d...@looktowindward.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Open a panel in secondary thread?
Don't know if this helps you but you can look into dispatch_sync and dispatch_async. Cheers On Sat, Mar 21, 2020 at 9:16 PM Sandor Szatmari via Cocoa-dev < cocoa-dev@lists.apple.com> wrote: > You must run the panel on the main thread. > > Sandor > > > On Mar 21, 2020, at 3:05 PM, Gabriel Zachmann via Cocoa-dev < > cocoa-dev@lists.apple.com> wrote: > > > > Is it possible to open an NSOpenPanel in a secondary thread? > > > > I create the thread like this: > > > >directoryScanThread_ = [[NSThread alloc] initWithTarget: self > > selector: > @selector(scanDirectory:) > > object: nil]; > >[directoryScanThread_ start]; > > > > > > But when I do: > > > >NSOpenPanel *oPanel = [NSOpenPanel openPanel]; > > > > it crashes at this point. > > > > In the docs, I found a hint that one should use > > > >lockFocusIfCanDraw > > > > but that is deprecated now. > > > > Any ideas will be highly appreciated. > > > > > > Best regards, Gabriel > > > > > > ___ > > > > Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) > > > > Please do not post admin requests or moderator comments to the list. > > Contact the moderators at cocoa-dev-admins(at)lists.apple.com > > > > Help/Unsubscribe/Update your Subscription: > > > https://lists.apple.com/mailman/options/cocoa-dev/admin.szatmari.net%40gmail.com > > > > This email sent to admin.szatmari@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: > https://lists.apple.com/mailman/options/cocoa-dev/bpantazhs%40gmail.com > > This email sent to bpanta...@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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Open a panel in secondary thread?
Hi, You may want to call performSelectorOnMainThread and pass YES as the wait until done flag. Cheer Dave > On 21 Mar 2020, at 20:05, Gabriel Zachmann via Cocoa-dev > wrote: > > Is it possible to open an NSOpenPanel in a secondary thread? > > I create the thread like this: > >directoryScanThread_ = [[NSThread alloc] initWithTarget: self > selector: > @selector(scanDirectory:) > object: nil]; >[directoryScanThread_ start]; > > > But when I do: > >NSOpenPanel *oPanel = [NSOpenPanel openPanel]; > > it crashes at this point. > > In the docs, I found a hint that one should use > >lockFocusIfCanDraw > > but that is deprecated now. > > Any ideas will be highly appreciated. > > > Best regards, Gabriel > > > ___ > > Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) > > Please do not post admin requests or moderator comments to the list. > Contact the moderators at cocoa-dev-admins(at)lists.apple.com > > Help/Unsubscribe/Update your Subscription: > https://lists.apple.com/mailman/options/cocoa-dev/dave%40looktowindward.com > > This email sent to d...@looktowindward.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: [OT] NSTimer +timerWithTimeInterval:
Yes, that’s correct, nothing wrong with a method beginning with new as long as it follows the rules, I use it all the time. I’m not sure if it matters at all with ARC, but I stick by the rules anyway. Cheers Dave > On 30 Apr 2020, at 00:27, Sandor Szatmari via Cocoa-dev > wrote: > > Alex, > >> On Apr 29, 2020, at 17:12, Alex Zavatone via Cocoa-dev >> wrote: >> >> Not sure about this, but in Objective-C, you’re not supposed to start >> methods with new. > > I’ve always operated under the premise that using a reserved prefix, such as > new, was not verboten. Rather, if one chose the prefix new one must ensure > that the method followed memory management conventions, and would return an > object with a +1 retain count. Am I mistaken about this? > > Sandor _______ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com