Re: Mac App Store requirements
Thanks for all the suggestions, guys! Artemiy. On 11 Apr 2011, at 03:55, Laurent Daudelin wrote: On Apr 10, 2011, at 16:45, Todd Heberlein wrote: On Apr 10, 2011, at 4:32 PM, davel...@mac.com wrote: And you also have add code to verify a valid receipt. There's a few samples of how to do this on github (you should modify them to make the app more difficult to crack unless you're giving the app away for free). Apple has more about this that you can read once you join the developer program. Validating the receipt is optional. Having recently gone through this with my first application, I generally would not recommend it for version 1.0 of someone's first app (unless it is a very expensive app). It is surprisingly complex and poorly documented, and there are too many other things to worry about when getting your first app through the approval process. If you want copy protection (which is what receipt validation in about), I would leave it until the first update to your application or the second app you submit. Don't forget that verifying the receipt doesn't get you much. A user can still install an unlimited number of copies on any Macs he wants. He just has to enter his iTunes Apple ID and password, that's it. I didn't think it was worth the effort for my first app. -Laurent. -- Laurent Daudelin AIM/iChat/Skype:LaurentDaudelin http://www.nemesys-soft.com/ Logiciels Nemesys Software laur...@nemesys-soft.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/artemiy.pavlov%40ukrpost.ua This email sent to artemiy.pav...@ukrpost.ua ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/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 Increment CALayer Retain Count?
I know its not very popular, but I've disciplined myself to set all variables (including stack) to their low or unused state when finished with them. It helps locate reuse problems in Debug builds (and I really don't care a bit about the 3 cycles). The optimizer can remove it later if it desires. Sure, setting the variable to nil in dealloc is good practice, just either do it with [foo release]; foo = nil; How is it good practice? The only thing that this can get you is masking a bug. Don't do it. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: How To Increment CALayer Retain Count?
On Mon, Apr 11, 2011 at 5:03 AM, steven Hooley steven.hoo...@gmail.com wrote: I know its not very popular, but I've disciplined myself to set all variables (including stack) to their low or unused state when finished with them. It helps locate reuse problems in Debug builds (and I really don't care a bit about the 3 cycles). The optimizer can remove it later if it desires. Sure, setting the variable to nil in dealloc is good practice, just either do it with [foo release]; foo = nil; How is it good practice? The only thing that this can get you is masking a bug. Don't do it. I believe it is a good idea in general, other folks do not. There's a small cottage industry based on pointer reuse: http://www.google.com/#sclient=psyhl=ensite=source=hpq=adobe+site:securityfocus.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Determine Error from Webview loadRequest
Hi All, How does one determine if loadRequest: has failed? I'm pretty sure the webview could not handle the document passed to it (the view is black), but I don't know how to test for the failure. The documentation for loadRequest [1] does not mention error conditions or testing. Jeff [1] http://developer.apple.com/library/mac/#documentation/Cocoa/Reference/WebKit/Classes/WebFrame_Class/Reference/Reference.html#//apple_ref/occ/instm/WebFrame/loadRequest: ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
bitmapData leak
I am battling a leak in my code and can't work out what I am doing wrong. I have a loop which accesses the raw bitmap data from a series of TIFF files I load from disk. My calls to [bitmapRep bitmapData] seem to (understandably) allocate memory, but I cannot work out how to allow that memory to be released again. What am I missing? I've found various threads including this one: http://stackoverflow.com/questions/4170799/objc-leak-behavior-i-cant-explain that suggest autorelease pools should solve the problem. However the following code still leaks memory: // Utility function used in main code: NSBitmapImageRep *RawBitmapFromImage(NSImage *image) { NSBitmapImageRep*result = nil; NSArray *repArray = [image representations]; for (size_t imgRepresentationIndex = 0; imgRepresentationIndex repArray.count; ++imgRepresentationIndex) { NSObject *imageRepresentation = [repArray objectAtIndex:imgRepresentationIndex]; if ([imageRepresentation isKindOfClass:[NSBitmapImageRep class]]) { ALWAYS_ASSERT(result == nil); // If we fail this then there are two different bitmap representations stored // (need to decide what to do then...) result = (NSBitmapImageRep*)imageRepresentation; } } ALWAYS_ASSERT(result != nil); // If we fail this then there was no bitmap representation stored (vector image?) return [[result retain] autorelease]; } // Main code: for (int i = firstIndex; i = lastIndex; i++) { printf(add frame from file \%s\\n, NSStringForFrameNumber(i).cString); NSImage *frameImage = [[NSImage alloc] initWithContentsOfFile:NSStringForFrameNumber(i)]; // Temp code to debug serious memory leak NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; NSBitmapImageRep *bitmapRep = RawBitmapFromImage(frameImage); /* If I comment out the following line then there are no major leaks. With this line in place, bitmapData is leaked, in that ObjectAlloc shows a whole load of allocations from within the call to bitmapData that build up until all memory is full. */ unsigned char * bitMapDataPtr = [bitmapRep bitmapData]; [pool drain]; [frameImage release]; // I have tried swapping these two calls around, to no effect (unsurprisingly)... } Please can somebody suggest what I am missing here? I am tearing my hair out over this one. I can post a full compilable demo if necessary. Many thanks for any pointers on this one Jonny___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/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: Determine Error from Webview loadRequest
On Mon, Apr 11, 2011 at 7:33 AM, Jeffrey Walton noloa...@gmail.com wrote: Hi All, How does one determine if loadRequest: has failed? I'm pretty sure the webview could not handle the document passed to it (the view is black), but I don't know how to test for the failure. The documentation for loadRequest [1] does not mention error conditions or testing. I should have mentioned. I working with local files per Using UIWebView to display select document types, http://developer.apple.com/library/ios/#qa/qa1630/_index.html. Jeff ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/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: OCMock in Xcode 4
I believe that typically means that a compatible library can not be found; are you sure your framework is built for the target you are trying to use it with? On Sun, Apr 10, 2011 at 1:00 PM, qvacua qva...@gmail.com wrote: Hi, I'm trying to to get OCMock to work with Xcode 4. I created a new blank project with unit tests enabled. I added OCMock.framework file to the test target. What I get is that the framework cannot be loaded because the image is not found. I tried with a copy phase to copy the framework to the test target, but it did not help. The framework search path is automatically adapted when I add the framework to the target. What's wrong? How can I use OCMock with Xcode 4? Thanks in advance. Best. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/treaves%40silverfieldstech.com This email sent to trea...@silverfieldstech.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Mac App Store requirements
Is it required that my application has Drag'n'Drop support? 11-Apr-11 02:54, Tom Hohensee пишет: Yes I second what Todd has said. I am currently working on receipt validation for my third app store app. I did not do it for my first two apps, too many other thinks to worry about. The documentation is not very good at this point. Tom On Apr 10, 2011, at 6:45 PM, Todd Heberlein wrote: On Apr 10, 2011, at 4:32 PM, davel...@mac.com wrote: And you also have add code to verify a valid receipt. There's a few samples of how to do this on github (you should modify them to make the app more difficult to crack unless you're giving the app away for free). Apple has more about this that you can read once you join the developer program. Validating the receipt is optional. Having recently gone through this with my first application, I generally would not recommend it for version 1.0 of someone's first app (unless it is a very expensive app). It is surprisingly complex and poorly documented, and there are too many other things to worry about when getting your first app through the approval process. If you want copy protection (which is what receipt validation in about), I would leave it until the first update to your application or the second app you submit. Todd ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/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: Mac App Store requirements
On 11/04/2011, at 10:17 PM, Vyacheslav Karamov wrote: Is it required that my application has Drag'n'Drop support? No. Why don't you just download the requirements document? The requirements relate mainly to making sure your app plays nice, and have little to say about what functionality it has to have or omit. If you want to sell through the App Store, you have to sign up for the $99/year developer account, so even if you can't get the doc until you do that, you still have to do that... --Graham ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Determine Error from Webview loadRequest
On Apr 11, 2011, at 8:04 AM, Jeffrey Walton wrote: I should have mentioned. I working with local files per Using UIWebView to display select document types, http://developer.apple.com/library/ios/#qa/qa1630/_index.html. if you set your view controller to respond to UIWebViewDelegate methods, wouldn't a failure hit the [UIWebViewDelegate webView: (UIWebView *) didFailLoadWithError: (NSError *) error] 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 arch...@mail-archive.com
Re: NSManagedObjected isInserted
On 10 Apr 2011, at 19:52, Carter R. Harrison wrote: On Apr 10, 2011, at 1:29 PM, Quincey Morris wrote: On Apr 10, 2011, at 06:52, Carter R. Harrison wrote: Can anybody ever think of a scenario where [NSManagedObject isInserted] equals NO for an object that is initially fetched from the context? And no the object has not been deleted from the context prior to calling isInserted. What do you mean by initially fetched? The object should return YES for isInserted from the time it's inserted to the time the store is committed/saved. It's not clear where in this timeline your initially is pointing. I'm creating and NSManagedObject with [NSManagedObject initWithEntity:insertIntoManagedObjectContext:] and for the context I'm passing nil. Later I call [NSManagedObjectContext insertObject:] and pass in the same NSManagedObject that was initialized earlier. On a subsequent run of my application I fetch the object from the store and call [NSManagedObject isInserted]. Without fail it always returns NO. Think of it as being equivalent to: - (BOOL)isInserted; { return [[[self managedObjectContext] insertedObjects] containsObject:self]; } Thus, objects only return YES when inserted into a context and not yet persisted.___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/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: Mac App Store requirements
I have $99 account, so I'll try to find the doc. 11-Apr-11 15:24, Graham Cox пишет: On 11/04/2011, at 10:17 PM, Vyacheslav Karamov wrote: Is it required that my application has Drag'n'Drop support? No. Why don't you just download the requirements document? The requirements relate mainly to making sure your app plays nice, and have little to say about what functionality it has to have or omit. If you want to sell through the App Store, you have to sign up for the $99/year developer account, so even if you can't get the doc until you do that, you still have to do that... --Graham ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: bitmapData leak
OK, after much wailing and gnashing of teeth I have worked out my mistake. Where I wrote the following: NSImage *frameImage = [[NSImage alloc] initWithContentsOfFile:NSStringForFrameNumber(i)]; // Temp code to debug serious memory leak NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; NSBitmapImageRep *bitmapRep = RawBitmapFromImage(frameImage); /* If I comment out the following line then there are no major leaks. With this line in place, bitmapData is leaked, in that ObjectAlloc shows a whole load of allocations from within the call to bitmapData that build up until all memory is full. */ unsigned char * bitMapDataPtr = [bitmapRep bitmapData]; [pool drain]; [frameImage release]; // I have tried swapping these two calls around, to no effect (unsurprisingly)... what was happening was that *** frameImage *** was not being autoreleased until the full loop was over (obviously). Although the actual pixel data allocation was occuring within the scope of my autorelease pool, that buffer was not being freed up until the image object itself was autoreleased. I guess that makes sense, though I'm finding this sort of autorelease consideration rather hard to get to grips with... Jonny ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/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: Storing a block in a CF/NSMutableDictionary?
On 10 Apr 2011, at 11:39 AM, Ken Thomases wrote: I am grateful you called this to my attention, as I had been thinking that blocks were closures, in which referencing (but not, usefully, changing) stack-local variables would work. Blocks are closures and referencing stack-local variables does work. For non-__block variables, the block has a const copy of the value, just as though it were passed by value into a function. I'd been thrown by the existence of the __block attribute, which permits referencing a stack-local variable as an lvalue. I had reasoned that if a __block variable _is_ obviously a reference to that memory, a non-__block variable (whose value does _not_ propagate to the stack variable when a block changes it) obviously _couldn't_ be a reference. You had been correct. Kyle just confused you. Your response is very clear, and my mind is at ease. Thank you. — F ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: blocks and NSInvocation question
On Apr 10, 2011, at 11:53 PM, John Michael Zorko wrote: I'm stumped as to why this generates a warning when I compile. Do I need to do something special with my AVURLAsset * to be able to access it from inside the block in order to add it to an NSInvocation? AVURLAsset *asset = [AVURLAsset URLAssetWithURL:streamURL options:nil]; [asset loadValuesAsynchronouslyForKeys:[NSArray arrayWithObject:tracks] completionHandler:^ { NSInvocation *inv = [NSInvocation invocationWithMethodSignature:sig]; [inv setArgument:asset atIndex:2]; // warning: passing argument 1 of 'setArgument:atIndex:' discards qualifiers from pointer target type Since asset is a non-__block variable declared outside the block but referenced within it, the block holds a const copy of it. In other words, inside the block, asset is of type AVURLAsset * const -- a const pointer to an AVURLAsset. This is fine and right. Taking the address of asset yields an expression of type AVURLAsset * const *. However, -[NSInvocation setArgument:atIndex:] takes a non-const void* for its buffer parameter. The compiler is telling you that you're passing a pointer-to-const in a pointer-to-non-const parameter. In theory, NSInvocation could write through that pointer, thus modifying something through a pointer that's not supposed to allow that. In this case, the warning is not flagging a real problem. NSInvocation will not write through that pointer. I believe that -setArgument:atIndex: should have been declared to take a const void * buffer. You can silence the warning by explicitly casting to (void*), like so: [inv setArgument:(void*)asset atIndex:2]; All of that said, since you're already using blocks, you'd almost certainly be better off using another block, dispatched to the main queue, rather than using NSInvocation or -performSelectorOnMainThread:... [asset loadValuesAsynchronouslyForKeys:[NSArray arrayWithObject:tracks] completionHandler:^{ // Use dispatch_sync if that's really necessary dispatch_async(dispatch_get_main_queue(), ^{ [self setupPlayerForAsset:asset withIndex:index]; // Wrap index in NSNumber if really necessary }); }]; I wasn't sure if the waitUntilDone:YES was strictly necessary. It seems that asynchrony is implicit in the use of -loadValuesAsynchronouslyForKeys:..., so I didn't bother translating waitUntilDone:YES into a use of dispatch_sync(). Also, I suspect that wrapping the index in an NSNumber was intended to facilitate the indirect invocation of -setupPlayerForAsset:withIndex: and isn't strictly necessary or desired, either. Regards, Ken ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: AVFoundation and OpenGL?
On Apr 10, 2011, at 12:18 PM, John Michael Zorko wrote: I've been playing with Core Animation and AVFoundation to get some interesting results. I've a question, though, with regards to AVFoundation and OpenGL: Can I make OpenGL work with AVPlayerLayer? That depends on what you mean by making OpenGL work with AVPlayerLayer. What are you trying to do?™ -- David Duncan ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Core Data relationship fault
Can someone point me to an example or tutorial that shows how to get the value of a to-many relationship attribute of a Core Data entity? My application is simple and comparable to the Departments and Employees example in Apple's documents. When I select a department object I have no trouble accessing any of its other properties, but when I try to get its employees I get only a relationship fault. I have tried everything that I could find in the documentation and other people's comments (Google search) without success. I have subclassed the array controllers for departments and employees. In the departments array controller I am trying to calculate a transient property based on the properties of the employees when the method -(id)tableView:(NSTableView *)aTableView objectValueForTableColumn: (NSTableColumn *)aTableColumn row:(NSInteger)rowIndex is called by the departments TableView. Thanks. Lynn. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/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: NSManagedObjected isInserted
On 2011 Apr 11, at 06:00, Mike Abdullah wrote: Think of it as being equivalent to: - (BOOL)isInserted; { return [[[self managedObjectContext] insertedObjects] containsObject:self]; } Oh! Thank you for clarifying that, Mike. I just sent Apple some Document Feedback on -isInserted. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Core Data relationship fault
On 2011 Apr 11, at 09:54, Lynn Barton wrote: Can someone point me to an example or tutorial that shows how to get the value of a to-many relationship attribute of a Core Data entity? My application is simple and comparable to the Departments and Employees example in Apple's documents. You just answered you own question ;) When I select a department object I have no trouble accessing any of its other properties, but when I try to get its employees I get only a relationship fault. I am trying to calculate a transient property I'd bet that's the problem. In my experience, transient properties are all pain (lotsa gotchas) with no (performance) gain. Consider either making it a regular property, or, probably better for your case since a table view can only show several tens of rows at a time, calculating it as a derived attribute. For the latter, remember your friend +keyPathsForValuesAffectingFoo. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
NSPopUpButton, notification when selecting value/object
Hi all, I found in the reference that a notification is sent when a popup button is clicked, NSPopUpButtonWillPopUpNotification. That's good, but how about when I've selected an object or value in the popup list and released the mouse button? How can I make my application aware of that? Regards /Mikael ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Core Data relationship fault
On Apr 11, 2011, at 11:48, Jerry Krinock wrote: On 2011 Apr 11, at 09:54, Lynn Barton wrote: When I select a department object I have no trouble accessing any of its other properties, but when I try to get its employees I get only a relationship fault. I am trying to calculate a transient property I'd bet that's the problem. In my experience, transient properties are all pain (lotsa gotchas) with no (performance) gain. Consider either making it a regular property, or, probably better for your case since a table view can only show several tens of rows at a time, calculating it as a derived attribute. For the latter, remember your friend +keyPathsForValuesAffectingFoo. Darn it, I was trying to stay out of this thread because I don't know the answer, but you made me jump in ... I feel for your pain, but I think there's a baby/bathwater issue with generalizing your experience. For things that really are transient, transient properties are very harmless, and don't need to be avoided. The differing points of view come from Core Data's dual personality. In its role as an object graph manager, the developer tends to be focused on in-memory relationships, and transient properties are useful. In its role as an (cough!) almost-DBMS (cough!), the developer tends to be focused on fetches, and that's where you run into the gotchas. Regarding the OP's question, my guess is that it's a memory management problem, and the object properties are faulted out because the objects themselves have been deleted from the MOC and/or deallocated. I have no evidence for that opinion. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/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: NSPopUpButton, notification when selecting value/object
On Apr 11, 2011, at 11:57, Mikael Wämundson wrote: I found in the reference that a notification is sent when a popup button is clicked, NSPopUpButtonWillPopUpNotification. That's good, but how about when I've selected an object or value in the popup list and released the mouse button? How can I make my application aware of that? Via the action method or the value binding. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
PDF Inverted colors
Hi,I am opening pdf's using NSPDFImageRep and converting it to a NSBitmapImageRep, writing it out as a tiff. In all most all cases, the file looks perfect, but once in awhile, I get a pdf that all the images in the PDF seem to invert. If I open that PDF in Preview.app it looks the same, all jpeg images are inverted (looks like a film negative). Anybody have a idea on what is causing this and how to work around it? Thanks Dean ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/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: Can an image be rejected by CALayer?
Show all the code by which the layer is configured and put into the interface if you want a more educated response. m. I'll try, it's a bit scattered throughout my program. (I was a bit hesitant to flood my original post with potentially unwanted code ...) Here goes: CGImageRef imageRef = CGImageSourceCreateImageAtIndex( sourceRef, 0, NULL ); CALayer * newlayer; NSSize startsize = drawRect_.size; startsize.width *= MinimalImageSizeDisplayed; startsize.height *= MinimalImageSizeDisplayed; NSSize endsize = startsize; endsize.width *= 1.5; endsize.height *= 1.5; newlayer = [self makeImageLayer: imageRef fromSize: startsize toSize: endsize withOrientation: img_orientation]; // swap the old and the new layer [CATransaction begin]; // causes cross-dissolve animation [CATransaction setValue: [NSNumber numberWithFloat: fading_duration] forKey: kCATransactionAnimationDuration ]; [mainLayer_ replaceSublayer: currentLayer_ with: newlayer]; currentLayer_ = newlayer; [CATransaction commit]; - (CALayer *) makeImageLayer: (CGImageRef) img fromSize: (NSSize) startsize toSize: (NSSize) endsize withOrientation: (int) orientation { CALayer * imgLayer = [self makeImageLayer: img withOrientation: orientation]; // create animation for growing/shrinking CABasicAnimation * anim = [CABasicAnimation animationWithKeyPath: @bounds.size]; anim.timingFunction = [CAMediaTimingFunction functionWithName: kCAMediaTimingFunctionEaseOut]; anim.duration = durationPerCycle_; anim.autoreverses = YES; anim.repeatCount= 1e100;// = forever if ( orientation 1 || orientation 8 ) orientation = 1; if ( orientation = 4 ) { anim.fromValue = [NSValue valueWithSize: startsize]; anim.toValue= [NSValue valueWithSize: endsize]; } else { // swap width height, because the image's orientation is a transposition or rotation anim.fromValue = [NSValue valueWithSize: NSMakeSize(startsize.height, startsize.width) ]; anim.toValue= [NSValue valueWithSize: NSMakeSize(endsize.height, endsize.width) ]; } [imgLayer addAnimation: anim forKey: nil]; return imgLayer; } As I said, some images just won't get displayed under 10.5, but the same images work fine under 10.6. Best regards, Gabriel. smime.p7s Description: S/MIME cryptographic signature ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Can an image be rejected by CALayer?
On Apr 11, 2011, at 12:40 PM, Gabriel Zachmann wrote: As I said, some images just won't get displayed under 10.5, but the same images work fine under 10.6. Assuming this is the entirety of the code, then as mentioned previously you never set the bounds or frame of your layer. Try setting the bounds of the layer to either the start or end value of the animation you add (probably doesn't matter which) and see if that changes the behavior. It is possible that between 10.5 and 10.6 Core Animation's behavior changed with respect to layers of zero size (which your model layer still is). If setting the bounds fixes that, then that is the likely cause. -- David Duncan ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/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: NSPopUpButton, notification when selecting value/object
Hi Mikael, My best guess would the action of that button in your application. This method is called when you 'click' on the NSButton, ie after the mouse up event. Are you looking specifically for a notification? Many thanks, Oli./. -- Molowa On Apr 11, 2011, at 8:57 PM, Mikael Wämundson wrote: Hi all, I found in the reference that a notification is sent when a popup button is clicked, NSPopUpButtonWillPopUpNotification. That's good, but how about when I've selected an object or value in the popup list and released the mouse button? How can I make my application aware of that? Regards /Mikael ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/olivier%40sunprotectingfactory.com This email sent to oliv...@sunprotectingfactory.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: PDF Inverted colors
On Apr 11, 2011, at 12:15 PM, Dean Krueger wrote: Hi,I am opening pdf's using NSPDFImageRep and converting it to a NSBitmapImageRep, writing it out as a tiff. In all most all cases, the file looks perfect, but once in awhile, I get a pdf that all the images in the PDF seem to invert. If I open that PDF in Preview.app it looks the same, all jpeg images are inverted (looks like a film negative). Anybody have a idea on what is causing this and how to work around it? Thanks Dean Are these JPEG's perhaps CMYK? Either way you should file a bug report. -- David Duncan ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/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: AVFoundation and OpenGL?
On Apr 11, 2011, at 11:44 AM, John Michael Zorko wrote: I'm currently using Core Animation to show a 3D rotatable cube with videos (or other content) on each side, so each side of the cube is an AVPlayerLayer. What i've read so far seems to say that a special subclass of CALayer (CAEGLayer) is required for OpenGL to interface with it i.e. if I wanted to use OpenGL to make a 3D rotating sphere of many AVPlayerLayers (or as many as an iPad 2 can handle, anyway), is this possible since AVPlayerLayer doesn't derive from CAEGLayer? CAEAGLLayers are required to render OpenGL content to a CALayer yes. In order to render to a sphere, you would likely require the ability to render movie frames to a texture, then apply that texture to your sphere. I don't recall if AVFoundation provides support for getting texture data (I think it does, but I haven't used it well enough to know for certain) Basically a CAEAGLLayer is a cross-over point from Core Animation to OpenGL. Other Core Animation content doesn't interact with the content of a CAEAGLLayer anymore than the content of any single CALayer interacts with the content of any other. -- David Duncan ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Not sure about autorelease pools in NSOperations
Hi all. I haven't really managed autorelease pools explicitly before, but the NSOperation doc says to use one in your NSOperation derivatives. My question is where to put it. The example shows the pool being created and released in the main() function, but I don't really allocate anything there. All of that is done in my init function, which sets up a bunch of data objects that the operation will use when it executes. Since the data objects are created in one function and then used in another, what's the proper way to use an autorelease pool here? Thanks for any insight. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
SimpleTextInput sample code - caretRect not calculated correctly at times
Hi, I'm trying to follow the SimpleTextInput example project at http://developer.apple.com/library/ios/#samplecode/SimpleTextInput/Introduction/Intro.html For the most part, it works fine, but, for some reason the following results in a wierd result drawing the caretRect. 1. Type in a few lines (about 7-8 lines in the Simulator (about 10 characters each line followed by a newline) 2. Click on some random point in the text in the last couple of lines. The caretRect is updated properly to the new location. 3. Click on some random point in the first or second line. The caret rect isn't drawn correctly and is way larger than usual - If there is a place I can post a screen shot that is acceptable to the thread, please let me know and I'd be happy to paste it :-) In an effort at debugging this, it looks like the ascent and descent values in caretRectForIndex function changes mid-call. I added a couple of NSLog statements to the relevant section ( I apologize for the lengthy code post here). The function is identical to Apple's except for the added NSLog statements. - (CGRect)caretRectForIndex:(int)index { NSArray *lines = (NSArray *) CTFrameGetLines(_frame); // Special case, no text if (_text.length == 0) { CGPoint origin = CGPointMake(CGRectGetMinX(self.bounds), CGRectGetMaxY(self.bounds) - self.font.leading); // Note: using fabs() for typically negative descender from fonts return CGRectMake(origin.x, origin.y - fabs(self.font.descender), 3, self.font.ascender + fabs(self.font.descender)); } // Special case, insertion point at final position in text after newline if (index == _text.length [_text characterAtIndex:(index - 1)] == '\n') { CTLineRef line = (CTLineRef) [lines lastObject]; CFRange range = CTLineGetStringRange(line); CGFloat xPos = CTLineGetOffsetForStringIndex(line, range.location, NULL); CGPoint origin; CGFloat ascent, descent; CTLineGetTypographicBounds(line, ascent, descent, NULL); NSLog(@Ascent, Descent: %f, %f, ascent, descent); CTFrameGetLineOrigins(_frame, CFRangeMake(lines.count - 1, 0), origin); // Place point after last line, including any font leading spacing if applicable origin.y -= self.font.leading; NSLog(@Ascent, Descent: %f, %f, ascent, descent); return CGRectMake(xPos, origin.y - descent, 3, ascent + descent); } // Regular case, caret somewhere within our text content range for (int i = 0; i [lines count]; i++) { CTLineRef line = (CTLineRef) [lines objectAtIndex:i]; CFRange range = CTLineGetStringRange(line); NSInteger localIndex = index - range.location; if (localIndex = 0 localIndex = range.length) { // index is in the range for this line CGFloat xPos = CTLineGetOffsetForStringIndex(line, index, NULL); CGPoint origin; CGFloat ascent, descent; CTLineGetTypographicBounds(line, ascent, descent, NULL); NSLog(@Ascent, Descent: %f, %f, ascent, descent); CTFrameGetLineOrigins(_frame, CFRangeMake(i, 0), origin); NSLog(@Ascent, Descent: %f, %f, ascent, descent); // Make a small caret rect at the index position return CGRectMake(xPos, origin.y - descent, 3, ascent + descent); } } return CGRectNull; } The output from the above method when I click on the first couple of lines is something like 2011-04-11 23:09:02.670 SimpleTextInput[33460:207] Ascent, Descent: 13.860352, 4.139648 2011-04-11 23:09:02.670 SimpleTextInput[33460:207] Ascent, Descent: 237.339645, 0.00 The call to CTLineGetTypographicBounds seems to be working fine as evidenced by the low expected values of ascent and descent. But, for some reason, after CTFrameGetLineOrigins it is changing. I'm at a loss as to why these values are changing as there doesn't seem to be anything in the code modifying ascent and descent between the two NSLog statements. I've tried synchronizing the caretRect method body on self (but, it doesn't look like there are other threads that are modifying these values either). Any pointers on why ascent and descent is changing would be much appreciated :) Thanks George ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/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: Not sure about autorelease pools in NSOperations
On 11 Apr 2011, at 7:38 PM, G S wrote: I haven't really managed autorelease pools explicitly before, but the NSOperation doc says to use one in your NSOperation derivatives. My question is where to put it. The example shows the pool being created and released in the main() function, but I don't really allocate anything there. All of that is done in my init function, which sets up a bunch of data objects that the operation will use when it executes. Since the data objects are created in one function and then used in another, what's the proper way to use an autorelease pool here? If you need it, put it in your -main method, as in the documentation's example. If there are really no autorelease calls happening in your operation's -main method (even in code that might be called by code that you call, etc) then you don't need to set up an autorelease pool. If you're just running straightforward C or CoreFoundation code or the like, then you don't need to have a pool, because that code will never call -autorelease (or, on occasion, it will take care of setting up its own pool). If you're calling Foundation, AppKit, etc. methods, which often rely on the autorelease functionality, then you'd better have an autorelease pool in place. (The documentation seems to be making a digression from NSOperations into evangelizing autorelease pools and various unrelated other bits of good coding practice.) The -init method of your NSOperation is presumably being called from somewhere that has an autorelease pool set up already --- almost all the places where AppKit or UIKit might invoke your code (responses to events, application delegate calls, etc) have a pool set up for you so you don't need to explicitly deal with it there. The general flow of events might be something like this: Application is running Gets an event or something Creates an autorelease pool #1 Calls your code You create an instance of your NSOperation subclass, calling -init Your init method autoreleases stuff; it goes to pool #1 You enqueue your NSOperation somewhere Return from your code Pool #1 is released, and the objects you autoreleased in your -init method get their retain-counts decremented appropriately Application is done with that event, starts waiting for the next one On another thread, the NSOperation queue decides to start your operation (Due to the nature of threading, this might happen even before your code, above, is finished. Or it might happen some time later.) Your -main method is called Notice there's no autorelease pool here unless you set one up! Autorelease pools are per-thread. Your -main method finishes ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Core Data relationship fault
Thanks, that helps. I need to study the Core Data Programming Guide again, and this time pay more attention to the FAQs. Lynn On 2011 Apr 11, at 09:54, Lynn Barton wrote: Can someone point me to an example or tutorial that shows how to get the value of a to-many relationship attribute of a Core Data entity? My application is simple and comparable to the Departments and Employees example in Apple's documents. You just answered you own question ;) When I select a department object I have no trouble accessing any of its other properties, but when I try to get its employees I get only a relationship fault. I am trying to calculate a transient property I'd bet that's the problem. In my experience, transient properties are all pain (lotsa gotchas) with no (performance) gain. Consider either making it a regular property, or, probably better for your case since a table view can only show several tens of rows at a time, calculating it as a derived attribute. For the latter, remember your friend +keyPathsForValuesAffectingFoo. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com