Re: iBeacons - can 100 different devices be active and seen by one device?
We did almost exactly what David's describing at the NSNorth conference this spring. There were about a hundred attendees, and everyone was given an iBeacon that belonged to someone else; using the accompanying conference app, which employed a crude proximity meter (based on RSSI level), we had to figure out who had our beacon in order to get it back. Similarly, it was possible to monitor the presence and levels from every conference beacon in the room. The limitation that Jim alludes to is that CoreLocation supports monitoring a max of 20 regions. However in iBeacon terms a region corresponds to a beacon UUID, and in the scenario you envision you'll likely only have one. At NSNorth all of the iBeacons were configured with a common UUID, but were differentiated by distinct major / minor ID numbers (which are exposed as NSNumber in the API; I'm not sure what the practical range is but surely quite a number of bits). Having said this, determining the relative proximity based solely on RSSI didn't seem to be particularly straightforward in practice, especially if there a bunch of them nearby. cheers, -ben On 17 Jul 2014, at 7:33 am, Jim Adams jim.ad...@sas.com wrote: I think there is a limit of 20 iBeacons that you could range for. Android can see them all but iPhone limits you. -Original Message- From: cocoa-dev-bounces+jim.adams=sas@lists.apple.com [mailto:cocoa-dev-bounces+jim.adams=sas@lists.apple.com] On Behalf Of David Hoerl Sent: Wednesday, July 16, 2014 3:34 PM To: Cocoa Subject: iBeacons - can 100 different devices be active and seen by one device? I was talking to someone about an idea of giving everyone at a gathering - say 100 people - iBeacon pendants. An app would have a translation of everyone there along with their beacon ID, and show the 10 closest people to any given iOS device.. Would iOS be capabile of detecting 100 or so active devices? Or would this swamp the OS resulting in sporatic results? This is obviously somewhat difficult to test without first purchasing 100 devices... David ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/jim.adams%40sas.com This email sent to jim.ad...@sas.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/ben%40zygoat.ca This email sent to b...@zygoat.ca ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post 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
How to get iOS version at runtime?
How to get iOS version at runtime? Like: BOOL isRunningOnDeviceOrSimulatorInVersion8 = ??? I seem to have asked this question before (about OS X) and was told to use either NSAppKitVersionNumber or NSFoundationVersionNumber. iOS obviously has no NSAppKitVersionNumber, but I cannot find a UIKitVersionNumber. The stuff which behaves differently in 7.1.2 versus 8.0 is UIKeyboardWillChangeFrameNotification, which looks more like UIKit. Should I use NSFoundationVersionNumber anyway or what? And: does the Simulator return the NSFoundationVersionNumber of the simulated iOS (8.0) or the machine it is running on (10.9.4)? ProcessInfo has operatingSystemVersionString which is documented as not appropriate for parsing. Gerriet. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post 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
Trying to custom-migrate core data
I'm trying to do a custom core data migration, but I'm running into an issue getting the model for the older data: NSDictionary* metadata = [NSPersistentStoreCoordinator metadataForPersistentStoreOfType: NSSQLiteStoreType URL: storeURL error: err]; NSManagedObjectModel* sourceModel = [NSManagedObjectModel mergedModelFromBundles: nil forStoreMetadata: metadata]; metadata is valid, but sourceModel is nil. I have several versions of the same model in my (iOS) app. According to the docs, passing nil here is the right thing to do. Any ideas? Thanks! -- Rick Mann rm...@latencyzero.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: Trying to custom-migrate core data
Turns out, my model version for the older store had gotten modified. I restored that, but then I had to re-create the mapping file. After that, automatic migration picked it up and tried to use my policies! Onward and upward… On Jul 18, 2014, at 02:59 , Rick Mann rm...@latencyzero.com wrote: I'm trying to do a custom core data migration, but I'm running into an issue getting the model for the older data: NSDictionary* metadata = [NSPersistentStoreCoordinator metadataForPersistentStoreOfType: NSSQLiteStoreType URL: storeURL error: err]; NSManagedObjectModel* sourceModel = [NSManagedObjectModel mergedModelFromBundles: nil forStoreMetadata: metadata]; metadata is valid, but sourceModel is nil. I have several versions of the same model in my (iOS) app. According to the docs, passing nil here is the right thing to do. Any ideas? Thanks! -- Rick Mann rm...@latencyzero.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/rmann%40latencyzero.com This email sent to rm...@latencyzero.com -- Rick Mann rm...@latencyzero.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
rotate UI subview (CFAffline Transform)
I have a problem which I can't find anyone else asking after hours of searches through stackexchange and the like. In a UIView, I'm rotating a subview with a Gesture recognizer that calls this selector: - (IBAction)rotateShape:(UIRotationGestureRecognizer *)gesture { gesture.view.transform = CGAffineTransformMakeRotation(gesture.rotation); } The rotation performs as expected and all is right with the world. However, as soon as I attempt to touch or move the rotated subview again (it also has a pan gesture), it reverts to its original orientation. It seems the original transform values are still being retained and held by the object or by the drawing context (I'm still not quite comfortable with all the graphics theory; indeed, this is my first attempt at trying to unlock its mysteries). What else do I need to do to ensure the new rotated, orientation sticks so that I can move the shape without it reverting to the original orientation? Thanks for any help. Phil signature.asc Description: Message signed with OpenPGP using GPGMail ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post 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 iOS version at runtime?
[[UIDevice currentDevice] systemVersion] returns a string, i.e. 7.1.2. if ([[[UIDevice currentDevice] systemVersion] compare:@8.0 options:NSNumericSearch] == NSOrderedDescending) // older than 8.0 else // 8.0 and newer -Original Message- From: cocoa-dev-bounces+juliuso=icodemonks@lists.apple.com [mailto:cocoa-dev-bounces+juliuso=icodemonks@lists.apple.com] On Behalf Of Gerriet M. Denkmann Sent: Friday, July 18, 2014 3:41 AM To: cocoa-dev@lists.apple.com Subject: How to get iOS version at runtime? How to get iOS version at runtime? Like: BOOL isRunningOnDeviceOrSimulatorInVersion8 = ??? I seem to have asked this question before (about OS X) and was told to use either NSAppKitVersionNumber or NSFoundationVersionNumber. iOS obviously has no NSAppKitVersionNumber, but I cannot find a UIKitVersionNumber. The stuff which behaves differently in 7.1.2 versus 8.0 is UIKeyboardWillChangeFrameNotification, which looks more like UIKit. Should I use NSFoundationVersionNumber anyway or what? And: does the Simulator return the NSFoundationVersionNumber of the simulated iOS (8.0) or the machine it is running on (10.9.4)? ProcessInfo has operatingSystemVersionString which is documented as not appropriate for parsing. Gerriet. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post 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 iOS version at runtime?
On 18 Jul 2014, at 3:40 pm, Gerriet M. Denkmann gerr...@mdenkmann.de wrote: How to get iOS version at runtime? Like: BOOL isRunningOnDeviceOrSimulatorInVersion8 = ??? I seem to have asked this question before (about OS X) and was told to use either NSAppKitVersionNumber or NSFoundationVersionNumber. iOS obviously has no NSAppKitVersionNumber, but I cannot find a UIKitVersionNumber. The stuff which behaves differently in 7.1.2 versus 8.0 is UIKeyboardWillChangeFrameNotification, which looks more like UIKit. Should I use NSFoundationVersionNumber anyway or what? And: does the Simulator return the NSFoundationVersionNumber of the simulated iOS (8.0) or the machine it is running on (10.9.4)? ProcessInfo has operatingSystemVersionString which is documented as not appropriate for parsing. Gerriet. The easy answer is you’re not supposed to do it because it’s fragile and guaranteed to break. You’re also not supposed to have to do it. I wish I could ever remember how compatibility is meant to work. If you build for minimum target 7 but run on 8, isn’t the API your code ‘sees’ supposed to be ‘compatible with 7’ or is it allowed to give you a UIKeyboardWillChangeFrameNotification which looks like iOS8? That could just be a bug. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post 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 do I temporary retain self, under ARC?
That's similar to what I have used. Initially it started out simply as id keepAlive=self; ... keepAlive=nil; but a few Xcode versions ago the static analyzer started complaining that it wasn't really doing anything. So that last line became if(keepAlive) { keepAlive=nil; } which shut up the analyzer. [keepAlive self]; like Andy suggests would probably work just as well, though probably a tad more expensive as a method call is involved. Gerd On Jul 17, 2014, at 11:23 PM, Andy Lee ag...@mac.com wrote: On Jul 17, 2014, at 11:01 PM, Jens Alfke j...@mooseyard.com wrote: Once I’ve identified such a bug, the fix is easy: put a [[self retain] autorelease] at the top of the method. Except now I’m using ARC, and I can’t find a simple way of doing it. I tried adding __unused id retainedSelf = self; but the optimizer recognizes that retainedSelf isn’t used and strips it out, making this a no-op. The only thing I’ve found that works is CFRetain((__bridge CFTypeRef)self); at the top of the method, and a corresponding CFRelease at the end, but this is pretty ugly and could cause leaks if the method returns early. How about id retainedSelf = self; at the beginning and [retainedSelf self]; at the end? --Andy ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post 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/gerti-cocoadev%40bitart.com This email sent to gerti-cocoa...@bitart.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: rotate UI subview (CFAffline Transform)
Transforms are meant to be tiered / layered. In other words, if you do another transform via a pan or rotation, it’s going to reset. If your view was already scaled (matrix has been edited), doing a Make transform (ex: CGAffineTransformMakeRotation) would reset it. Transforms manipulate the layer(s). Your view isn’t aware the layer has been tampered with. If it isn’t another transform that is resetting the layer, then you need to reapply your transform. You can can easily get your current transformation via: CGAffineTransform transformation = theRotatedView.transform; CGFloat amountRotated = atan2f(transformation.b, transformation.a); // b and a are the values manipulated for matrix math. A debugging method that you can use is: NSStringFromCGAffineTransform(), will help output your current transform. I’m sure you’ll see the matrix numbers reset. Regards - Cody It would help to see the code that makes the pan gesture. On Jul 18, 2014, at 4:51 AM, 2551 2551p...@gmail.com wrote: I have a problem which I can't find anyone else asking after hours of searches through stackexchange and the like. In a UIView, I'm rotating a subview with a Gesture recognizer that calls this selector: - (IBAction)rotateShape:(UIRotationGestureRecognizer *)gesture { gesture.view.transform = CGAffineTransformMakeRotation(gesture.rotation); } The rotation performs as expected and all is right with the world. However, as soon as I attempt to touch or move the rotated subview again (it also has a pan gesture), it reverts to its original orientation. It seems the original transform values are still being retained and held by the object or by the drawing context (I'm still not quite comfortable with all the graphics theory; indeed, this is my first attempt at trying to unlock its mysteries). What else do I need to do to ensure the new rotated, orientation sticks so that I can move the shape without it reverting to the original orientation? Thanks for any help. Phil ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post 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/cody%40servalsoft.com This email sent to c...@servalsoft.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: rotate UI subview (CFAffline Transform)
On Jul 18, 2014, at 4:51 AM, 2551 2551p...@gmail.com wrote: I have a problem which I can't find anyone else asking after hours of searches through stackexchange and the like. In a UIView, I'm rotating a subview with a Gesture recognizer that calls this selector: - (IBAction)rotateShape:(UIRotationGestureRecognizer *)gesture { gesture.view.transform = CGAffineTransformMakeRotation(gesture.rotation); } The rotation performs as expected and all is right with the world. However, as soon as I attempt to touch or move the rotated subview again (it also has a pan gesture), it reverts to its original orientation. No, when you apply a transform to a view, it becomes _the_ transform; it isn't retaining previous translation state. Based on what you've said, it sounds like when you touch/move the object that you're applying a translation transform to the view. It seems the original transform values are still being retained and held by the object or by the drawing context (I'm still not quite comfortable with all the graphics theory; indeed, this is my first attempt at trying to unlock its mysteries). You may already know this but the CFAffineTransformMake*() functions apply a single operation (rotate, scale or translate) to the identity transform. If, for example, you called CGAffineTransformMakeRotation() and then later CGAffineTransformMakeTranslation(), then the rotation will be lost. What else do I need to do to ensure the new rotated, orientation sticks so that I can move the shape without it reverting to the original orientation? Keep track of translation and rotation values in your model and then build translated+rotated transforms that reflect the current state of each object. - (IBAction)rotateShape:(UIRotationGestureRecognizer *)gesture { modelObject = ...; modelObject.rotation = gesture.rotation; gesture.view.transform = [self transformForModelObject:modelObject]; } ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post 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 do I temporary retain self, under ARC?
You could even eliminate the (admittedly negligible) cost of setting keepAlive = nil by changing the if(keepAlive) to if(!keepAlive). Along the lines of avoiding a message send, I wonder if this would work: do { // ... } while (!self); --Andy On Jul 18, 2014, at 9:41 AM, Gerd Knops gerti-cocoa...@bitart.com wrote: That's similar to what I have used. Initially it started out simply as idkeepAlive=self; ... keepAlive=nil; but a few Xcode versions ago the static analyzer started complaining that it wasn't really doing anything. So that last line became if(keepAlive) { keepAlive=nil; } which shut up the analyzer. [keepAlive self]; like Andy suggests would probably work just as well, though probably a tad more expensive as a method call is involved. Gerd On Jul 17, 2014, at 11:23 PM, Andy Lee ag...@mac.com wrote: On Jul 17, 2014, at 11:01 PM, Jens Alfke j...@mooseyard.com wrote: Once I’ve identified such a bug, the fix is easy: put a [[self retain] autorelease] at the top of the method. Except now I’m using ARC, and I can’t find a simple way of doing it. I tried adding __unused id retainedSelf = self; but the optimizer recognizes that retainedSelf isn’t used and strips it out, making this a no-op. The only thing I’ve found that works is CFRetain((__bridge CFTypeRef)self); at the top of the method, and a corresponding CFRelease at the end, but this is pretty ugly and could cause leaks if the method returns early. How about id retainedSelf = self; at the beginning and [retainedSelf self]; at the end? --Andy ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post 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/gerti-cocoadev%40bitart.com This email sent to gerti-cocoa...@bitart.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: How do I temporary retain self, under ARC?
And of course the second I hit Send I realized the do {} idea doesn't work. Imagine if it was some variable other than self that you might *deliberately* use to indicate when the loop should terminate. --Andy --Andy On Jul 18, 2014, at 10:07 AM, Andy Lee ag...@mac.com wrote: You could even eliminate the (admittedly negligible) cost of setting keepAlive = nil by changing the if(keepAlive) to if(!keepAlive). Along the lines of avoiding a message send, I wonder if this would work: do { // ... } while (!self); --Andy On Jul 18, 2014, at 9:41 AM, Gerd Knops gerti-cocoa...@bitart.com wrote: That's similar to what I have used. Initially it started out simply as idkeepAlive=self; ... keepAlive=nil; but a few Xcode versions ago the static analyzer started complaining that it wasn't really doing anything. So that last line became if(keepAlive) { keepAlive=nil; } which shut up the analyzer. [keepAlive self]; like Andy suggests would probably work just as well, though probably a tad more expensive as a method call is involved. Gerd On Jul 17, 2014, at 11:23 PM, Andy Lee ag...@mac.com wrote: On Jul 17, 2014, at 11:01 PM, Jens Alfke j...@mooseyard.com wrote: Once I’ve identified such a bug, the fix is easy: put a [[self retain] autorelease] at the top of the method. Except now I’m using ARC, and I can’t find a simple way of doing it. I tried adding __unused id retainedSelf = self; but the optimizer recognizes that retainedSelf isn’t used and strips it out, making this a no-op. The only thing I’ve found that works is CFRetain((__bridge CFTypeRef)self); at the top of the method, and a corresponding CFRelease at the end, but this is pretty ugly and could cause leaks if the method returns early. How about id retainedSelf = self; at the beginning and [retainedSelf self]; at the end? --Andy ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post 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/gerti-cocoadev%40bitart.com This email sent to gerti-cocoa...@bitart.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: How to get iOS version at runtime?
On 18 Jul 2014, at 20:30, Roland King r...@rols.org wrote: On 18 Jul 2014, at 3:40 pm, Gerriet M. Denkmann gerr...@mdenkmann.de wrote: How to get iOS version at runtime? Like: BOOL isRunningOnDeviceOrSimulatorInVersion8 = ??? I seem to have asked this question before (about OS X) and was told to use either NSAppKitVersionNumber or NSFoundationVersionNumber. iOS obviously has no NSAppKitVersionNumber, but I cannot find a UIKitVersionNumber. The stuff which behaves differently in 7.1.2 versus 8.0 is UIKeyboardWillChangeFrameNotification, which looks more like UIKit. Should I use NSFoundationVersionNumber anyway or what? And: does the Simulator return the NSFoundationVersionNumber of the simulated iOS (8.0) or the machine it is running on (10.9.4)? ProcessInfo has operatingSystemVersionString which is documented as not appropriate for parsing. Gerriet. The easy answer is you’re not supposed to do it because it’s fragile and guaranteed to break. If 7.1.2 and 8.0 behave differently, I have no option other doing this fragile stuff. You’re also not supposed to have to do it. In an ideal world this would probably be true. And I certainly could wait until all bugs have been fixed by Apple. But I am kind of impatient. I wish I could ever remember how compatibility is meant to work. If you build for minimum target 7 but run on 8, isn’t the API your code ‘sees’ supposed to be ‘compatible with 7’ or is it allowed to give you a UIKeyboardWillChangeFrameNotification which looks like iOS8? That could just be a bug. I am using: Base SDK = Latest = 8.0 iOS Deployment Target = 7.1 7.1.2 and 8.0 (the latter tested only in Simulator) differ in two points (as regarding UIKeyboardWill...Notifications): 1. the amount of Notifications differ. To figure out, how to change the height of my UITextView when a keyboard comes, goes or changes its size, I use: - in 7.1.2 WillShow and WillHide - in 8.0 WillChangeFrame 2. these Notifications have two rects in their userInfo: UIKeyboardFrameEnd and UIKeyboardFrameBegin. In 7.1.2 these are always in the portrait orientation. To be usable one has to rotate them to the actual orientation. In 8.0 they are already in the actual orientation (much more sensible) Kind regards, Gerriet. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post 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 do I temporary retain self, under ARC?
On Thu, 17 Jul 2014 20:01:09 -0700, Jens Alfke said: Every once in a while I run into a bug in my code that’s triggered by self getting dealloced in the middle of a method. It’s usually something like - (void) someMethod { doSomeStuff; [self.delegate object: self didSomeStuff: yeah]; doSomeMoreStuff; } where it turns out that the delegate method clears its reference to me, and that was the last reference, causing self to get dealloced during the delegate call, causing doSomeMoreStuff to crash. I've had similar cases under garbage collection and one nice solution was to add: [objToKeepAlive self]; at the end. As the 'self' message does nothing, it's sorta self-documenting, and as all message dispatch is dynamic, the optimizer can't remove it. I don't have much experience with ARC yet, but seems this might work there too. Cheers, -- Sean McBride, B. Eng s...@rogue-research.com Rogue Researchwww.rogue-research.com Mac Software Developer Montréal, Québec, Canada ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post 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 iOS version at runtime?
In an ideal world this would probably be true. And I certainly could wait until all bugs have been fixed by Apple. But I am kind of impatient. ok 2. these Notifications have two rects in their userInfo: UIKeyboardFrameEnd and UIKeyboardFrameBegin. In 7.1.2 these are always in the portrait orientation. To be usable one has to rotate them to the actual orientation. In 8.0 they are already in the actual orientation (much more sensible) Now I thought this was covered in one of the WWDC videos and there’s a method (perhaps one only available on iOS8) which still converted always to screen orientation for those pieces of code which needed to be compatible with ‘the old way of doing it’. There was certainly some discussion about this change which is potentially quite a breaking one and so there were some new methods of converting rectangles mentioned there. Did none of those help? ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post 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
[Solved] rotate UI subview (CFAffline Transform)
Thanks Steve and Cody You were both correct that what was happening was that the subsequent translation was cancelling the rotation. All I needed to do was store the rotation as a CGFloat on the object and then call the rotation again after the move. Thanks again. signature.asc Description: Message signed with OpenPGP using GPGMail ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post 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
[Xcode 6 beta3][Swift] NSDocument addWindowController failing inexplicably
I'm writing a document-based app in Swift, with a custom view controller class, and thus had to implement my own version of makeWindowControllers. However, for some reason the call to self.addWindowControllers does nothing at all. I tried stepping into it in the debugger, but that just stepped over the line. I'm not sure if the bug is in my code or Apple's - I haven't seen any other users having this problem so I assume it is me. My document class contains the following (relevant) code: var additionalWindowController: NSWindowController! /* C */ override func makeWindowControllers() { let wc = MessageReadingViewController(windowNibName: MessageReadingViewController) wc.document = self NSLog(have %d windowControllers, self.windowControllers.count) /* A */ self.addWindowController(wc) NSLog(have %d windowControllers, self.windowControllers.count) /* A */ self.additionalWindowController = wc /* C */ wc.showWindow(self) /* B */ } Lines A both print have 0 windowControllers. My MessageReadingViewController and associated nib seem to be valid - with lines B and C there the window is shown and (as far as my limited implementation of the UI can demonstrate) interacts correctly with the document object. Without the lines marked C, the window controller, which isn't added to the windowControllers array, is released when the function ends and is thus immediately deallocated, closing the window almost instantly. I haven't tried adding the window controller manually to the windowControllers array, mainly becuase I haven't found how to access a superclass's ivars directly in Swift. For those not familiar with Swift, the above code approximately translated into Objective-C would be: @property NSWindowController *additionalWindowController; /* C */ -(void)makeWindowControllers{ MessageReadingViewController *wc = [[MessageReadingViewController alloc] initWithWindowNibName: @MessageReadingViewController]; [wc setDocument:self]; NSLog(have %d windowControllers, self.windowControllers.count); /* A */ [self addWindowController: wc]; NSLog(have %d windowControllers, self.windowControllers.count); /* A */ self.additionalWindowController = wc; /* C */ [wc showWindow:self]; /* B */ } (I'll crosspost this to the newsgroups comp.sys.mac.programmer.help and comp.lang.objective-c, and summarise the answers I get in each place to the other.) signature.asc Description: Message signed with OpenPGP using GPGMail ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post 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: [Xcode 6 beta3][Swift] NSDocument addWindowController failing inexplicably
On 18 Jul 2014, at 13:10, Philip Shaw wahspil...@gmail.com wrote: I'm writing a document-based app in Swift, with a custom view controller class, and thus had to implement my own version of makeWindowControllers. However, for some reason the call to self.addWindowControllers does nothing at all. I tried stepping into it in the debugger, but that just stepped over the line. I'm not sure if the bug is in my code or Apple's - I haven't seen any other users having this problem so I assume it is me. My document class contains the following (relevant) code: var additionalWindowController: NSWindowController! /* C */ override func makeWindowControllers() { let wc = MessageReadingViewController(windowNibName: MessageReadingViewController) wc.document = self NSLog(have %d windowControllers, self.windowControllers.count) /* A */ self.addWindowController(wc) NSLog(have %d windowControllers, self.windowControllers.count) /* A */ self.additionalWindowController = wc /* C */ wc.showWindow(self) /* B */ } Lines A both print have 0 windowControllers. Out of curiosity, what happens if you remove wc.document = self from makeWindowControllers()? addWindowController() already sets the window controller document, so you don’t need that statement. Furthermore, addWindowController() removes the window controller from its previous document in case there is one, which may be related to the behaviour you’re seeing. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post 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: showing app windows at launch prior to NSDocument tasks
On Jul 17, 2014, at 9:57 PM, Graham Cox graham@bigpond.com wrote: (have you actually gotten similar to work?) Yes, the scheme I've outlined is exactly how it works in my own app. I would share the code with you, but it's not my IP to give away unfortunately. ofc: an erstwhile colleague used to say: ‘friends don’t let friends copy [proprietary] source’. But here's its description: sounds a very well designed mechanism: kudos! out of curiosity: does the window fade-in or just show? only, i’ve had a clue that my issue my have something to do w/ in-progress animations (fade-in) on my panels, which the background document load(s) may be playing havoc w/. best, edward ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post 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
Another -[NSOutlineView autosaveExpandedItems] bug
I have found and reported another bug in the -[NSOutlineView autosaveExpandedItems] mechanism. Here is a brief summary of my bug report #17728176: Summary: In NSOutlineView, setting autosaveExpandedItems to YES is supposed to cause the outline to remember the expanded/collapsed state of its rows across application launches. The documentation points out that it does this only if you implement the -persistentObjectForItem: and -itemForPersistentObject: NSOutlineViewDataSource methods. This mostly works correctly, but there is one case where expanding or collapsing rows fails to call -persistentObjectForItem: and throws the autosaveExpandedItems mechanism into an inconsistent state. Specifically, the NSOutlineView reference document says the following with respect to the item parameter of -[NSOutlineView expandItems:expandChildren:]: Starting in OS X version 10.5, passing 'nil' will expand each item under the root in the outline view. It does expand each item as stated, but it does NOT call the -persistentObjectForItem: datasource method, and as a result the expanded state of all rows is not reinstated after quit and relaunch. The only way to get an expand all button or menu item to persist across relaunches is to expand each item individually in a loop, something like this:: - (IBAction)expandAllRows:(id)sender { AWRSourceListOutlineView *outlineView = [self sourceListOutlineView]; NSIndexSet *topLevelItemIndexes = [NSIndexSet indexSetWithIndexesInRange:NSMakeRange(0, [[self sourceListContents] count] - 1)]; [topLevelItemIndexes enumerateIndexesWithOptions:NSEnumerationReverse usingBlock:^(NSUInteger itemIndex, BOOL *stop) { [outlineView expandItem:[[self sourceListContents] objectAtIndex:itemIndex] expandChildren:YES]; }]; // This alternative does not trigger the -[NSOutlineViewDataSource persistentObjectForItem:] datasource method; bug in OS X 10.9.4 Mavericks. // [[self sourceListOutlineView] expandItem:nil expandChildren:YES]; } -- Bill Cheeseman - b...@cheeseman.name ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post 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: Another -[NSOutlineView autosaveExpandedItems] bug
Setting aside the NSOutlineView bug you're describing, there are issues with your code: On Jul 18, 2014, at 1:19 PM, Bill Cheeseman wjcheese...@gmail.com wrote: - (IBAction)expandAllRows:(id)sender { AWRSourceListOutlineView *outlineView = [self sourceListOutlineView]; NSIndexSet *topLevelItemIndexes = [NSIndexSet indexSetWithIndexesInRange:NSMakeRange(0, [[self sourceListContents] count] - 1)]; This leaves out the index of the last item. A range consists of a starting index and a length, _not_ the last index. Count - 1 would be appropriate for a last index, but not for a length of a range that encompasses the last index (assuming starting at 0). [topLevelItemIndexes enumerateIndexesWithOptions:NSEnumerationReverse usingBlock:^(NSUInteger itemIndex, BOOL *stop) { [outlineView expandItem:[[self sourceListContents] objectAtIndex:itemIndex] expandChildren:YES]; }]; Is there a reason you didn't just directly enumerate the objects in the collection? Constructing an index set for all of the items, enumerating that, and then looking up the items by the index seems cumbersome. [[self sourceListContents] enumerateObjectsWithOptions:NSEnumerationReverse usingBlock:^(id obj, NSUInteger idx, BOOL *stop) { [outlineView expandItem:obj expandChildren:YES]; }]; Even if I've misunderstood and you're deliberately skipping the last element, it's probably cleaner to do that with the above with an added check on the idx parameter. 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Another -[NSOutlineView autosaveExpandedItems] bug
On Jul 18, 2014, at 3:12 PM, Ken Thomases k...@codeweavers.com wrote: Setting aside the NSOutlineView bug you're describing, there are issues with your code: On Jul 18, 2014, at 1:19 PM, Bill Cheeseman wjcheese...@gmail.com wrote: - (IBAction)expandAllRows:(id)sender { AWRSourceListOutlineView *outlineView = [self sourceListOutlineView]; NSIndexSet *topLevelItemIndexes = [NSIndexSet indexSetWithIndexesInRange:NSMakeRange(0, [[self sourceListContents] count] - 1)]; This leaves out the index of the last item. A range consists of a starting index and a length, _not_ the last index. Count - 1 would be appropriate for a last index, but not for a length of a range that encompasses the last index (assuming starting at 0). It was a lapse of attention on my part. I wrote it the right way the first time. Then, while working on another aspect of it, I glanced at this and had a flash that I needed to adjust by 1 because count is 1 more than the last index. You're right of course that NSMakeRange does want the count in the length parameter. Thanks for the catch. I'll respond to your other suggestion shortly. -- Bill Cheeseman - b...@cheeseman.name ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post 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: Another -[NSOutlineView autosaveExpandedItems] bug
On Jul 18, 2014, at 3:12 PM, Ken Thomases k...@codeweavers.com wrote: Is there a reason you didn't just directly enumerate the objects in the collection? Constructing an index set for all of the items, enumerating that, and then looking up the items by the index seems cumbersome. [[self sourceListContents] enumerateObjectsWithOptions:NSEnumerationReverse usingBlock:^(id obj, NSUInteger idx, BOOL *stop) { [outlineView expandItem:obj expandChildren:YES]; }]; Another lapse of attention on my part. I had been writing a similar method to enumerate selected rows, where using NSIndexSet is appropriate. I just grabbed the same code and stuck it in here. It worked, of course, but you're right that it was cumbersome. In addition, I don't need the NSEnumerationReverse option when enumerating items in the datasource instead of rows. Here's my final code: - (IBAction)expandAllRows:(id)sender { AWRSourceListOutlineView *outlineView = [self sourceListOutlineView]; NSArray *topLevelItems = [self sourceListContents]; [topLevelItems enumerateObjectsUsingBlock:^(id obj, NSUInteger itemIndex, BOOL *stop) { [outlineView expandItem:obj expandChildren:YES]; }]; } Thanks again. I don't know what I would do without you! -- Bill Cheeseman - b...@cheeseman.name ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post 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 it wrong to create relationships in -createDestinationInstancesForSourceInstance:…?
Is it wrong to create relationships in -createDestinationInstancesForSourceInstance:…? In some cases, doing so is straightforward, but in others I need to wait until -createRelationshipsForDestinationInstance:…. I'm just wondering if it's wrong to create relationships in the first phase. -- Rick Mann rm...@latencyzero.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
[Solved][Xcode 6 beta3][Swift] NSDocument addWindowController failing inexplicably
On 19 Jul 2014, at 1:50 , Bavarious bavari...@icloud.com wrote: On 18 Jul 2014, at 13:10, Philip Shaw wahspil...@gmail.com wrote: I'm writing a document-based app in Swift, with a custom view controller class, and thus had to implement my own version of makeWindowControllers. However, for some reason the call to self.addWindowControllers does nothing at all. I tried stepping into it in the debugger, but that just stepped over the line. I'm not sure if the bug is in my code or Apple's - I haven't seen any other users having this problem so I assume it is me. My document class contains the following (relevant) code: var additionalWindowController: NSWindowController! /* C */ override func makeWindowControllers() { let wc = MessageReadingViewController(windowNibName: MessageReadingViewController) wc.document = self NSLog(have %d windowControllers, self.windowControllers.count) /* A */ self.addWindowController(wc) NSLog(have %d windowControllers, self.windowControllers.count) /* A */ self.additionalWindowController = wc /* C */ wc.showWindow(self) /* B */ } Lines A both print have 0 windowControllers. Out of curiosity, what happens if you remove wc.document = self from makeWindowControllers()? addWindowController() already sets the window controller document, so you don’t need that statement. Furthermore, addWindowController() removes the window controller from its previous document in case there is one, which may be related to the behaviour you’re seeing. Thanks, yes, that fixed it. I can’t remember why I added that line, but that documentation of NSWindowController was pretty clear that I shouldn’t have. signature.asc Description: Message signed with OpenPGP using GPGMail ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post 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
Getting all source or destination instances during core data migration
According to the documentation, passing nil for the last argument to -sourceInstancesForEntityMappingNamed:destinationInstances: or -destinationInstancesForEntityMappingNamed:sourceInstances: is supposed to return all the instances. When I call these in -createDestinationInstancesForSourceInstance:…, this is true. But when I call them in -endRelationshipCreationForEntityMapping:…, I get back empty arrays. Anyone know why? -- Rick Mann rm...@latencyzero.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: How to get iOS version at runtime?
On 18 Jul 2014, at 22:24, Roland King r...@rols.org wrote: 2. these Notifications have two rects in their userInfo: UIKeyboardFrameEnd and UIKeyboardFrameBegin. In 7.1.2 these are always in the portrait orientation. To be usable one has to rotate them to the actual orientation. In 8.0 they are already in the actual orientation (much more sensible) Now I thought this was covered in one of the WWDC videos Searched the WWDC app for keyboard and got only one video from 2012, covering iOS 6. and there’s a method (perhaps one only available on iOS8) which still converted always to screen orientation for those pieces of code which needed to be compatible with ‘the old way of doing it’. There was certainly some discussion about this change which is potentially quite a breaking one and so there were some new methods of converting rectangles mentioned there. Did none of those help? They might, if I could find them. Thanks anyway. Kind regards, Gerriet. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post 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 iOS version at runtime?
On 19 Jul 2014, at 11:05 am, Gerriet M. Denkmann gerr...@mdenkmann.de wrote: On 18 Jul 2014, at 22:24, Roland King r...@rols.org wrote: 2. these Notifications have two rects in their userInfo: UIKeyboardFrameEnd and UIKeyboardFrameBegin. In 7.1.2 these are always in the portrait orientation. To be usable one has to rotate them to the actual orientation. In 8.0 they are already in the actual orientation (much more sensible) Now I thought this was covered in one of the WWDC videos Searched the WWDC app for keyboard and got only one video from 2012, covering iOS 6. and there’s a method (perhaps one only available on iOS8) which still converted always to screen orientation for those pieces of code which needed to be compatible with ‘the old way of doing it’. There was certainly some discussion about this change which is potentially quite a breaking one and so there were some new methods of converting rectangles mentioned there. Did none of those help? They might, if I could find them. well it wouldn’t be in an entire talk only about keyboards would it now. It’s either going to be in What’s new in Cocoa Touch or View Controller Advancements For iOS8 or the talk about Extensions, something like that. Thinking about it the voice on the video was Bruce Nilo I think so .. it must be the View Controller one, he usually does those. click, click There you go, entitled “Changes to Screen Coordinates”. Short section as I recall but might have something usable, at least there’s some API methods there either don’t exist on iOS7 you could check for or they are backported in which case you can use them. I watch almost all the videos every year in the months after WWDC when I’m running, or can’t sleep. I rarely remember all the details but often remember enough to think “there’s something new about that”. Bruce Nilo and Luke Heisterman are always very good, some of the others, less so, but there’s lots of meat in most of 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: How to get iOS version at runtime?
On 19 Jul 2014, at 10:36, Roland King r...@rols.org wrote: On 19 Jul 2014, at 11:05 am, Gerriet M. Denkmann gerr...@mdenkmann.de wrote: On 18 Jul 2014, at 22:24, Roland King r...@rols.org wrote: 2. these Notifications have two rects in their userInfo: UIKeyboardFrameEnd and UIKeyboardFrameBegin. In 7.1.2 these are always in the portrait orientation. To be usable one has to rotate them to the actual orientation. In 8.0 they are already in the actual orientation (much more sensible) Now I thought this was covered in one of the WWDC videos Searched the WWDC app for keyboard and got only one video from 2012, covering iOS 6. and there’s a method (perhaps one only available on iOS8) which still converted always to screen orientation for those pieces of code which needed to be compatible with ‘the old way of doing it’. There was certainly some discussion about this change which is potentially quite a breaking one and so there were some new methods of converting rectangles mentioned there. Did none of those help? They might, if I could find them. well it wouldn’t be in an entire talk only about keyboards would it now. It’s either going to be in What’s new in Cocoa Touch or View Controller Advancements For iOS8 or the talk about Extensions, something like that. Thinking about it the voice on the video was Bruce Nilo I think so .. it must be the View Controller one, he usually does those. click, click There you go, entitled “Changes to Screen Coordinates”. Short section as I recall but might have something usable, at least there’s some API methods there either don’t exist on iOS7 you could check for or they are backported in which case you can use them. Thanks. I just watched it: View Controller Advancements in iOS 8 (Session 214 under: Frameworks), which has (starting at about 5 min before the end) a section: Screen Coordinates. Quite a good talk. Kind regards, Gerriet. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post 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