Re: Detecting Managed Object Property Change From Undo Redo
On Jan 25, 2015, at 4:16 PM, Jerry Krinock je...@ieee.org wrote: The reason I had to run that test is because I don’t use KVO for observing managed object properties. Instead, I use NSNotificationCenter, which has these advantages… Where do you post the notification from for a managed object property change? It doesn’t work in a managed object's custom public property accessor because the public property accessor is not called during undo redo. Only the primitive set accessor is called. Great video by the way. Looks like an interesting application. 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: Detecting Managed Object Property Change From Undo Redo
On 26 Jan 2015, at 15:00, Richard Charles rcharles...@gmail.com wrote: On Jan 25, 2015, at 4:16 PM, Jerry Krinock je...@ieee.org wrote: The reason I had to run that test is because I don’t use KVO for observing managed object properties. Instead, I use NSNotificationCenter, which has these advantages… Where do you post the notification from for a managed object property change? It doesn’t work in a managed object's custom public property accessor because the public property accessor is not called during undo redo. Only the primitive set accessor is called. I expect he’s observing NSManagedObjectContextObjectsDidChangeNotification. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post 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: What's the right way to use UIActivityIndicatorView? After it's stopped
You can stack views and controls however you like. I do it all the time. You need to pay attention to the list of views, not just the visuals in iB. Just use an outlet or binding to hide the ones you don¹t want showing. Set the activity indicator to hide when not active. When you stop animation, unhide the other control. On 1/25/15 3:00 PM, cocoa-dev-requ...@lists.apple.com cocoa-dev-requ...@lists.apple.com wrote: I'm trying to show another UI Control when the stopAnimation method is called. But in xcode if I drag the UIActivityIndicatorView first, any other UI Control seems to be replacing it. Now it looked like I had to do create the other UI Control and add it manually when the animation is stopped. That is wrong right? What's the 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Any way to force a window under the menu bar?
On 2015/01/26, at 14:54, Eric Schlegel eri...@apple.com wrote: Even if you force it under the menubar, you won’t see its content show up in the menubar; the menubar window pulls its blurred content exclusively from the desktop image. -eric But you could then create some excessive code to create and set temp desktop images including a slice of the window in just the right place... Totally not worth it, but interesting exercise. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post 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: Detecting Managed Object Property Change From Undo Redo
On 2015 Jan 26, at 07:00, Richard Charles rcharles...@gmail.com wrote: Where do you post the notification from for a managed object property change? Just to clarify: Your question refers to how I do it in my real apps, using NSNotificationCenter, not how I did it in the YouTube video, which was demonstating KVO. Commonly, I use a custom setter, like this: - (void)setRating:(NSNumber*)newValue { [self postWillSetNewValue:newValue forKey:constKeyRating] ; [self willChangeValueForKey:constKeyRating] ; [self setPrimitiveRating:newValue] ; [self didChangeValueForKey:constKeyRating] ; } wherein the -postWillSetNewValue:forKey: posts notifications. It doesn’t work in a managed object's custom public property accessor because the public property accessor is not called during undo redo. Ah, I’d forgotten about that. Indeed, the undo and redo tasks registered by Core Data do not try and put things back in order using public accessors the way I would (screw it up). Instead, Core Data registers these annoyingly opaque undo and redo tasks that, I presume, just change the whole object graph to a previous (consistent) state in one fell swoop. I think that’s why Core Data does undo and redo so reliably. But real apps often need to observe all object changes, and so the resulting un-observability transfers the complexity elsewhere. [1] The way I’ve worked around that is to, as Mike Abdullah said, register for NSObjectsChangedInManagingContextNotification. I do it in a kind of “entity manager” class that also does some fetching, etc. But read the NSObjectsChangedInManagingContextNotification documentation and understand the edge cases in which this notification does not get sent. Other patches may be necessary. So, going back to my YouTube video, I think you should take another look at using KVO. The fact that it just works” with undo and redo is nice, and with tricks like Kyle Sluder’s crafty -startObserving… and -stopObserving… methods, the bookkeeping may be tractable. 1. Google: “there are no solutions only tradeoffs” ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post 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: licence key validation method
At 06:41 PST on 2015-01-12, Dave Fernande wrote: If you use AquaticPrime, unfortunately, it does not generate standard signatures. It manually hashes and then encrypts using the private key. This sounds like a normal signature, but it is missing some information stored in standard PKCS #1 v2.0 signatures. This means that Security.framework WILL NOT be able to verify an AquaticPrime signature. I don’t use Aquatic Prime, but I may have had the same problem with signatures (keys) created by the Crypt::OpenSSL::RSA Perl module. Specifically, I was told that it was missing the ASN.1 header which is required by Section 9.2 of RFC 3447. In boneheaded desperation, in my Perl script, I simply prepended the appropriate 15-byte ASN.1 header onto the message digest before encrypting, and, amazingly, the Security Transform API verified the resulting signature. I've pushed to github.com my C function for validating RSA signatures with Security Transform, based on Apple’s CryptoCompatibility sample. Now features complete error checking and returns NSError. http://github.com/jerrykrinock/Functions/blob/master/SSY-RSA.h http://github.com/jerrykrinock/Functions/blob/master/SSY-RSA.m Just another way to 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Any way to force a window under the menu bar?
On 2015/01/26, at 14:54, Eric Schlegel eri...@apple.com wrote: Even if you force it under the menubar, you won’t see its content show up in the menubar; the menubar window pulls its blurred content exclusively from the desktop image. -eric But you could then create some excessive code to create and set temp desktop images including a slice of the window in just the right place... Totally not worth it, but interesting exercise. But there is no API way to set the desktop picture on a per-screen, per-space basis. Trygve ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Any way to force a window under the menu bar?
On 26 Jan 2015, at 05:39, Trygve Inda cocoa...@xericdesign.com wrote: I have created a borderless NSWindow. Is there a way to force it to appear under the menu bar so that the content of the window shows through the translucent menu bar? The OS seems to be resizing or repositioning my window to prevent it from sliding under the menu bar even when positioned programmatically (ie not dragging). I think this is done by - (NSRect)constrainFrameRect:(NSRect)frameRect toScreen:(NSScreen *)screen, so you could probably just override that to return an unchanged rect to get your window under the menu bar. Nope - while did does prevent the window from resizing, as Eric Schlegel mentioned, the menu bar background is derived from the desktop picture. Trygve ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: iOS 6.x vs iOS 8.x layout
On Jan 26, 2015, at 11:34 AM, David Duncan david.dun...@apple.com wrote: Do you mean your app, without being rebuilt, is laying out incorrectly Yes. I had a popover for sharing which displayed below the toolbar and on iOS 8 it wants to display above the toolbar and is therefore not visible. The other issues were on recompile trying to correct the above. I'll do the bug thing. Thanks. -rags ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post 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: iOS 6.x vs iOS 8.x layout
On Jan 26, 2015, at 9:58 AM, Raglan T. Tiger r...@crusaderrabbit.net wrote: I did a free iOS app for the iPad which ran just fine on iOS 6. Now for users who have updated to iOS 8 the view layout is incomprehensible ... toolbars do not show, and popovers are positioned wrong. Why would this happen and what recourse do I have? (I guess learn about constrains?). Do you mean your app, without being rebuilt, is laying out incorrectly, or that your recompiled application is laying out incorrectly? If you recompiled the application, then the UI changed significantly between iOS 6 and iOS 8, so you will likely have to make significant changes in order to adapt to those changes (and potentially more to look good at the same time). But if you didn’t recompiled the application it would be expected to work reasonably well and you should file a bug. -rags ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post 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 -- 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
iOS 6.x vs iOS 8.x layout
I did a free iOS app for the iPad which ran just fine on iOS 6. Now for users who have updated to iOS 8 the view layout is incomprehensible ... toolbars do not show, and popovers are positioned wrong. Why would this happen and what recourse do I have? (I guess learn about constrains?). -rags ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post 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: Any way to force a window under the menu bar?
On 26 Jan 2015, at 05:39, Trygve Inda cocoa...@xericdesign.com wrote: I have created a borderless NSWindow. Is there a way to force it to appear under the menu bar so that the content of the window shows through the translucent menu bar? The OS seems to be resizing or repositioning my window to prevent it from sliding under the menu bar even when positioned programmatically (ie not dragging). I think this is done by - (NSRect)constrainFrameRect:(NSRect)frameRect toScreen:(NSScreen *)screen, so you could probably just override that to return an unchanged rect to get your window under the menu bar. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post 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: Detecting Managed Object Property Change From Undo Redo
On 2015 Jan 26, at 16:10, Richard Charles rcharles...@gmail.com wrote: It is not uncommon for this application to work with large data sets. I tested using KVO on a managed object property and undo took 34 seconds. I implemented custom accessors (public and primitive) containing custom change code and undo took 3 seconds. Very interesting result. I have not tested using NSObjectsChangedInManagingContextNotification to see how long an undo would take but the thought looking through the notification for specific properties in specific objects seems daunting. I saved out the notification description for the change mentioned above and it was a 29 MB text file. So using notifications from the managed object context for this property change does not seem to be the way to go. That’s probably true, but as you’ve found above, you never know about performance until you test it. It looks like using custom public and primitive accessors is the way go. Not for everything, but where it is needed. OK, although I’ve never used them, there is a section on Custom Primitive Accessor Methods” in the Core Data Programming Guide, and it does not say not to. The example they give is pretty confusing: - (void)setPrimitiveInt16:(short)newInt16 { nonCompliantKVCivar = newInt16; } What in the world is that nonCompliantKVCivar? I tried it in my project, on the ‘rating’ property as in my YouTube video. - (void)setPrimitiveRating:(NSNumber*)newRating { rating = newRating ; } Does not compile. The compiler never heard of ‘rating’. Same result if I change it to _rating, m_rating or nonCompliantKVCrating. OK, so then I added an ivar: _rating, and now of course _rating = newRating ; compiles. What was even more surprising is if I changed a ‘rating’ by clicking stars in the user interface, the user interface would not show the stars, until I closed and reopened the document; voila it had persisted! So this instance variable is somehow tied to the persistent store. I suppose this is explained by this documentation snippet: Typically there should be little reason to implement primitive accessor methods. They are, however, useful if you want custom methods to provide direct access to instance variables for persistent Core Data properties.” The lack of action in the user interface is maybe explained by they do not issue key-value access or observing notifications”. OK, the user interface runs on Cocoa Bindings which runs on KVO. But did my click not also run through the regular accessor, which does issue KVO? I set a breakpoint and confirmed that setRating: was indeed the invoker of setPrimitiveRating:. One more thing I tried: This is an override. Should I not invoke super? - (void)setPrimitiveRating:(NSNumber*)newRating { rating = newRating ; [super setPrimitiveRating:newRating] ; } Result: Compiler warning that my superclass (eventually, NSManagedObject) did not implement this method, a crash at runtime confirming that. Conclusion: Primitive accessors are potentially useful but more study is needed to understand how they work, and in particular how to override them without breaking stuff. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post 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: Detecting Managed Object Property Change From Undo Redo
On Jan 26, 2015, at 12:10 PM, Jerry Krinock je...@ieee.org wrote: On 2015 Jan 26, at 07:00, Richard Charles rcharles...@gmail.com wrote: Where do you post the notification from for a managed object property change? Just to clarify: Your question refers to how I do it in my real apps, using NSNotificationCenter, not how I did it in the YouTube video, which was demonstating KVO. Commonly, I use a custom setter, like this: - (void)setRating:(NSNumber*)newValue { [self postWillSetNewValue:newValue forKey:constKeyRating] ; [self willChangeValueForKey:constKeyRating] ; [self setPrimitiveRating:newValue] ; [self didChangeValueForKey:constKeyRating] ; } wherein the -postWillSetNewValue:forKey: posts notifications. It doesn’t work in a managed object's custom public property accessor because the public property accessor is not called during undo redo. Ah, I’d forgotten about that. Indeed, the undo and redo tasks registered by Core Data do not try and put things back in order using public accessors the way I would (screw it up). Instead, Core Data registers these annoyingly opaque undo and redo tasks that, I presume, just change the whole object graph to a previous (consistent) state in one fell swoop. I think that’s why Core Data does undo and redo so reliably. But real apps often need to observe all object changes, and so the resulting un-observability transfers the complexity elsewhere. [1] The way I’ve worked around that is to, as Mike Abdullah said, register for NSObjectsChangedInManagingContextNotification. I do it in a kind of “entity manager” class that also does some fetching, etc. But read the NSObjectsChangedInManagingContextNotification documentation and understand the edge cases in which this notification does not get sent. Other patches may be necessary. So, going back to my YouTube video, I think you should take another look at using KVO. The fact that it just works” with undo and redo is nice, and with tricks like Kyle Sluder’s crafty -startObserving… and -stopObserving… methods, the bookkeeping may be tractable. 1. Google: “there are no solutions only tradeoffs” It is not uncommon for this application to work with large data sets. I tested using KVO on a managed object property and undo took 34 seconds. I implemented custom accessors (public and primitive) containing custom change code and undo took 3 seconds. I have not tested using NSObjectsChangedInManagingContextNotification to see how long an undo would take but the thought looking through the notification for specific properties in specific objects seems daunting. I saved out the notification description for the change mentioned above and it was a 29 MB text file. So using notifications from the managed object context for this property change does not seem to be the way to go. It looks like using custom public and primitive accessors is the way go. Not for everything, but where it is needed. 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: Detecting Managed Object Property Change From Undo Redo
On 2015 Jan 26, at 22:14, Quincey Morris quinceymor...@rivergatesoftware.com wrote: On Jan 26, 2015, at 17:55 , Jerry Krinock je...@ieee.org wrote: What in the world is that nonCompliantKVCivar? It’s just an ivar that was defined separately from this particular code fragment. It’s “non compliant” because Core Data doesn’t have a way of backing a property with ‘short’ scalar storage. I don’t think so, Quincey. You seem to be saying that the only example given by Apple is a bad example, because it is a a nontypical, special case. I mean, most attributes in most apps are objects, not scalars. The ‘rating’ I used as an example is a NSNumber object. But I really don’t think that matters to this discussion, so let’s move on… There’s sort of no point in doing exactly this, BTW … All that’s going on here is that Core Data doesn’t use ivars as backing storage for properties … This explains, a primitive accessor. It’s a rare thing, an un-duck … All very good explanations. So this instance variable is somehow tied to the persistent store. It’s not, though. You must have done something wrong that made it work (!). I have a theory about that, which I’ll get to in a moment. I’m going to skip up to there now… My guess is that you provided an implementation of ‘setPrimitiveRating:’ (the setter), but that you *didn’t* provide an implementation of ‘primitiveRating’ (the getter). Your guess was correct. So I corrected that mistake and re-ran the experiment with both setter and getter, - (void)setPrimitiveRating:(NSNumber*)newRating { _rating = newRating ; } - (NSNumber*)primitiveRating { return _rating ; } you will then have to do extra work to get the value to persist, since the ivar itself doesn’t”. Nope. It still persists! Apparently, the persistent store is written by the public accessor, and/or there is some magical connection between the public and primitive. But with my mistake corrected, the user interface now works again. Essentially, the app works just the same without those trivial primitive accessors and ivar, as with them. So far, we’ve done no harm. But the useful thing is that, as Richard Charles claimed, and I’ve now confirmed this, although the public accessors do not get invoked during Undo and Redo operations, the primitive accessors do. So, provided that he implements both the primitive setter and getter, he can slip some code into the getter to post a notification of the value change. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post 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: Any way to force a window under the menu bar?
I believe you could do this by setting the window’s level property to kCGDesktopWindowLevelKey (see https://developer.apple.com/library/mac/documentation/GraphicsImaging/Reference/Quartz_Services_Ref/index.html#//apple_ref/c/tdef/CGWindowLevelKey https://developer.apple.com/library/mac/documentation/GraphicsImaging/Reference/Quartz_Services_Ref/index.html#//apple_ref/c/tdef/CGWindowLevelKey for the other values available to you) iain On 26 Jan 2015, at 04:39, Trygve Inda cocoa...@xericdesign.com wrote: I have created a borderless NSWindow. Is there a way to force it to appear under the menu bar so that the content of the window shows through the translucent menu bar? The OS seems to be resizing or repositioning my window to prevent it from sliding under the menu bar even when positioned programmatically (ie not dragging). Thanks, Trygve ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/iain%40falsevictories.com This email sent to i...@falsevictories.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