Re: The use of UIActionSheet mysteriously disables our app with a white screen after memory warning.
On 19 March 2012 23:09, G S stokest...@gmail.com wrote: On Mon, Mar 19, 2012 at 9:29 AM, Rhythmic Fistman rfist...@gmail.com wrote: I have this problem too. I have a small non-storyboard project that reproduces it a TSI in progress. Woah, finally, someone else emerges! Please let us know what you discover! Does your scenario have anything in common with the one I reported, at least that you noticed? It's exactly the same. My notes: * iOS 4 doesn't seem to have the problem * it's a known issue * if you can cause a memory warning on the device then you should be able reproduce it in Photos.app via the Delete action sheet (you can't on the simulator because Photos.app has no tab bar there) * presenting the action sheet from the base tab controller works around the white screen for memory warnings before the sheet present, but not after/during * you can restore your view controller back by tabbing away then back again * a 2nd memory during the modal VC fixes things by undoing the previous bogus viewDidLoad that the action sheet causes Maybe there's a work around, but I think I'll just replace the action sheet with an alert view. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: SSL NSURLConnection to fake-cert server?
Sent from my iPad On 20 Mar 2012, at 05:16 AM, Rick Mann rm...@latencyzero.com wrote: I'm connecting to my dev server which has a self-signed cert. When I do this, NSURLConnection complains with: NSLocalizedDescription = An SSL error has occurred and a secure connection to the server cannot be made.; NSLocalizedRecoverySuggestion = Would you like to connect to the server anyway?; NSUnderlyingError = Error Domain=kCFErrorDomainCFNetwork Code=-1200 \An SSL error has occurred and a secure connection to the server cannot be made.\ My answer is, Yes!, but I don't know how to tell it. What do I need to do to? This error likely has a recovery attempted associated with it. You are supposed to use one of the -presentError:… methods to display it and let the user choose what to do. I'm using -sendAsynchronousRequest:queue:completionHandler: So I can't set a delegate. Well you can. You could switch to using the delegate-based API. -- Rick ___ 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/cocoadev%40mikeabdullah.net This email sent to cocoa...@mikeabdullah.net ___ 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: The use of UIActionSheet mysteriously disables our app with a white screen after memory warning.
On 20 March 2012 10:12, Rhythmic Fistman rfist...@gmail.com wrote: On 19 March 2012 23:09, G S stokest...@gmail.com wrote: On Mon, Mar 19, 2012 at 9:29 AM, Rhythmic Fistman rfist...@gmail.com wrote: I have this problem too. I have a small non-storyboard project that reproduces it a TSI in progress. Woah, finally, someone else emerges! Please let us know what you discover! Does your scenario have anything in common with the one I reported, at least that you noticed? It's exactly the same. My notes: * iOS 4 doesn't seem to have the problem * it's a known issue * if you can cause a memory warning on the device then you should be able reproduce it in Photos.app via the Delete action sheet (you can't on the simulator because Photos.app has no tab bar there) * presenting the action sheet from the base tab controller works around the white screen for memory warnings before the sheet present, but not after/during * you can restore your view controller back by tabbing away then back again * a 2nd memory during the modal VC fixes things by undoing the previous bogus viewDidLoad that the action sheet causes Maybe there's a work around, but I think I'll just replace the action sheet with an alert view. My UIAlertView version has exactly the same problem. Are you sure it worked for you? ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: How to get max size of view according to constraints?
On Mar 19, 2012, at 10:20 PM, Charles Srstka wrote: As everyone knows, if you have a view with a bunch of subviews and you’ve got NSLayoutConstraints set up for everything, in many cases you might end up with a minimum or maximum size for the view beyond which the constraints are impossible to satisfy, and if you try to resize the view outside these bounds either in IB or in the actual program (if the view is the content view of a resizable window, for example), the resizing will simply stop at those boundaries. I have worked with constraints in another system and one of the things I learned is that a collection of constraints must be exercised or driven from one extreme to the other in order to have confidence that they are correct. If you have a min or max size condition for the view beyond which the constraints are impossible to satisfy, but this in not what you want, then you need to change the constraints so that you get what you want under all conditions. The constraint engine is mathematically correct and does not lie. So if there is a problem, it is in how you are specifying and arranging the constraints or in the number of constraints you have. --Richard ___ 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 max size of view according to constraints?
On Mar 20, 2012, at 8:16 AM, Richard Somers wrote: On Mar 19, 2012, at 10:20 PM, Charles Srstka wrote: As everyone knows, if you have a view with a bunch of subviews and you’ve got NSLayoutConstraints set up for everything, in many cases you might end up with a minimum or maximum size for the view beyond which the constraints are impossible to satisfy, and if you try to resize the view outside these bounds either in IB or in the actual program (if the view is the content view of a resizable window, for example), the resizing will simply stop at those boundaries. I have worked with constraints in another system and one of the things I learned is that a collection of constraints must be exercised or driven from one extreme to the other in order to have confidence that they are correct. If you have a min or max size condition for the view beyond which the constraints are impossible to satisfy, but this in not what you want, then you need to change the constraints so that you get what you want under all conditions. The constraint engine is mathematically correct and does not lie. So if there is a problem, it is in how you are specifying and arranging the constraints or in the number of constraints you have. Right, but the problem is that I want to make a view that can be given arbitrary subviews at runtime, and I don’t necessarily know what its subviews and their constraints will be at compile time. What I want is a way to determine the range of sizes that this view can have, at runtime. I can find the minimum size via -fittingSize, but I can’t figure out how to get the maximum size. Specifically, what I’m trying to do is to make a constraints-aware NSScrollView. You can put whatever views you want in it, and it resizes its document view as appropriate as you resize the NSScrollView (say, by resizing the window it’s in). The idea is, it should attempt to resize the document view to match the size of the scroll view. If the user tries to resize the view smaller than what the constraints will allow, then the scroll bars appear. That part is working, but if the user tries to make the scroll view too big, then everything blows up when my code attempts to stretch the document view out. What I’m trying to find is the upper limit on the width and height according to the current set of constraints at runtime, when I don’t necessarily know what the subviews or their constraints are. 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: How is this an incorrect decrement of a reference count?
I think most of this is in the NIB loading guide and the template code for UIViewController subclases (and the code auto-generated when you add outlets in Xcode using the mouse) does this. Thanks. I'm not using ARC and won't be for this release of my app. The posted link was for the Mac OS version of the nib guide, not iOS. I'm using UIViewController derivatives in iOS. I'm not using NSNib directly; I'm just letting the OS do its thing loading the views I've set up in IB. I *am* setting the IBOutlets to nil in viewDidUnload. I *am not* releasing the IBOutlets in dealloc, and have yet to see a leak in Leaks as a result. ___ 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: SSL NSURLConnection to fake-cert server?
On Mar 19, 2012, at 10:16 PM, Rick Mann wrote: What do I need to do to? I'm using -sendAsynchronousRequest:queue:completionHandler: So I can't set a delegate. If you want more control over credentials and certificate trust, you’ll need to use the delegate API. —Jens ___ 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: The use of UIActionSheet mysteriously disables our app with a white screen after memory warning.
My UIAlertView version has exactly the same problem. Are you sure it worked for you? Yep. For some reason my business partner's iPhone 4S gets hammered with an outrageous number of memory warnings, whereas my iPhone 4 rarely does. He doesn't seem to be running anything extra in the background, either. I put extensive logging in our app that goes to a text file, recording memory warnings, view loads/unloads, and viewWillAppear/Disappear. This is how I discovered the exact time to create a warning in the simulator, finally allowing me to repro the white screen at will. Switching to the alert view eliminated the last white screen in our case. But with the ActionSheet, it was clear that the underlying screens were nillified, and whichever one was revealed ended up white. Our app has two tabs with root views, and I was able to end up with a tab bar showing but white screen for the root of the selected tab. ___ 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 is this an incorrect decrement of a reference count?
On Mar 20, 2012, at 10:48 AM, G S wrote: I *am not* releasing the IBOutlets in dealloc, and have yet to see a leak in Leaks as a result. For a myriad of arcane reasons it is fairly difficult to see UIView (or CALayers) in Leaks. That doesn't mean they will eventually be deallocated. I would look into using Heap Shots to see what you are losing by not releasing your outlets in -dealloc. -- 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
Re: How to get max size of view according to constraints?
On Tue, Mar 20, 2012, at 12:01 PM, Charles Srstka wrote: Right, but the problem is that I want to make a view that can be given arbitrary subviews at runtime, and I don’t necessarily know what its subviews and their constraints will be at compile time. What I want is a way to determine the range of sizes that this view can have, at runtime. This is precisely the problem that the constraint system solves. You can't figure it out without actually solving all constraints. I can find the minimum size via -fittingSize, but I can’t figure out how to get the maximum size. Specifically, what I’m trying to do is to make a constraints-aware NSScrollView. You can put whatever views you want in it, and it resizes its document view as appropriate as you resize the NSScrollView (say, by resizing the window it’s in). The idea is, it should attempt to resize the document view to match the size of the scroll view. If the user tries to resize the view smaller than what the constraints will allow, then the scroll bars appear. That part is working, but if the user tries to make the scroll view too big, then everything blows up when my code attempts to stretch the document view out. Tried it. I don't believe it's possible. The whole point of scroll views (actually, clip views) is that the bounds coordinate space inside them is independent of the size of the view itself. If you start drawing constraints between the contents of the scroll view and its enclosing clip view, you are violating that principle. And it winds up being a moot point because -[NSScrollView tile] just calls -setFrame: directly on the clip view. What I’m trying to find is the upper limit on the width and height according to the current set of constraints at runtime, when I don’t necessarily know what the subviews or their constraints are. I do not believe this question makes sense from the perspective of the layout system. --Kyle Sluder ___ 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 max size of view according to constraints?
On Mar 20, 2012, at 1:03 PM, Kyle Sluder wrote: Tried it. I don't believe it's possible. The whole point of scroll views (actually, clip views) is that the bounds coordinate space inside them is independent of the size of the view itself. If you start drawing constraints between the contents of the scroll view and its enclosing clip view, you are violating that principle. And it winds up being a moot point because -[NSScrollView tile] just calls -setFrame: directly on the clip view. I’m not doing that part with constraints, but with code. It’s working perfectly, except when a view has a maximum size. What I’m trying to find is the upper limit on the width and height according to the current set of constraints at runtime, when I don’t necessarily know what the subviews or their constraints are. I do not believe this question makes sense from the perspective of the layout system. Sure it does. For example, take a view that has a maximum width, per its constraints, and make it the content view of an NSWindow. Now run the app and play around with resizing the window by dragging its edges. Notice how once you try to resize it to a width greater than the view’s maximum width, NSWindow stops resizing it any wider and keeps the width at the maximum. Somehow, NSWindow has figured out the maximum width of the view and adjusted its resize requests accordingly. How does it do that? 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: SSL NSURLConnection to fake-cert server?
On Mar 20, 2012, at 10:53 , Jens Alfke wrote: On Mar 19, 2012, at 10:16 PM, Rick Mann wrote: What do I need to do to? I'm using -sendAsynchronousRequest:queue:completionHandler: So I can't set a delegate. If you want more control over credentials and certificate trust, you’ll need to use the delegate API. I had written a fairly elaborate wrapper around the delegate-based API so I could use blocks in a way similar to what the new call provides. It also returned the NSURLConnection object, and allowed canceling of a request. But I always felt like it was messy and possibly contained bugs; I was pretty happy to see Apple add their API (even if I couldn't use it to cancel a request). I just wish they'd thought it through a bit more. -- Rick —Jens ___ 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 ___ 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 max size of view according to constraints?
On Mar 20, 2012, at 11:14 AM, Charles Srstka wrote: On Mar 20, 2012, at 1:03 PM, Kyle Sluder wrote: What I’m trying to find is the upper limit on the width and height according to the current set of constraints at runtime, when I don’t necessarily know what the subviews or their constraints are. I do not believe this question makes sense from the perspective of the layout system. Sure it does. For example, take a view that has a maximum width, per its constraints, and make it the content view of an NSWindow. Now run the app and play around with resizing the window by dragging its edges. Notice how once you try to resize it to a width greater than the view’s maximum width, NSWindow stops resizing it any wider and keeps the width at the maximum. Somehow, NSWindow has figured out the maximum width of the view and adjusted its resize requests accordingly. How does it do that? It ran the constraints system, solved for the maximum size of the content view, and prevented you from resizing the NSWindow. But it knew what all the subviews were: the empty set. That's not the same as solving the constraints system without regard to subviews. --Kyle Sluder ___ 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: SSL NSURLConnection to fake-cert server?
On Mar 20, 2012, at 11:16 AM, Rick Mann wrote: I had written a fairly elaborate wrapper around the delegate-based API so I could use blocks in a way similar to what the new call provides. It also returned the NSURLConnection object, and allowed canceling of a request. But I always felt like it was messy and possibly contained bugs; I was pretty happy to see Apple add their API (even if I couldn't use it to cancel a request). I just wish they'd thought it through a bit more. Yeah, I don’t think there’s a full equivalent of the delegate API yet. And if you think about it, there are a number of different calls to app code that the connection needs to make, so a block-based equivalent would have to have several different blocks you could configure for different tasks. At that point you’ve created the moral equivalent of a class anyway, as illuminated in the famous koan[1], so it seems cleaner to use a real class to express it. —Jens [1] http://people.csail.mit.edu/gregs/ll1-discuss-archive-html/msg03277.html ___ 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 max size of view according to constraints?
On Mar 20, 2012, at 1:21 PM, Kyle Sluder wrote: It ran the constraints system, solved for the maximum size of the content view, and prevented you from resizing the NSWindow. But it knew what all the subviews were: the empty set. That's not the same as solving the constraints system without regard to subviews. Sure it is. The developers of the NSWindow object had no idea what views I was going to put into it, so they coded it to dynamically determine its min and max size based on what views it contains at runtime. I’d like to do the same thing with my view class. Running the constraints system, solving for the maximum size of the content view, and preventing the view from being resized any larger than that is *precisely* what I’d like to do. Is there any way to do this (short of iterating through the constraints and doing the math manually, which is not likely to be future-proof given that Apple could add new constraint types in the future that my view would’t know about)? 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: How is this an incorrect decrement of a reference count?
I think the link was to the Resource Programming Guide which covers both Mac OS X and iOS. You will want to look at page 17 in the PDF Legacy Patterns. If you follow David's advice and want to try Heap Shot analysis, there's a good introduction here: http://www.friday.com/bbum/2010/10/17/when-is-a-leak-not-a-leak-using-heapshot-analysis-to-find-undesirable-memory-growth/ Aaron On Mar 20, 2012, at 10:55 AM, David Duncan wrote: On Mar 20, 2012, at 10:48 AM, G S wrote: I *am not* releasing the IBOutlets in dealloc, and have yet to see a leak in Leaks as a result. For a myriad of arcane reasons it is fairly difficult to see UIView (or CALayers) in Leaks. That doesn't mean they will eventually be deallocated. I would look into using Heap Shots to see what you are losing by not releasing your outlets in -dealloc. -- 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/eeyore%40monsterworks.com This email sent to eey...@monsterworks.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 max size of view according to constraints?
On Mar 20, 2012, at 11:46 AM, Charles Srstka wrote: On Mar 20, 2012, at 1:21 PM, Kyle Sluder wrote: It ran the constraints system, solved for the maximum size of the content view, and prevented you from resizing the NSWindow. But it knew what all the subviews were: the empty set. That's not the same as solving the constraints system without regard to subviews. Sure it is. The developers of the NSWindow object had no idea what views I was going to put into it, so they coded it to dynamically determine its min and max size based on what views it contains at runtime. I’d like to do the same thing with my view class. NSWindow runs the constraint system on its view hierarchy, and then constrains the size of the window the size computer for its content view. Running the constraints system, solving for the maximum size of the content view, and preventing the view from being resized any larger than that is *precisely* what I’d like to do. Is there any way to do this (short of iterating through the constraints and doing the math manually, which is not likely to be future-proof given that Apple could add new constraint types in the future that my view would’t know about)? The formulation of your question led me to believe you wanted to run the constraints system on a view without care for the subviews it contained. Of course NSWindow doesn't know what's contained within its contentView; including that bit in your question is a bit misleading. Does calling -layoutSubtreeIfNeeded not do what you want? --Kyle Sluder ___ 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 is this an incorrect decrement of a reference count?
On Mar 20, 2012, at 12:19 PM, Eeyore wrote: I think the link was to the Resource Programming Guide which covers both Mac OS X and iOS. You will want to look at page 17 in the PDF Legacy Patterns. Sorry, I meant: You will want to look at the section Legacy Patterns on page 17 of the PDF version of the Guide. There isn't a Legacy Pattern PDF. Aaron ___ 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
Odd initial save behavior with bundle based NSDocument
Hi All, I'm seeing something a bit odd with NSDocument in 10.7. We're writing large files to our own package, so as a result I've overridden: - (BOOL) writeToURL:ofType:forSaveOperation:originalContentsURL:error: - (BOOL)readFromURL:ofType:error: + (BOOL) autosavesInPlace - is fixed to return YES. We have a single index file at the root of the bundle, plus a subfolder called assets, which while initially empty will get filled with files as we do stuff with the document. Note: the addition of files to this folder can and does occur outside of specific calls to the document. Now, what I'm seeing is this: 1) Make a new doc 2) Put some additional files within the assets folder of the doc 3) Save the new (presently Untitled) doc to the Desktop 4) Result: The saved doc *no longer contains the asset file* What I understand (according to the NSDocument headers) is that writeSafelyToURL:ofType:forSaveOperation:error: is supposed to do a bunch-o-stuff (as outlined in the headers). And, importantly, at the end 4) Moves the just-written file to its final location, or deletes the old on-disk revision of the document, and deletes any temporary directories, depending on the same factors listed for step 1. I can see our write call made, to the unsaved doc in ~/Library/Autosave Information/. If I open this bundle in Finder, the contents are saved just fine, and there is a single asset in the assets folder. This is expected. However; it doesn't get moved (point 4 above) correctly. When I open the moved document on the Desktop, it's got it's index file, and an assets folder, but there are NO assets inside that folder. It's like the move operation moved everything at level 1, and didn't take into account subfolders. Any ideas? -- Neil Clayton ___ 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
UIPickerView joy
I just noticed something lovely in iOS 4.x and UIPickerView related and am looking to confirm with the group It appears that setting the height of a UIPicker ist verboten. I've run in iOS 4.x and 5.0 in the simulator and on devices and it appears that the height is somewhat fixed - in most cases. Also, a quick googling brings up this note: Also there are 3 valid heights for UIDatePicker (and UIPickerView) 162.0, 180.0, and 216.0. If you set a UIPickerView height to anything else you will see the following in the console when debugging on an iOS device. However, on iOS 4.x, it appears that there is some exception to the height in that it can't be set to any of the smaller values. Is there any special mojo that needs to be done with setting UIPickerView frames? Must all the CGRectMake values be floats? TIA, - Alex Zavatone ___ 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 is this an incorrect decrement of a reference count?
OK, thanks for the info and reference material. ___ 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
NSDate interval formatting
Hello all, I'm looking for a way to determine how a locale would like to have date intervals formatted. NSDateFormatter has a cool method (+dateFormatFromTemplate:options:locale:) that produces a date format string that can be used to format dates where you only know which components you want to use. Works great but doesn't help for intervals such as weekly intervals. Those can look quite different in different locales like: en_US: March 19 - 25, 2012 de_AT: 19. - 25. März, 2012 fr_FR: 19 - 25 mars 2012 so you can't make concatenation work. Even more so as there are locales that display the same interval in reversed order. Also, +dateFormatFromTemplate:options:locale: doesn't produce proper punctuation in case you feed only a @d as template, which makes it even more difficult. Does the system know about standard interval formatting? If so, is there a way to extract that information? Generally the Unicode LOCALE DATA MARKUP LANGUAGE (Unicode Technical Standard #35) guide is pretty silent on interval formatting, so is there even a definition for it? Regards Markus -- __ Markus Spoettl ___ 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
further confusion regarding the release of controls loaded from a nib
The Apple doc for iOS says: From a practical perspective, in iOS and OS X outlets should be defined as declared properties. Outlets should generally be weak, except for those from File’s Owner to top-level objects in a nib file (or, in iOS, a storyboard scene) which should be strong. Outlets that you create should will therefore typically be weak by default because: - Outlets that you create to, for example, subviews of a view controller’s view or a window controller’s window, are arbitrary references between objects that do not imply ownership. This just adds more confusion. If the properties for the majority of IBOutlets are weak (since they're usually all going to be owned by the UIViewController's view), why would we release them in dealloc? That seems like an error. And setting them all to nil in viewDidUnload wouldn't seem to have any effect, other than simply being good practice for safety. ___ 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: further confusion regarding the release of controls loaded from a nib
On Mar 20, 2012, at 1:49 PM, G S wrote: This just adds more confusion. If the properties for the majority of IBOutlets are weak (since they're usually all going to be owned by the UIViewController's view), why would we release them in dealloc? If you aren't using ARC, then you couldn't have declared them weak, and most likely declared them as retain. As such you are responsible for releasing them. -- 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
Re: further confusion regarding the release of controls loaded from a nib
The material quoted is post-ARC usage (not the use of weak and not assign). In the legacy paradigm material, you will see that pre-ARC. You can choose retain or assign (or copy, but I'll leave that out here). iOS outlets should be held as retain, and therefore need to be nil-ed in viewDidUnload (so that they can be released in low memory situations) and released in dealloc (or they will leak). You probably don't want to use assign because then if your view unloads, your outlets will be pointing at garbage until your view is reloaded. In iOS 4 ARC, the choices are strong (retain equivalent), unsafe_unretained (assign equivalent). Here, outlets should be strong but you will no longer need to call release in dealloc since ARC handles that. You will need to nil them in viewDidUnload (so that they can be released in low memory situations). You probably wouldn't want to use unsafe_unretained for the same reasons as above. In iOS 5 ARC, you can also use weak. Weak acts like assign except that the references will be automatically nil-ed when the object is released. Here, outlets should be weak. So when your view gets unloaded, your outlets will get deallocated (as you aren't holding on to them with strong), but ARC will magically nil your outlets so there is no chance that you will try access a zombie. Aaron On Mar 20, 2012, at 1:49 PM, G S wrote: The Apple doc for iOS says: From a practical perspective, in iOS and OS X outlets should be defined as declared properties. Outlets should generally be weak, except for those from File’s Owner to top-level objects in a nib file (or, in iOS, a storyboard scene) which should be strong. Outlets that you create should will therefore typically be weak by default because: Outlets that you create to, for example, subviews of a view controller’s view or a window controller’s window, are arbitrary references between objects that do not imply ownership. This just adds more confusion. If the properties for the majority of IBOutlets are weak (since they're usually all going to be owned by the UIViewController's view), why would we release them in dealloc? That seems like an error. And setting them all to nil in viewDidUnload wouldn't seem to have any effect, other than simply being good practice for safety. ___ 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 max size of view according to constraints?
On Mar 20, 2012, at 2:26 PM, Kyle Sluder wrote: NSWindow runs the constraint system on its view hierarchy, and then constrains the size of the window the size computer for its content view. Yes! I’d like a way to do the same thing, and get at that computed size. Running the constraints system, solving for the maximum size of the content view, and preventing the view from being resized any larger than that is *precisely* what I’d like to do. Is there any way to do this (short of iterating through the constraints and doing the math manually, which is not likely to be future-proof given that Apple could add new constraint types in the future that my view would’t know about)? The formulation of your question led me to believe you wanted to run the constraints system on a view without care for the subviews it contained. Of course NSWindow doesn't know what's contained within its contentView; including that bit in your question is a bit misleading. Since I explicitly said I don’t know what views are going to be there _at compile time_, I don’t think it’s actually misleading at all. The reason I put that bit there was because the first person who replied misunderstood my question and thought I was doing something with a fixed set of subviews. Does calling -layoutSubtreeIfNeeded not do what you want? Not really. Let’s say we have an NSView with the following size limitations imposed by its subviews: 100 = width = 300 200 = height = 400 If you have this view open in Interface Builder, you can drag it around to resize it, and IB will let you give it any size in between { 100, 200 } and { 300, 400 }. If you try to make the width smaller than 100, it will change the width to 100, and if you try to make the width larger than 300, then it will set the width to 300, but within those limitations, it will let you make the view size anything you want. This is what I’m trying to do. The -layoutSubtreeIfNeeded method, in contrast, always seems (at least in my testing) to change everything to the minimum allowed size. So for the example above, if you set the view to have the size { 200, 300 }, it would change that to { 100, 200 }, despite { 200, 300 } being a perfectly legal size under those constraints. I don’t want to find what the system thinks is the “one true” size — I’m just trying to figure out the limits so I can keep the sizes legal, that’s all. 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: further confusion regarding the release of controls loaded from a nib
Thanks. I didn't know whether they meant weak as a keyword necessarily, or simply the concept of a weak reference. ___ 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 max size of view according to constraints?
On 20 Mar 2012, at 21:12, Charles Srstka wrote: The -layoutSubtreeIfNeeded method, in contrast, always seems (at least in my testing) to change everything to the minimum allowed size. So for the example above, if you set the view to have the size { 200, 300 }, it would change that to { 100, 200 }, despite { 200, 300 } being a perfectly legal size under those constraints. I don’t want to find what the system thinks is the “one true” size — I’m just trying to figure out the limits so I can keep the sizes legal, that’s all. Charles I am getting a bit befuddled. Is the following what we have: 1. A certain view hierarchy managed by a set of constraints. 2. A certain Charles, who wishes to programatically modify (maximise?) the size of one (or more) of the managed views in such a way that it doesn't cause a layout exception. 3. In order to perform 2, Charles wants to be able to query the layout for a given view to determine its (maximum?) allowed size. Regards Jonathan Mitchell Mugginsoft LLP ___ 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: UIPickerView joy
Only the three heights you identified are supported. There isn't special sauce for getting around that, though enforcement wasn't always there in the past. Luke On Mar 20, 2012, at 1:05 PM, Alex Zavatone wrote: I just noticed something lovely in iOS 4.x and UIPickerView related and am looking to confirm with the group It appears that setting the height of a UIPicker ist verboten. I've run in iOS 4.x and 5.0 in the simulator and on devices and it appears that the height is somewhat fixed - in most cases. Also, a quick googling brings up this note: Also there are 3 valid heights for UIDatePicker (and UIPickerView) 162.0, 180.0, and 216.0. If you set a UIPickerView height to anything else you will see the following in the console when debugging on an iOS device. However, on iOS 4.x, it appears that there is some exception to the height in that it can't be set to any of the smaller values. Is there any special mojo that needs to be done with setting UIPickerView frames? Must all the CGRectMake values be floats? TIA, - Alex Zavatone ___ 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/luketheh%40apple.com This email sent to luket...@apple.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: How to get max size of view according to constraints?
On Mar 20, 2012, at 4:29 PM, jonat...@mugginsoft.com wrote: I am getting a bit befuddled. Is the following what we have: 1. A certain view hierarchy managed by a set of constraints. Yes. 2. A certain Charles, who wishes to programatically modify (maximise?) the size of one (or more) of the managed views in such a way that it doesn't cause a layout exception. Close. A certain Charles, who wishes to make a generalized view that will allow the user to resize it as he or she wishes, but needs to make sure the size is legal in order to avoid throwing exceptions, flooding the console with warnings, and otherwise being bad. And since this is a generalized view, the certain Charles needs to cover the corner cases, one being when the view has a maximum size. 3. In order to perform 2, Charles wants to be able to query the layout for a given view to determine its (maximum?) allowed size. Yes, in order to perform 2, a certain Charles wants to be able to query for both the minimum and maximum size (he’s already got the minimum), so he can be sure the size that the user wants to set is within those boundaries. This way, if a bad size comes from the user, the certain Charles can adjust it. But in these situations, Charles wants to make the size as close to what the user asked for as is possible. Think what happens when a certain Jonathan resizes a view with constraints by dragging its edges around in IB. That’s what Charles wants to do. Ugh, too much use of the third person makes Charles nauseous. Not going to do that again. :-D 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: further confusion regarding the release of controls loaded from a nib
OK, I think I know why there weren't any leaks. Per (possibly old) examples, I have IBOutlet in both the member-variable declarations and the property declarations. Now I'm realizing that IB will show two outlets: one for the member variable itself, and one for the property when you have this: @synthesize webView=_webView All of my connections in IB are still made to the member variables. So are the properties not being used by NSNib? My guess is that they aren't, and thus the controls aren't being retained. ___ 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: further confusion regarding the release of controls loaded from a nib
Set breakpoints on them and right after them and when you hit them see: 1) what their values are 2) if they ever get hit at all. That should help you get to the bottom of what's being used when. On Mar 20, 2012, at 5:50 PM, G S wrote: OK, I think I know why there weren't any leaks. Per (possibly old) examples, I have IBOutlet in both the member-variable declarations and the property declarations. Now I'm realizing that IB will show two outlets: one for the member variable itself, and one for the property when you have this: @synthesize webView=_webView All of my connections in IB are still made to the member variables. So are the properties not being used by NSNib? My guess is that they aren't, and thus the controls aren't being retained. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/zav%40mac.com This email sent to z...@mac.com - Alex Zavatone ___ 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
Serial I/O over USB
I'm just looking for a quick pointer to a class or external unix program to use to do simple serial communication over USB. I want to make a small utility to go with an Arduino project but I'm not sure where to start. I can use the Arduino built-in serial monitor, but that only prints the serial characters to the screen, and the data can't be saved. I want to graph the data in real time (that part isn't relevant to my question however). --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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Serial I/O over USB
On Mar 20, 2012, at 4:23 PM, Graham Cox wrote: I'm just looking for a quick pointer to a class or external unix program to use to do simple serial communication over USB. I want to make a small utility to go with an Arduino project but I'm not sure where to start. I can use the Arduino built-in serial monitor, but that only prints the serial characters to the screen, and the data can't be saved. I want to graph the data in real time (that part isn't relevant to my question however). http://sourceforge.net/projects/amserial/ Nick Zitzmann http://www.chronosnet.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 max size of view according to constraints?
Hello Charles, It sounds like you have the idea that constraints establish a minimum and maximum size on a window (or view), and the window is free to take on any size within that range. When you resize a window, it evaluates the constraints at the proposed size. If would make the constraints invalid then it limits the size. This isn't quite right. In fact, a window has the size it has because it is constrained to be exactly that size. If there is wiggle room we would say the constraints are ambiguous because they do not fully specify the size. That's considered a programming error. As the user resizes a window by dragging it, AppKit modifies those constraints. These constraints have the priority NSLayoutPriorityWindowSizeStayPut. If there are other constraints with higher priority, they take precedence, and will limit the window size. There is no explicit max size calculation: the max size falls out of the constraints. So to answer your question, in most cases it is a bad idea to try to figure out the maximum size of a view. It is also a bad idea to call setFrame:, because that will be immediately undone the next time -layout runs. Instead, you should create width and height constraints for the view, set them, call -layoutIfNeeded, and then inspect the resulting size. If you want to allow certain other constraints to limit the size, then set a priority for your constraint that is lower than that of those other constraints. By the way, fittingSize does not correspond to the view's minimum size, for the same reason. Hope that helps, -Peter On Mar 19, 2012, at 9:20 PM, Charles Srstka cocoa...@charlessoft.com wrote: As everyone knows, if you have a view with a bunch of subviews and you’ve got NSLayoutConstraints set up for everything, in many cases you might end up with a minimum or maximum size for the view beyond which the constraints are impossible to satisfy, and if you try to resize the view outside these bounds either in IB or in the actual program (if the view is the content view of a resizable window, for example), the resizing will simply stop at those boundaries. What I am having trouble figuring out is how to resize such a view in code in such a way that it will respect the constraints. If I try just setting a frame using -setFrame: with a rect which has an illegal size, NSView is all too happy to do that, and then I get an exception and a flood of console warnings about how I just broke my constraints. Now, getting the view’s minimum size by calling -fittingSize and adjusting my frame accordingly is easy enough, but some views can have a maximum size imposed by constraints as well, and I’m having trouble finding a way to find out what it is in code. I know that this has to be possible, since Interface Builder and NSWindow are both able to gracefully handle cases where one tries to set a frame size outside the boundaries of what the constraints allow, but I haven’t been able to find any -maximumSize or -adjustedSizeForSize: type methods, or any way to figure this out short of wrapping -setFrame: in an exception handler. I’m sure it’s gotta be something fairly obvious, and I’ll probably be embarrassed by the answer, but at the moment I’m a bit stuck. Anyone know how to do this? Thanks, 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
SOLVED Re: How to get max size of view according to constraints?
Sweet! I’ve found the solution to my own problem. Here it is, in case someone else finds this thread wondering the same thing. What I was trying to do was to keep track of the NSScrollView being resized, and adjust the size of its document view as needed. Toward this end, I was trying to determine the min and max allowed size, grab the scroll view’s documentVisibleRect, adjust the size to avoid angering the constraint gods, and then set the frame on the document view. I had figured the solution to this would be something fairly simple and embarrassing, and sure enough it was. During a rewatching of the WWDC 2011 video on Cocoa Auto Layout in order to figure out the cause of some other weird bugs I was seeing, I noticed something I’d glossed over before: when using constraints, you are not supposed to call setFrame: on any of your views, but are instead supposed to set constraints that tell the autolayout system what the position and size should be. And of course, once I set about doing that, I remembered that these constraints can have priorities — so, all I had to do was to set the width and height to what I wanted them to be with their priorities set to NSLayoutPriorityDragThatCanResizeWindow, and all’s well! The view gets the size I tell it if it’s legal, and adjusts it if it’s not. Perfect. 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: How to get max size of view according to constraints?
On Mar 20, 2012, at 10:01 AM, Charles Srstka wrote: On Mar 20, 2012, at 8:16 AM, Richard Somers wrote: On Mar 19, 2012, at 10:20 PM, Charles Srstka wrote: As everyone knows, if you have a view with a bunch of subviews and you’ve got NSLayoutConstraints set up for everything, in many cases you might end up with a minimum or maximum size for the view beyond which the constraints are impossible to satisfy, and if you try to resize the view outside these bounds either in IB or in the actual program (if the view is the content view of a resizable window, for example), the resizing will simply stop at those boundaries. I have worked with constraints in another system and one of the things I learned is that a collection of constraints must be exercised or driven from one extreme to the other in order to have confidence that they are correct. If you have a min or max size condition for the view beyond which the constraints are impossible to satisfy, but this in not what you want, then you need to change the constraints so that you get what you want under all conditions. The constraint engine is mathematically correct and does not lie. So if there is a problem, it is in how you are specifying and arranging the constraints or in the number of constraints you have. Right, but the problem is that I want to make a view that can be given arbitrary subviews at runtime, and I don’t necessarily know what its subviews and their constraints will be at compile time. What I want is a way to determine the range of sizes that this view can have, at runtime. I can find the minimum size via -fittingSize, but I can’t figure out how to get the maximum size. Specifically, what I’m trying to do is to make a constraints-aware NSScrollView. You can put whatever views you want in it, and it resizes its document view as appropriate as you resize the NSScrollView (say, by resizing the window it’s in). The idea is, it should attempt to resize the document view to match the size of the scroll view. If the user tries to resize the view smaller than what the constraints will allow, then the scroll bars appear. That part is working, but if the user tries to make the scroll view too big, then everything blows up when my code attempts to stretch the document view out. What I’m trying to find is the upper limit on the width and height according to the current set of constraints at runtime, when I don’t necessarily know what the subviews or their constraints are. Here's how I'd recommend approaching the scroll view example via constraints. 1. Establish a required constraint that says your document view's top equals the scroll view's top. 2. Establish another constraint that says the height of the document view equals the height of the scroll view. Give this constraint a priority lower than required. What its priority should be depends on how tightly you want the document view to fill the scroll view, i.e. which other constraints it should be allowed to break. By choosing a priority lower than Required, it will not break required constraints amongst the subviews, and so it will not cause exceptions. You should be able to do all this without ever calling setFrame: or fittingSize. Hope this helps. Feel free to ask more questions. Auto layout is very powerful, but requires a different way of thinking than the old setFrame: approach. -Peter ___ 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 max size of view according to constraints?
On Mar 20, 2012, at 7:00 PM, Peter Ammon wrote: 2. Establish another constraint that says the height of the document view equals the height of the scroll view. Give this constraint a priority lower than required. What its priority should be depends on how tightly you want the document view to fill the scroll view, i.e. which other constraints it should be allowed to break. This sounds great in concept, but the height I want (if the constraints will allow it) is the scroll view’s documentVisibleRect, not its frame, since the latter includes the size of the scroll bars if they’re visible, and I don’t think that’s doable directly via constraints. However, watching the scroll view’s NSViewFrameDidChangeNotification and manually adding non-required constraints to the size I get from -documentVisibleRect (and clearing out those constraints the next time) works like a champ. As you point out, the mistake I was making before was calling setFrame: here instead of doing this via constraints. Thanks! 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: further confusion regarding the release of controls loaded from a nib
I went through and removed all the IBOutlet notation from the members and reconnected everything to the properties in IB. Also added release calls for all the controls in dealloc. The app appears to be quite solid, with no leaks or analyzer issues detected. I'm calling it done! Needless to say, it seems like ARC was a desperately needed step forward. I don't mind doing things the right way and I have a high tolerance for syntactic tedium, but the invisibility of NSNib's usage of properties and the resulting asymmetry of the code (a bunch of releases in dealloc with no corresponding allocations) is just asking for trouble. Compounding this mess was IB's wretchedly defective display of outlets. If you rename members, or remove their IBOutlet notations, the three lists of outlets in IB are wildly wrong and will actually change before your eyes with no user interaction. Outlets will appear and disappear from the two context menus on File Owner and from the Inspector seemingly at random. IB simply used to crash in this situation (reconnecting renamed members to controls), but that was fixed in 4.3.1 (Radar 10780292 filed, confirmed, and returned to me for verification). Then there's the display of redundant outlets if you've put IBOutlet on both the member and the property as was shown in examples in the past. IB should take @synthesize aProperty=_aProperty into account. ___ 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: further confusion regarding the release of controls loaded from a nib
On Mar 20, 2012, at 5:33 PM, G S wrote: Needless to say, it seems like ARC was a desperately needed step forward. I don't mind doing things the right way and I have a high tolerance for syntactic tedium, but the invisibility of NSNib's usage of properties and the resulting asymmetry of the code (a bunch of releases in dealloc with no corresponding allocations) is just asking for trouble. You said you're using UIViewController. NSNib is a Mac OS X only class. UINib is the iOS counterpart, and it has much saner behavior. So which are you actually using? It's important to be very precise. --Kyle Sluder ___ 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: further confusion regarding the release of controls loaded from a nib
I'm doing an iPhone app. I'm not doing any Mac app. I should simply have said the nib-loading behavior. ___ 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: further confusion regarding the release of controls loaded from a nib
On Mar 20, 2012, at 5:59 PM, G S wrote: I'm doing an iPhone app. I'm not doing any Mac app. I should simply have said the nib-loading behavior. Except the nib loading behavior is vastly different on the two operating systems. This is why the documentation goes into detail about both. --Kyle Sluder ___ 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: further confusion regarding the release of controls loaded from a nib
Well, my code doesn't show things being allocated and assigned to the IBOutlets, but it shows a bunch of releases of the associated members. As far as I can gather, the code is now correct. It is this asymmetry that strikes me as messy and error-prone. ___ 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
NSFileOwnerAccountName will not assign to root
Does anyone know why the assignment of NSFileOwnerAccountName and NSFileGroupOwnerAccountName does not work? The directory created defaults to my account and the staff group. NSFileManager *fileManager = [NSFileManager defaultManager]; NSMutableDictionary *attr = [NSMutableDictionary dictionary]; [attr setObject:@root forKey:NSFileOwnerAccountName]; [attr setObject:@wheel forKey:NSFileGroupOwnerAccountName]; [attr setObject:[NSNumber numberWithInt:0755] forKey:NSFilePosixPermissions]; [fileManager createDirectoryAtPath:dir withIntermediateDirectories:TRUE attributes:attr error:error]; ___ 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: NSFileOwnerAccountName will not assign to root
On 20 Mar 2012, at 8:52 PM, Prime Coderama wrote: Does anyone know why the assignment of NSFileOwnerAccountName and NSFileGroupOwnerAccountName does not work? The directory created defaults to my account and the staff group. NSFileManager *fileManager = [NSFileManager defaultManager]; NSMutableDictionary *attr = [NSMutableDictionary dictionary]; [attr setObject:@root forKey:NSFileOwnerAccountName]; [attr setObject:@wheel forKey:NSFileGroupOwnerAccountName]; [attr setObject:[NSNumber numberWithInt:0755] forKey:NSFilePosixPermissions]; [fileManager createDirectoryAtPath:dir withIntermediateDirectories:TRUE attributes:attr error:error]; Standard UNIX privileges, which I don't have time or space to treat in full. You can't change the owner of a file, or act as another owner, without obtaining root/admin privileges. You can UNIX permissions by Google. On OS X, look up Security.framework. — 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
UIBezierPath stroke oddity
In an attempt to figure out how well gesture recognizers work, I've built a very simple app that uses a UIPanGestureRecognizer and using them to construct a UIBezierPath that I then stroke, but I am getting strange artifacts on the resulting drawing operation (see http://cl.ly/0N2R411O1t1x3w2N3Q3q for example). The code I use is fairly simple; I start with a call to -moveToPoint:, followed by a bunch of -addLineToPoint: calls. Other than the fact that I am recording the points using touch, there is nothing unusual in the code (that I can see): - (void) pannedRefineEdge:(UIPanGestureRecognizer *) recognizer { switch (recognizer.state) { case UIGestureRecognizerStateBegan: _path = [[UIBezierPath alloc] init]; [_path moveToPoint:[recognizer locationInView:self.backgroundView]]; break; case UIGestureRecognizerStateChanged: [_path addLineToPoint:[recognizer locationInView:self.backgroundView]]; break; case UIGestureRecognizerStateEnded: // This calls a function that sets up an image drawing context and then: _path.lineCapStyle = kCGLineCapRound; _path.lineJoinStyle = kCGLineJoinRound; _path.lineWidth = 10.0; [[UIColor colorWithRed:1.0 green:0.6 blue:0.6 alpha:1.0] setStroke]; [_path stroke]; break; default: break; } } Any ideas what could be causing the problem? Thanks, Marco ___ 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: Missing header files/folders?
On 07/10/2011, at 4:42 PM, Joar Wingfors wrote: On 6 okt 2011, at 22:38, Jens Alfke wrote: On Oct 6, 2011, at 9:09 PM, Shane Stanley wrote: I've just bought a new Mac, and after migrating and updating I notice that inside the frameworks in /System/Library/Frameworks/, the Headers link and Headers folder that appear on my old Mac are not to be found on my old one. Should they be there, or are the ones on my old Mac a relic of systems past? I have them, and I just reinstalled my OS recently. Did you install Xcode yet? They might not be part of the base OS install. All the bits and pieces of an Xcode install doesn't survive a migration. You have to reinstall Xcode. j o a r This has come up again. I have a customer who has upgraded to Lion from Snow Leopard, and there are no header files (which my app uses) in his /System/Library/Frameworks/. But there is no option to reinstall Xcode with Xcode 4.3. Should I be trying to use the header files in the Xcode bundle instead? And is there some reason the .bridgesupport files aren't getting installed in the BridgeSupport folder in the frameworks in the Xcode bundle? -- Shane Stanley sstan...@myriad-com.com.au 'AppleScriptObjC Explored' www.macosxautomation.com/applescript/apps/ ___ 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: Missing header files/folders?
On Mar 20, 2012, at 9:20 PM, Shane Stanley wrote: This has come up again. I have a customer who has upgraded to Lion from Snow Leopard, and there are no header files (which my app uses) in his /System/Library/Frameworks/. But there is no option to reinstall Xcode with Xcode 4.3. You can't rely on headers being present in the actual system frameworks. Should I be trying to use the header files in the Xcode bundle instead? Yes. If your app needs to locate framework headers at runtime for some reason, it should probably do something like running xcode-select -print-path via NSTask, to find the Developer folder, then locating the SDK relative to that. —Jens ___ 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