NSOpenPanel problem

2012-01-22 Thread Jan E. Schotsman
Hello, Suppose I want to display a modeless choose file dialog with the beginWithCompletionHandler method. How can I pass some context info to the handler? The beginForDirectory method has a contextInfo parameter but I want to use the newer method. TIA, Jan E.

Re: NSOpenPanel problem

2012-01-23 Thread Jan E. Schotsman
On Jan 23, 2012, at 5:17 AM, Ken Thomases wrote: On Jan 22, 2012, at 1:24 PM, Jan E. Schotsman wrote: Suppose I want to display a modeless choose file dialog with the beginWithCompletionHandler method. How can I pass some context info to the handler? Blocks capture whatever local

Re: NSOpenPanel problem

2012-01-23 Thread Jan E. Schotsman
On Jan 23, 2012, at 11:37 AM, Conrad Shultz wrote: You *really* need to read the docs on blocks and GCD since they are the modern way of writing threaded code, implementing callbacks, etc. I'd start with the Short Practical Guide to Blocks -

Re: NSOpenPanel problem

2012-01-23 Thread Jan E. Schotsman
On Jan 23, 2012, at 5:08 PM, Ken Thomases wrote: If you're supporting Leopard, then you can't use ARC and the original problem goes away. ??? I have set development target = 10.7 SDK, deployment target = 10.5 and ARC is on. The compiler doesn't complain. I have clicked the validate

Re: NSOpenPanel problem

2012-01-24 Thread Jan E. Schotsman
On Jan 23, 2012, at 11:15 PM, Ken Thomases wrote: I don't know about complaints from the compiler, but I'm certain that ARC can't be used with code deployed to Leopard. ARC requires support from the runtime libraries and that support was never released for Leopard. Thanks for your

ARC and blocks

2012-01-26 Thread Jan E. Schotsman
Hello, This code is given in the Transitioning to ARC Release Notes as an example of accomodating blocks in an ARC environment: __block MyViewController *myController = [[MyViewController alloc] init…]; // ... myController.completionHandler = ^(NSInteger result) { [myController

Subclassing IKImageView

2012-01-29 Thread Jan E. Schotsman
Hello, I want to modify IKImageView so that it erases with the window background color. By default it erases with medium gray which looks awful. I tried implementing -drawRect but this is only called when the window opens. It isn't even called when the image is set to nil. Can one set

Re: Subclassing IKImageView

2012-01-29 Thread Jan E. Schotsman
On Jan 29, 2012, at 6:27 PM, Fritz Anderson wrote: I want to modify IKImageView so that it erases with the window background color. By default it erases with medium gray which looks awful. I'm curious — how does the instance property .backgroundColor not suit your purpose? Me I am

Re: Subclassing IKImageView

2012-01-30 Thread Jan E. Schotsman
On Jan 29, 2012, at 6:27 PM, Fritz Anderson wrote: my next experiment would be to override the NSDraggingDestination methods Indeed, that way I can easily do what I need (limit image drags to files and register dropped files): - (BOOL)performDragOperation:(id NSDraggingInfo)sender

async loading crash

2012-02-08 Thread Jan E. Schotsman
Hello, I am loading a movie and intend to process it when the duration property has loaded. Unfortunately the thread com.apple.coremedia.formatreaderloader.makereadyforinspection crashes in pthread_mutex_unlock after running the processMovie method. Can anybody see what is wrong? This is

Re: text field question

2012-02-23 Thread Jan E. Schotsman
On Feb 23, 2012, at 7:56 AM, Rick C. wrote: I have a panel with a number of text fields where a user should enter numeric values. These text fields are setup with Sent on End Editing so that if the user presses enter or tabs or changes text fields the value will be entered. The problem

Re: Accelerate/vDSP.h question

2012-02-28 Thread Jan E. Schotsman
On Feb 28, 2012, at 6:36 AM, Don Thompson wrote: Have the vDSP functions vDSP_vabs and vDSP_vabsD recently changed? They seem to be no longer working other than to simply return an unchanged version of an input. Here is a simple, Cocoa test routine I used to prove the point:

Accessing array in thread safe way

2012-03-06 Thread Jan E. Schotsman
Hello, I have an array of progress values (number objects) for subprojects, from which I calculate the overall progress . The array is an atomic property of the project class. Is it safe to access this array from multiple threads, using methods like objectAtIndex and replaceObjectAtIndex?

Re: Accessing array in thread safe way

2012-03-08 Thread Jan E. Schotsman
Thanks for all the answers. 1. I'll read the ThreadSafetySummary. So far I had only read the Threading section of the Objective C Programming Language. 2. Accessing the progress values of the subprojects seems the way to go here. 3. Creating a proxy mutable array seems like overkill.

Re: Accessing array in thread safe way

2012-03-08 Thread Jan E. Schotsman
On Mar 8, 2012, at 3:22 PM, CoGe - Tamas Nagy wrote: Maybe this will helps you, here is my thread-safe subclass of NSMutableArray: http://code.google.com/p/cogeopensource/source/browse/trunk/CoGeOpenSource/CoGeThreadSafeMutableArray.m Thanks for the code. I have two questions: 1. If you

Binding and multithreading

2012-03-23 Thread Jan E. Schotsman
Jonathan Taylor wrote: I have been struggling with a problem which I think I have eventually realised is down to me not handling multithreading issues properly. The situation is I have some computationally-demanding code that is running in a separate thread. This has input parameters and

Re: Binding and multithreading

2012-03-24 Thread Jan E. Schotsman
On Mar 24, 2012, at 10:46 AM, Jonathan Taylor wrote: It sounds, though, as if it should be ok to use observeValueForKeyPath:ofObject:change:context (which will run on the secondary thread, by the sound of it) as a way of monitoring the fact that something has changed in the state of my

Re: AVAssetWriterInputPixelBufferAdaptor on IOS attempting to write images to a video

2012-04-13 Thread Jan E. Schotsman
On Apr 13, 2012, at 4:49 PM, Damien Cooke wrote: //write it out [adaptor appendPixelBuffer:pixelBuffer withPresentationTime:CMTimeMake(2, 60)]; It crashes here reporting *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '*** -

goto and ARC

2013-02-02 Thread Jan E. Schotsman
Hello, Today I got an error message about goto and ARC, something about leaving a protected area. Does this mean goto is nearly unusable under ARC? Jan E. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests

Annoying dialog

2013-02-02 Thread Jan E. Schotsman
Hello, I start an NSOpenPanel with beginWithCompletionHandler, then I try to debug the handler. Unfortunately the dialog stays on top of the XCode project window. It isn't a big problem, but would like to get rid of it. I've tried to make the dialog invisible starting the handler with

Init String with bytes

2015-07-31 Thread Jan E. Schotsman
Hello, This has me puzzled: I am trying to initialize a Swift string with an NSData but the analyzer denies my approach. let dataValue:NSData = … let name = String( bytes:dataValue.bytes, length:dataValue.length, encoding:NSUTF8StringEncoding ) Analyzer complains: Cannot find an

Re: Getting resource for key (Swift)

2015-07-21 Thread Jan E. Schotsman
On Jul 21, 2015, at 6:07 PM, Jens Alfke wrote: On Jul 21, 2015, at 1:48 AM, Jan E. Schotsman jesc...@xs4all.nl wrote: So I just needed to replace Bool? by AnyObject? Yes. If you look at the method’s declaration, the parameter type is “id*” in Obj-C, so it’s pretty clear you need to pass

resolving alias

2015-07-22 Thread Jan E. Schotsman
Hello, I am converting a Carbon program. When resolving an alias, it t really necessary to call URLByResolvingSymlinksInPath first or is this just defensive coding? Second problem: if I do this: options = NSURLBookmarkResolutionWithoutUI | NSURLBookmarkResolutionWithoutMounting

CMFormatDescriptionEqual

2015-07-25 Thread Jan E. Schotsman
Can someone please provide an example of how to call CMFormatDescriptionEqual? For example: var fd1:CMFormatDescription var fd2:CMFormatDescription if CMFormatDescriptionEqual( desc1:fd1, desc2:fd2 ) {} Cannot invoke CMFormatDescriptionEqual with an argument list of type (desc1:

Re: CMFormatDescriptionEqual

2015-07-25 Thread Jan E. Schotsman
On Jul 25, 2015, at 9:10 PM, Marco S Hyman wrote: The declaration for CMFormatDescriptionEqual is func CMFormatDescriptionEqual(_ ffd1: CMFormatDescription!, _ ffd2: CMFormatDescription!) - Boolean so I’d think this should work (but untested) if

Re: resolving alias

2015-07-22 Thread Jan E. Schotsman
Solved it myself. I should have searched for BookmarkResolution. In Swift these constants are defined as a RawOptionSetType (sort of class constants) So my code now looks like: var options = NSURLBookmarkResolutionOptions.WithSecurityScope if !runWithInterface

dereference UnsafePointer

2015-07-20 Thread Jan E. Schotsman
Hello list, How can I dereference an UnsafePointerType in Swift? For example let asbd = CMAudioFormatDescriptionGetStreamBasicDescription( formatDescription ) let numSndChannels = asbd-mChannelsPerFrame // this fails to compile, of course Do I need to write an accessor in a .c or .m

Terminate app

2015-07-13 Thread Jan E. Schotsman
Hello, How can I terminate my app from the delegate in Swift? I tried this: NSApplication.terminate(self) // ! Cannot invoke 'terminate' with an argument list of type '(AppDelegate)' I've tried some variants but all of them error. I suppose I could just use nil for the argument but I'd

Re: dereference UnsafePointer

2015-07-20 Thread Jan E. Schotsman
On Jul 20, 2015, at 5:01 PM, Roland King wrote: asbd.memory().mChannelsPerFrame I think should work - untested asbd.memory.mChannelsPerFrame compiles, so that's probably what I was after. Jan E. ___ Cocoa-dev mailing list

Getting resource for key (Swift)

2015-07-20 Thread Jan E. Schotsman
Still making baby steps in Swift. What am I doing wrong this time? var fileObject:NSURL = ... var err:NSError? var value:Bool? var gotValue = fileObject.getResourceValue( value, forKey: NSURLIsAliasFileKey, error: err ); // cannot call getResourceValue with this parameter list

Re: Getting resource for key (Swift)

2015-07-21 Thread Jan E. Schotsman
On Jul 20, 2015, at 9:37 PM, Charles Srstka wrote: This is, in a nutshell, how I do it: let url = ... do { var isAliasAny: AnyObject? = nil try url.getResourceValue(isAliasAny, forKey: NSURLIsAliasFileKey) if let isAlias = isAliasAny as? NSNumber { print(is alias:

Re: AVMetadataItem key

2015-10-07 Thread Jan E. Schotsman
On Oct 5, 2015, at 12:39 AM, Fritz Anderson wrote: On Oct 1, 2015, at 3:59 PM, Jan E. Schotsman <jesc...@xs4all.nl> wrote: I have an AVMetaDataItem with key = protocol<NSCopying, NSObjectProtocol>? Int32(1851878757) as shown by the debugger How can can extract the value 1851

AVMetadataItem key

2015-10-01 Thread Jan E. Schotsman
Sorry for this stupid question but I just don't know how to do this. I have an AVMetaDataItem with key = protocol? Int32(1851878757) as shown by the debugger How can can extract the value 1851878757 which is the four char code I need? Using Swift 2 TIA, Jan E

Re: Protocol extensions returning self

2016-02-05 Thread Jan E. Schotsman
On Feb 4, 2016, at 4:56 PM, Charles Jenkins wrote: Supposedly in a protocol, “Self” is the class implementing the protocol. So it seems to me that extension methods should be able to have a return type of Self so they can return self, and thus have the extension method behave the same as

Remote files

2016-02-21 Thread Jan E. Schotsman
Hello, I would like to implement something similar to AVAssetReferenceRestrictions. One case is AVAssetReferenceRestrictionForbidCrossSiteReference where references of a remote file to a remote file are not allowed. This means that the referencing file and the referenced file are remote

Re: NSFileHandle and thread safety

2016-07-27 Thread Jan E. Schotsman
On Jul 25, 2016, at 9:37 PM, Daniel Stenmark wrote: 1. Can I write to two different files using two NSFIleHandles from two threads at the same time? Yes. 2. Can I read from a single file using two NSFileHandles on two threads at the same time? Why would you need to do that in the first