Re: Stupid objective-c question
On 23 Sep 2016, at 9:49 PM, Uli Kustererwrote: > > Are you sure? I only learned Cocoa when it came to OS X, but my impression > was that, while KVC came from NeXT, KVO arrived with bindings … that would > have been 10.3 or 10.4-ish? As I remember, when KVO was introduced, it was framed as a bottleneck for implementing bindings. Foundation exposed it as a courtesy to developers who would find it useful in itself. Cocoa practice has changed since then, but that’s what I gathered at the time. You’re right, KVC was NeXTStep. The patent on it was one of NS/Apple’s crown jewels. — 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
Re: Launching iOS 10 supported build using Xcode 7
On 9 Sep 2016, at 11:25 AM, Devarshi Kulshreshthawrote: > > We have a thoroughly tested build on iOS9 using Xcode 7 swift 2.2, we are > planning to release it on 16th of this month, since iOS10 will be released > on 13th wanted to know that can we still release the build (iOS10 > compatible) using Xcode 7 without upgrading it to swift 2.3? > > Please suggest. The only announcement about Xcode 8 and app submissions is that the App Store will now _accept_ submissions built with Xcode 8, not that support for Xcode 7 has ended on 10 days’ notice. Apple knows very well it would be unreasonable to expect otherwise; no developer would tolerate it. (You asked the question because you yourself wouldn’t tolerate it.) Historically, Apple does cut off support for any but the current Xcode, but it won’t happen until well into the new year. It would warn of the change months in advance. — 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
Re: C callbacks with NSNotificationCenter?
“dangerwillrobinsondanger” correctly points to Core Foundation. I’m embarrassed to have forgotten — it should be very helpful to you, assuming it mixes with AVFoundation. > On 7 Sep 2016, at 11:33 AM, じょいすじょん> wrote: > > Have you considered Core Foundation? > > https://developer.apple.com/library/ios/documentation/CoreFoundation/Reference/CFNotificationCenterRef/ > It is all C > > Another alternative is to look at the Objective-C runtime library routines. > You can do a lot with the language from C... > >> On 2016 Sep 8, at 1:09, Andreas Falkenhahn wrote: >> >> As a C programmer I'm trying to avoid Objective C whenever and wherever >> possible. >> The good thing is that I can do most interaction with Cocoa from normal C >> functions. >> I only had to write very few classes. Most of the Cocoa stuff can be done >> from normal C functions just fine. >> >> Now I'd like to subscribe to the AVPlayerItemDidPlayToEndTimeNotification >> notification. In an Objective C class, this is purportedly done like this: >> >> [[NSNotificationCenter defaultCenter] addObserver:self >> selector:@selector(itemDidFinishPlaying:) >> name:AVPlayerItemDidPlayToEndTimeNotification object:playerItem]; >> >> This will call the "itemDidFinishPlaying" method in class "self" whenever >> an AVPlayerItem has finished playing. >> >> Of course, I can't use this code in a normal C function because there are >> references to "self" and the selector thing doesn't look like it's >> compatible to >> C. So I could just subclass AVPlayerItem and voila, everything's fine. >> >> Still, I'm wondering: Is it also possible to have NSNotificationCenter call >> a C function for me whenever the notification triggers? Can this somehow >> be achieved or am I forced to use full Objective C here? >> >> -- >> Best regards, >> Andreas Falkenhahn mailto:andr...@falkenhahn.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: C callbacks with NSNotificationCenter?
> On 7 Sep 2016, at 11:09 AM, Andreas Falkenhahnwrote: > > As a C programmer I'm trying to avoid Objective C whenever and wherever > possible. > The good thing is that I can do most interaction with Cocoa from normal C > functions. > I only had to write very few classes. Most of the Cocoa stuff can be done > from normal C functions just fine. I shall little more than observe that “C programmer” is an odd definition of a professional identity. To my ear (not knowing you well), it’s like saying “I drink liquids.” I kind of get it, as I claim an identity as an Apple-platform developer, but I’d argue it describes a different kind of expertise, and in my case a strong political tendency. Drawing the line at C surprises me. Now let me actually respond to what you wrote. > Still, I'm wondering: Is it also possible to have NSNotificationCenter call > a C function for me whenever the notification triggers? Can this somehow > be achieved or am I forced to use full Objective C here? NSNotificationCenter has a method in the form of addObserver: ... using:, which takes a block. Blocks can contain pure C. I’d bet you’d normally consider anything gcc accepts (as an extension to the C parser) to be your idea of C. The older form takes a selector. Selectors are keys for dispatching through an Objective-C class to its methods. I know of no supported way to dispatch a method selector without a class to select the method from. (Unless you hack the C runtime by… reimplementing the Objective-C runtime and hoping you’ve covered all architectures and runtimes.) — 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
Re: UIStackView: Variable Spacing
Confirming that your concern is now Auto Layout overhead? --- Long, long ago, when there were no iPads or Auto Layout (2009?), the scrolling-performance session at WWDC said if your cells had nontrivial subview trees, and the table was stuttering, bite the bullet and start aggregating subview nodes into monoliths that you lay out and draw yourself. iOS devices are an order of magnitude faster now, but that doesn’t solve the problem in principle, just puts it off. --- Obviously it’s a lot of work to code (and maybe to execute — you’ll have to use trial-and-error to find an ad-hoc solution); ad-hoc makes refactoring harder; you’ll be spending your vacations in Caching Inferno; etc. You’d sacrifice Make it Right for Make it Fast. That’s supposed to be a smell, but in this case Make it Fast _is_ Make it Work. I don’t know nearly enough about your application to say whether it’s an option. I’ve had reasonable success with splitting the difference and replacing leaf views with layers to relieve the combinatorial explosion AL risks. --- If Auto Layout has no combinatorial risks, or surprisingly few, I’d be fascinated to know why. — F > On 6 Jul 2016, at 6:56 PM, Daniel Stenmarkwrote: > > It’s not so much that adding a single dummy view wrecks us. Our cell layout > has a lot going on, with a fair amount of variable spacing and multiple views > often being hidden and swapped out. The UIStackView scrolling performance > slog I’m seeing is just sum of all that. > > Sigh, oh well. I guess that’s just another refactoring branch I’ll have to > shelve for now. > > Dan > >> On Jul 6, 2016, at 4:45 PM, Roland King wrote: >> >> >>> On 7 Jul 2016, at 04:37, Daniel Stenmark wrote: >>> >>> What’s the best way to achieve variable spacing between children of a >>> UIStackView? I know that a popular approach is to add an empty dummy view >>> to act as padding, but this is being used in a UITableView cell, so >>> scrolling performance is critical and the implicit constraints created by >>> adding a ‘padding’ view are a death knell for us. >>> >>> Dan >> >> >> There’s no trick way to do it, you need some extra view one way or another. >> >> It’s a bit surprising that adding extra, fixed sized children to the stack >> really adds that much overhead, that’s a few very simple constraints, all >> constant, and shouldn’t really make that much difference. Perhaps the >> stackview is being inefficient with the number of constraints it adds when >> you add an extra child. You could take a look at the view hierarchy and see >> if that’s the case or not. >> >> You could try going the other way around and making your real elements >> children of dummy views so you get to add the simplest top/bottom-padding >> constraints possible to those views, that may minimise the number of extra >> constraints added and you get to control it somewhat. But if your hierarchy >> is such that it’s straining the constraint system performance wise, whatever >> way you try to do this is going to have similar performance. > > > ___ > > 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/fritza%40manoverboard.org > > This email sent to fri...@manoverboard.org ___ 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: NSAlert and threading
On 23 May 2016, at 4:14 PM, Tom Doanwrote: > > I have an menu operation which, before it fully executes, pops up > an NSAlert asking a Yes/No question ("Selection Only(Y/N)?") then, > depending upon the answer will either apply to the whole list or just > the selection. However, no matter what I do (other than putting the > operation in a separate thread), the alert box stays on the screen > until the operation is done. release doesn't work. orderout on the > window doesn't work. Is there any way to do this (other than > changing the threading) so the alert box goes away when I'm done > with it? Do I understand correctly that you perform this lengthy operation in direct response to the button click in the alert? If so, this is the expected behavior. { F : F ∈ any modern framework } works from a run loop. At each pass in the loop, the framework looks for the next event to handle (e.g. a click, or the need to close a window). After interpreting it (for instance as a button click), it calls the appropriate handler, sometimes in your code (such as the callback for the alert buttons), sometimes other parts of the framework (such as the part that removes a window from the display list). If your handler immediately executes a lengthy operation without returning to the runloop, then the “close the alert” event won’t come up until the lengthy operation concludes and your handler returns control to the runloop. Then the loop finds the close-alert event, and takes care of it. Hence the rule that you don’t do _anything_ lengthy on the main (GUI-runloop) thread. You can see how using a separate thread would solve your problem. Welcome to 2003. Apple has gone to great lengths to make threading easy (from the sound of it, your case isn’t all that bad), but it can’t hide it from you entirely. — 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
Re: How to stop an Application being Activated
On 7 Apr 2016, at 11:35 AM, Davewrote: > > Is it possible to stop an application being activated, I mean, if an attempt > is made to make an application active it is somehow intercepted by another > application? I gather you hope to write the second application — the one that wages a denial-of-service attack against the first. You needn’t bother looking for the answer. If this is in service to some kind of DRM (I refuse to debate the value), investigate the method iTunes uses to prevent debuggers from attaching. I believe it’s available to other applications as well. Depending on what you’re trying to accomplish, you might make progress by having your application pose as an assistive input method. By the way, what _are_ you trying to accomplish? I assume you are not an evil mastermind. — 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
Re: Proper target for table cell view buttons
On 7 Apr 2016, at 11:04 AM, David Catmullwrote: > > I have some buttons in my table cell views, and I wanted to set my view > controller as their target, but Xcode warns that such objects “may only be > connected to the table view’s delegate”. The things is, it works as is. Why > does Xcode want me to do it that way? > > I plan to try refactoring to satisfy the warning, but I’m still curious what > the reasoning is. I’m curious about two things. (1) Which platform? (2) Is your view controller not a table delegate already? — 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
Re: question about last used date
> On 14 Mar 2016, at 10:39 AM, Jens Alfkewrote: > > Unix filesystems do keep a last-accessed date for files, but it looks like > NSFileManager doesn’t expose an attribute for it. You can call stat() and get > the st_atimespec field of the result. NSURL *Resource* methods can get at NSURLContentAccessDateKey: > The time at which the resource was most recently accessed, returned as an > NSDate object if the volume supports accessdates, or nil if access dates are > unsupported (read-only). The resource stuff is painful, especially in Swift, but indispensable. — 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
Re: 32-bit / 64-bit roadmap
On 21 Jan 2016, at 10:45 AM, Aandi Instonwrote: > > So far as I can see, all recent Mac OS systems are 64-bit on 64-bit > hardware and can run an app shipped in 64-bit only. And 32-bit continues to > run fine. > > But what about the future? Perhaps we can only speculate about whether > 32-bit apps will be deprecated, but maybe Apple have started to hint that > 32-bit has a limited lifetime? It's a question of prioritising work on old > apps, and what will happen to our customers with older apps in future. > Let's assume Cocoa has been weeded out of the apps already. > > Thanks in advance for your speculations (or more solid facts!) The people with solid facts don’t hang around on mailing lists like this, and would be fired if they responded. Apple does not comment on its plans. What we do know is this: We have more than hints. Apple has steadily increased the incentives for third-party developers to drop 32-bit products. But it hasn’t even deprecated it, much less cut it off. Unless I had to accommodate a market (like education) that hangs onto hardware for a very long time, I’d never consider anything but 64 bits. Apple itself has a harder decision, because it doesn’t want to break developers’ remaining 32-bit products. (Add the “Kind” column to Activity Monitor to see what I mean.) All we can know is that deprecation will come no sooner than June (10.12 Tehachapi), withdrawal no sooner than June of 2017 (10.13 San Quentin). — 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
NSXMLDocument & friends coalesce runs of spaces to one
I need to calculate offsets into a Word document XML (.docx) archive using two methods: Counting characters in NSAttributedString’s interpretation, and the text nodes (etc.) of the document XML itself. The offsets have to match. They don’t, mostly because of the way the parser treats runs of space characters. I can explain the need, but let’s keep this brief. NSXMLDocument (Node, Element…) elides runs of spaces in text nodes to single spaces. This is a problem, because the scholars who produced the Word source files learned in 1975 to double-space at the end of sentences. NSAttributedString renders the multiple spaces as such; thus the character counts diverge. "what Socrates wanted. Plato implies" (two spaces) comes through as "what Socrates wanted. Plato implies" (one space). Already tried: * Passing the NSXMLDocumentTidyXML option to NSXMLDocument(data:, options:) takes care of single-space elements, but not this. * NSXMLNodePreserveWhitespace sounds useful, but makes no difference. * The nodes themselves already have the attribute `xml:space="preserve"`. * Intercepting every `` element and _forcing_ `xml:space="preserve"`, need it or not, makes no difference. * If there’s a way for my code, as an NSXMLDocument (etc.) client, to examine the source text before filtering, I haven’t found it. * I assume it doesn’t matter that I’m working in Swift. Ideas? Further details can be found in Stack Overflow at http://stackoverflow.com/questions/33770055/nsxmldocument-family-runs-of-whitespace-collapsed-to-one — 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
Re: AVMetadataItem key
This is embarrassing… On 4 Oct 2015, at 5:39 PM, Fritz Anderson <fri...@manoverboard.org> wrote: > > func OSTypeFor(code: UInt32, >encoding: UInt = NSMacOSRomanStringEncoding) >throws -> String > { >let codePtr = UnsafeMutablePointer.alloc(1) >codePtr.initializeFrom([code]) >defer { codePtr.destroy() } > >let fourChars = UnsafeMutablePointer(codePtr) /*** OOPS ***/ >if let retval = String(CString: fourChars, >encoding: encoding) >{ >return retval >} >else { throw OSTypeError.BadStringFormat } > } > fourChars gets passed to String(CString:encoding:) without a fifth character to provide the NUL to terminate the C String. I’m surprised it was well-behaved in my playground, but something _will_ go wrong in the mean time. fourChars should be an unsafe buffer of five or six CChar, with [4] zeroed-out. Maybe I was rescued by the page being larger than four bytes and zeroed-out, but an aggressive address sanitizer would cry foul. — 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
Re: AVMetadataItem key
On Oct 1, 2015, at 3:59 PM, Jan E. Schotsmanwrote: > > Sorry for this stupid question but I just don't know how to do this. > > I have an AVMetaDataItem with > key = protocol ? Int32(1851878757) > as shown by the debugger > > How can can extract the value 1851878757 which is the four char code I need? > Using Swift 2 My cut at a UInt32-to-OSType (four-byte string) converter is at the end of this message. The doc comment should speak for itself. You can use it in source code. You can use the function from the LLDB command line by passing it to an `expression` command, so long as the function is visible in the context. You can (if it’s convenient) extend the class you’re interested in to be CustomReflectable and use the function to represent that part of the object. — F import Foundation enum OSTypeError: ErrorType { case BadStringFormat } /// Given a 32-bit integer, produce a good ol'fashion Mac `OSType`. /// /// - parameters: /// - code: The integer value of the code /// - encoding: The string encoding by which to interpret the code. /// Defaults to MacRoman for historical reasons. /// /// - returns: /// A `String` representing the code as four characters (see **Warnings**) /// /// - throws: /// `OSTypeError.BadStringFormat` if `NSString` could not find a correctly-encoded string in the four bytes. /// /// Warnings: /// - The presence of `NUL` bytes truncates the resulting string, because the conversion to `String` assumes the source bytes are a C string. /// - The code must be representable in four bytes of the chosen encoding. /// /// Bugs: /// - The function could check-and-throw for more preconditions, such as the absence of `NUL` bytes in `code`. func OSTypeFor(code: UInt32, encoding: UInt = NSMacOSRomanStringEncoding) throws -> String { let codePtr = UnsafeMutablePointer.alloc(1) codePtr.initializeFrom([code]) defer { codePtr.destroy() } let fourChars = UnsafeMutablePointer(codePtr) if let retval = String(CString: fourChars, encoding: encoding) { return retval } else { throw OSTypeError.BadStringFormat } } var code: UInt32 = 1_851_878_757 try? OSTypeFor(code) // "eman" try? OSTypeFor(0)// "" — see warnings in the documentation comment do { try OSTypeFor(0x_) // (four haceks) try OSTypeFor(0x_, encoding: NSUTF8StringEncoding) // (throws) } catch { print("Error:", error) } // Error: BadStringFormat ___ 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: Swift generics, circular type declarations, and segfaults, oh my!
On 3 Sep 2015, at 8:55 AM, haswrote: > Stuck and looking for ideas here. I need to define a base class whose methods > vends instances of its subclasses (thus enabling chained method calls; your > basic query builder). I’m assuming Swift 1.2. The following works in an OS X 10.10 playground: // class Factory: Printable { required init() {} class func makeNew() -> Self { return self() } var description: String { return "This is a Factory." } } class Product: Factory, Printable { override var description: String { return "This is a Product." } } let f = Factory.makeNew() // => __lldb_expr_580.Factory f.description // => "This is a Factory." let p = Product.makeNew() // => {__lldb_expr_580.Factory} p.description // => "This is a Product." // * Using an instance as a factory for its own class is contrary to general usage, so is a smell at best. It’s a job for a class func. (Yes, functional-programming operators do exactly that, but this is an example of the Factory pattern, not an operator. You shouldn’t have to instantiate a Product to make a Product.) * Explicitly calling init should be legitimate, as the changes to map{} and the like now allow you to use it in the closure. I could still imagine support for that usage being withdrawn. I’m not comfortable as a matter of style with making it Just Another Func — and the solution above makes it moot. * Self is the new instancetype. It takes care of casting issues. (I haven’t thought out all the corner cases, so don’t hit me. I wear glasses.) * I was confused by the REPL’s calling Product.makeNew() an {__lldb_expr_580.Factory}, but apparently the braces mean “some subclass of.” If anyone can offer an authoritative explanation, I’d be glad to know. * I assume the call to self() in makeNew() goes through to an initializer for Product, but my day job calls. — 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
Re: Referring to self in property initializer
On 14 Aug 2015, at 8:47 PM, Rick Mann rm...@latencyzero.com wrote: So, adding lazy lets it work with the closure (makes self available to the closure): lazy varbackgroundSession : NSURLSession= { ... I really wish you could do lazy let foo = I don't see why the language can't support that. I see your logic: `let` is a constant, guaranteed set before first access (you can write all the code you want between declaration and access, so long as all provable execution paths guarantee the constant is initialized). You can’t get the value of a `lazy` symbol without triggering the initializer and thus guaranteeing a value exists. So you might as well call it a `let`. I don’t know enough about the constraints on the compiler or the design of the language that might make `lazy let` undesirable: Must a `let` constant’s value be known (and inline-able) immediately _before_ the source requests the access (consequently triggering the initializer)? And not after the value returns to the code that requests it? Is it fair to say that even if you can’t access the value _in Swift code_ without triggering, that the value of the symbol does not exist in memory until it is initialized, and the name for a symbol with a value that can change is `var`, not `let`? Is it difficult for the compiler, or confusing to the user, to have `lazy let` be an exception to the requirement that all ivars (remember `let`s are notionally not variables at all) must be set before a call out of an `init`? — 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
Re: How to implement NSSplitViewDelegate methods in an NSSplitViewController subclass
Speculation: This may be like the -window property of NSWindowController. Accessing it is the recommended way to force the controller to instantiate the window, even if you don’t care about the result. In this case, _you_ may not care what super’s NSSplitViewDelegate methods do, but NSSplitViewController needs to hear about the events they represent. — F On 7 Aug 2015, at 2:33 PM, Bill Cheeseman wjcheese...@gmail.com wrote: I've always been comfortable calling super when it doesn't return a result, or when I am expected to use super's result for some purpose in my override. But it feels very bizarre to be calling a super implementation and doing nothing with whatever result it returns. ___ 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: NSManagedObject, NSString property retain vs copy
On 30 Jul 2015, at 11:03 AM, Trygve Inda cocoa...@xericdesign.com wrote: It seems Apple is using retain rather than copy for NSString properties in an NSManagedObject subclass. I was always under the impression that copy should be used for NSString, so why the retain?? For an immutable string, -copy is implemented as a -retain. -copy is a guard against the receiver’s relying on the unchanging contents of a string whose contents can be changed. If the contents cannot in fact be changed, there’s no point in allocating new memory and copying the bytes into it. It’s an implementation detail; what makes you believe it makes a difference? — 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
Re: Unable to connect IBOutlet in Swift Xcode 7b2
[The thread is a week old, so it may have gone stale…] On 7 Jul 2015, at 1:58 AM, Rick Mann rm...@latencyzero.com wrote: On Jul 6, 2015, at 23:22 , Kyle Sluder k...@ksluder.com wrote: On Mon, Jul 6, 2015, at 07:57 PM, Rick Mann wrote: On Jul 6, 2015, at 17:54 , Charles Srstka cocoa...@charlessoft.com wrote: I’ve occasionally had issues getting Xcode to connect outlets and actions. My workaround for it is to open the Assistant view, and drag from your view into the source file, and let Xcode create an outlet or action automatically. Then you can delete the one it created and it should work with the one you already had. This is what Xcode is refusing to do. As if the class definition wasn't matching the class I specified in the storyboard (but it does; I copied and pasted the name). Is the Module correct? It's in the same source file as the other view that it does connect to; both module fields are blank in IB Blank? Not a placeholder for “Current — Your_Target_Name?” The NIB/storyboard loading process for Swift needs an absolute module name, and in my experience, IB’s reference may not survive transfer between projects or targets. The result would be a blank Module field (- , not a default). I wish I remembered the solution — I last dealt with it in an Xcode 6 beta. In the Identity inspector, try manually entering the target’s module name, or deleting the class name and typing it back in in hopes IB will find the class and complete the name and module for you. I may even have rebuilt the scene or storyboard from scratch, but I think that was just thrashing on my part. — 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
Re: Scary Stuff!
On Jun 18, 2015, at 8:33 AM, Fritz Anderson fri...@manoverboard.org wrote: On Jun 17, 2015, at 4:46 PM, Britt Durbrow bdurb...@rattlesnakehillsoftworks.com wrote: WHAT?!?! No! You gotta use ROT13! ;-P One pass? Reckless. I use eight. Sent to the list in error; I apologize.— 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
Re: Scary Stuff!
On Jun 17, 2015, at 4:46 PM, Britt Durbrow bdurb...@rattlesnakehillsoftworks.com wrote: WHAT?!?! No! You gotta use ROT13! ;-P One pass? Reckless. I use eight. — 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
Re: Disabling auto-synthesis of property accessors.
On 22 May 2015, at 7:49 AM, Alex Zavatone z...@mac.com wrote: @property (nonatomic, strong) NSString *thing; Another chore in porting this code: The retention attribute should be copy, not strong. If you needed to track changes in the string, you'd use strong, but NSStrings don’t mutate; NSMutableStrings do. If you do assign a mutable string into the NSString property, the non-mutable class promises the users of your API that it won’t mutate. You need a copy to prevent changes behind your back. The performance hit is the price you pay to prevent a bug. copy is not a performance issue for NSString. It doesn’t copy anything, it just increments the retain count and returns the same pointer. (Static/global NSStrings don’t even bother to deallocate themselves.) Copying a mutable string does allocate and initialize a new object; either way, the attribute does the Right Thing. — 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
Re: Disabling auto-synthesis of property accessors.
On 21 May 2015, at 12:27 PM, Kyle Sluder k...@ksluder.com wrote: On Thu, May 21, 2015, at 12:11 PM, Alex Zavatone wrote: Jens mentioned that it was possible to turn off the auto-synthesis of properties in the build options of the target. This would be quite useful to help me iron out items that need to be refactored in my current project. My google skills are weak. I can't find out how to do this. Anyone care to clue me in? All the responses I see state that it's not possible. Project editor Build Settings Search for synth I must have misinterpreted the question. I had understood Alex wanted a build option to turn off the auto-synthesis of properties, so the compiler could complain at every conflation of ivars with @propertys. The search you suggest (at least in the ObjC project I have open in 6.3.2) turns up only the warning for the lack of @synthesize in the @implementation. The global feature itself seems to be mandatory. (I could guess why that would be reasonable.) — 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
Re: Proper way to perform a task in the future on iOS 7 and 8
On 4 May 2015, at 1:29 PM, Alex Zavatone z...@mac.com wrote: Since the app is already receiving location updates in the background, does it make sense to check if the current time is than the expiry timestamp within a location manager update? It makes so much sense to me that I don’t know why I’d be less than comfortable with it. You mean to disregard updates from Region A after time T. That includes the first update at (t ≥ T). How you disregard them is an implementation detail. Why can’t “disregard” at that first update mean literally that your handler ignores the “live” behavior and removes the region? I believe regions are a limited resource. Would that be a problem for you? — F ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Bindings across view controllers in OS X storyboards
On 28 Apr 2015, at 6:54 PM, Rick Mann rm...@latencyzero.com wrote: I have a window made up of a couple of NSSplitViewControllers and custom view controllers. It's mostly a master-detail type of thing, where the selected item in the first split sets up the second, and a selected item there sets up the third. Thing is, I don't see a good way to bind from one view controller to the other. I could subclass NSSplitViewController, override -prepareForSegue:, and inject references to the NSArrayControllers that way, but that means subclassing NSSplitViewController, which seems rather lame. I almost devoted half-a-chapter to how disastrous and inexplicable this is, until I figured out the rules. Part of the rant made it through to the page proofs (print minus one). Storyboards are not monoliths at runtime, they’re an archive of NIBs, one for each view controller. Cross-controller relationships are missing only in the sense that they are impossible. That includes parent-child relationships from window controllers across split-view controllers. A window controller has a reference to its content controller. Descend that into the split-view controller and index the splits, then recover the content controller for each. In the process, you can propagate the child controllers up to the window controller (or whatever). — 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
Re: Spinning the busy indicator
On 1 May 2015, at 12:53 AM, Graham Cox graham@bigpond.com wrote: So, the docs say (ha! here we go again…) that the default QoS is NSOperationQualityOfServiceBackground. This appears to be the LOWEST QoS constant. However, it also states that it is only used if the NSOperation itself doesn’t set this value, but because addOperationWithBlock: creates its own NSOperation internally (that we mere mortals don’t get to access), it might be assigning a value that overrides this. Unhelpfully, the simple CPU usage view in XCode only states QoS unavailable”. It looks as if to be sure I’m going to have to drop down a level and create my own NSOperations. Idle curiosity — if your operations queue is all your own, is there a point in your process in which you can iterate its .operations array and set QoS then? There’s no explicit promise that the property is mutable after the operation is enqueued, though, and you might be Too Late already. This may be moot. You have a workaround, and Kyle accepts that it may be a bug. — 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
Re: Submitting App Localization Issue...
It would be helpful to know what the unhelpful message was, and at what stage of the process it came to you. Also, what exactly are you doing for localization? — F On Apr 21, 2015, at 5:32 PM, Peters, Brandon bap...@my.fsu.edu wrote: I am getting an error in iTunes Connect for my App pertaining to the English localization. English is the only language my app currently supports. The error is not really helpful. Has anyone seen something similar? ___ 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: Why is NSString.UTF8String unavailable in Swift?
On 21 Mar 2015, at 11:10 PM, Jens Alfke j...@mooseyard.com wrote: On Mar 21, 2015, at 8:43 PM, Charles Srstka cocoa...@charlessoft.com wrote: If you convert between String and NSString a lot, it’ll have performance implications (which is why bridging to NSString just to get -UTF8String isn’t really a good idea). Then what would be the best way, given a String, to pass it to a C API that wants a char*? —Jens À propos of Swift 1.1: var str = Hello, playground str.UTF8String // String does not implement import Foundation // Let’s be minimal var str = Hello, playground str.UTF8String //String does not implement import Foundation var str = Hello, playground (str as NSString).UTF8String // Swift = 1.1 does not implicitly convert String - NSString. // You have to force the conversion. — 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
Re: NSButton (radio button) not calling action when overlapped by invisible NSButton?
On 10 Mar 2015, at 5:01 PM, Aandi Inston aa...@quite.com wrote: The dialogs are frequently very complex, with areas showing different groups of controls according to context. Individual controls are shown/hidden by the higher level code to make this work. Radio buttons are naturally implemented as an NSButton with suitable style. [“Hidden” controls seem sometimes to intercept clicks in visible ones.] Can anyone make any suggestions about whether this diagnosis has any ring of truth, and how to fix or further investigate it? It’s plausible. The canonical solution to having a suite of control layouts to be hidden or revealed as needed is to wrap them in an NSTabView, hide the tabs, and switch among them programmatically. — 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
Force a find in an NSTextView
Target OS X 10.10. How does a view controller force an NSTextView to perform a search if it doesn’t own the text view? My application is a debugging tool to break an attributed string into style runs and display the runs in a table. I’d like to double-click a row in the table, and select the corresponding text in the NSTextView that displays the string. Eventually, I’ll have to carry the character ranges in the table data and use those, but this _should_ have been easy as a first attempt, and now my blood is up. The text view uses a find bar, the scroll view positions it at the top. The text view is not editable, so the Replace UI isn’t shown. The bar shows, hides, and functions as expected. The table and text are on different sides of a split-view controller; their window controller tells the table controller about the text view. There’s no problem in responding to the double-click. The table’s controller fills the find pasteboard with the text content of the run; other applications show the run’s text in their search interfaces. My current approach is this: (Swift) @IBAction func tableDoubleClicked(sender: NSClickGestureRecognizer) { loadFindPasteboard(sender) // App-specific, does what it says. self.tag = 2 attributedTextView.performTextFinderAction(self) } -performTextFinderAction: is defined in NSResponder; NSTextFinder uses the sender’s tag to determine the verb. (Smelly, yes — it expects an NSControl or menu item, but duck-typing is not completely dead.) 2 is “find next.” This works. Once. Thereafter, it’s erratic. The search field updates correctly, but the selection matches the previous search string. (Again, the find PB updates as expected in other apps.) Then the search field stops updating at all, but pulses the selection as if a find-next had been performed. Maybe the field doesn’t update, but the search result does. Using the find-panel interface has the same result. Evidently I’m in some sort of cache race that may be reasonable given the expected use of NSTextFinder, but you’d hope a factored view controller of that name could be used to… find text. I don’t see a way to force the flush, or to force the text view’s finder to reload. Ideas? Or should I give up and do the range highlighting I’ll have to do anyway eventually? — 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
Re: Instantiate NSString from NSURL in Swift
On 23 Feb 2015, at 8:18 AM, Juanjo Conti jjco...@carouselapps.com wrote: I'm translating some code from Objective-C to Swift and in the middle of that, i found this problem. theUrl is an instance of NSURL theUrl.host?.lowercaseString compiles ok. But NSString(string: theUrl.host?.lowercaseString) don't. It says Value of optional type 'String?' no unwrapped; did you mean to use '!' or '?'? If I click to add the fix, then it complains again and suggest to delete the '!' :) This is written in haste, and few people are experts… theURL.host may yield nil (host is declared String!, implicitly unwrapped, but optional). theURL.host?.lowercaseString will short-circuit and be evaluated as nil if .host is nil. anyString.lowercaseString may also yield nil; the var is declared String!. anyString.lowercaseString! attempts to unwrap a String that the compiler has implicitly unwrapped already. Therefore, because of the short-circuit “?”, the expression theUrl.host?.lowercaseString is of type String?, which may be .None (nil), or .Some(String) (and therefore have to be unwrapped). You are passing that optional String as the argument for String(string: {that optional expression}). The argument may be nil; or it may need unwrapping. The initializer _requires_ a non-nil argument. It’s a righteous error. The expression NSString(string: foo!) is different; by adding the bang you’ve taken responsibility for the parameter’s not being nil. Because .lowercaseString returns an implicitly-unwrapped String (String!), theURL?.host?.lowercaseString! tries to unwrap something that is already, syntactically, an unwrapped String. Quincey — my instinct is that the conditional-unwrap chain necessarily forces left-to-right evaluation, tighter than the . operator. The ! would mean, “if you got this far without short-circuiting, and b returns an optional, then unwrap it.” As of today’s Swift 1.2b2, the following in a playground: let aURL = NSURL(string: http://wt9t.com/;)! NSString(string: aURL.host?.lowercaseString) complains as you suggest: .host? is potentially nil — that would force the whole expression to be nil, and thus forbidden as a parameter. lowercaseString still gets treated as implicitly unwrapped — so a bang at the end of the whole expression is an attempt to unwrap something the compiler was going to unwrap anyway. By the way: The use of +[NSString stringWithString:] or -[NSString initWithString:] is a code smell. The result of lowercaseString is declared as immutable, and you aren’t trying to initialize an NSMutableString with it. Foundation (unless I’m missing something) is free to treat it just as it does with -[NSString copy], and simply return the same object with the retain count bumped. Once you get into mutability, the smell goes away, and someone will surely jump in now with an explanation for why it’s needed more often than I think. — 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
Re: Datatypes still not recognized after adding bridging header...
On 19 Feb 2015, at 9:59 PM, Peters, Brandon bap...@my.fsu.edu wrote: I added a bridging header so that I could use the FMDB Objective-C code in Swift. However, the compiler still says it cannot recognize the datatype. Under Swift Compiler - Code Generation I added the bridging header there. Is there something else I am missing? I am running Xcode 6.3 beta on 10.10.2. Are you compiling FMDB as a separate module, or folding it into the target compilation phase? Can you show us the bridging header (which implies you’ve added FMDB in-target)? Are you importing the FMDB module into your Swift source (if a separate module)? Does Swift not-recognize all of the FMDB classes, or just some? Or is “the datatype” something other than an FMDB-defined class? Beyond this, I’d be getting into things from the Using Swift with Cocoa and Objective-C document. — 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
Re: Convert to NSString from
On 6 Feb 2015, at 12:04 PM, Jens Alfke j...@mooseyard.com wrote: No one's used MacRoman encoding since the OS X transition, except for a few slow-moving legacy codebases. … and some Adobe PDF embedded fonts. — 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
Re: iOS 6.x vs iOS 8.x layout
You guess correctly. It's a very large subject, and a mailing list is no place for a tutorial, but here's a direction: Do not learn auto layout as if you has a gun to your head. Do not rush. Do not poke constraints in one-by-one until they seem to be working; it'll take hours to dig yourself out. Read the introductions so you know the concepts, then see if Xcode's suggested constraints do what you need. That sounds like you could have done it in the first place, but you need the background to know if it's right. Use what you've learned to draw up a plan for how each view fits in a top-to-bottom, left-to-right chain. Then create or adjust your net. There is much more to it, but to start: Get the concepts. Have a plan. Try the automatic recommended set, but be critical. ― F On Jan 26, 2015, at 11:58 AM, Raglan T. Tiger r...@crusaderrabbit.net wrote: I did a free iOS app for the iPad which ran just fine on iOS 6. Now for users who have updated to iOS 8 the view layout is incomprehensible ... toolbars do not show, and popovers are positioned wrong. Why would this happen and what recourse do I have? (I guess learn about constrains?). ___ 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: Is the button group in Safari a general widget ?
On 23 Jan 2015, at 10:20 AM, Aaron Lewis the.warl0ck.1...@gmail.com wrote: I've seen a lot of apps like Safari. 5 buttons in the bottom Is that a common widget? I couldn't find it on google (Notes ~ “widget” doesn’t have the same meaning in iOS/OS X frameworks that it does on other platforms. You mean “control.” Jonathan Hull just suggested the UIToolbar family, which is an excellent suggestion. I wrote this assuming you were asking about OS X. Because you hadn’t said otherwise. The fundamentals about what’s available, what has to be custom made, and how to ask questions are the same.) Perhaps you could put what you want to do less telegraphically? Five buttons on the bottom is not like [desktop] Safari, we can’t use “a lot of apps” as a guide to examples, and if you’re talking about the design of your own application, how many there are and where doesn’t matter. Buttons exist. You can have five of them. You can put them anywhere, singly or together. That is common. I am guessing that you mean something like NSSegmentedControl [if AppKit]. Apple [often] has a special appearance for segmented controls in its own applications, which are built with private code. Many developers want that look, but it’s not in AppKit [UIKit]. You have to make your own, or find a third-party library that gives you what you want. Maybe you can get better search results if you try the terms “segmented control Mac”. [Or “… iOS”.] — 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
Re: setApplicationIconImage:
On 23 Jan 2015, at 10:07 AM, Steve Mills sjmi...@mac.com wrote: -setIcon:forFile:options: still sounds like your best bet, because it will make a lasting change. Although it's too bad that Apple didn't allow this method to take an .icns file as well as an image. That would've made it the perfect solution. For my own instruction, does it help that NSImage can take TIFF, which can be multi-resolution, which I suppose is what you wanted from .icns? It’s what Apple advocates for high-resolution within OS X apps, but I’d like to know whether the setIcon: pipeline makes that infeasible. — 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
Re: URLByResolvingBookmarkData not case sensitive
On 5 Jan 2015, at 10:11 AM, Trygve Inda cocoa...@xericdesign.com wrote: I am using URLByResolvingBookmarkData . If I make a Bookmark to a file: /Volumes/Macintosh HD/Documents/MyFile.txt and later resolve it with URLByResolvingBookmarkData, I get the original path as expected. Then if I change the filename to MYFILE.txt in the Finder and resolve the bookmark again, the URL is still the mixed-case path above instead of the new uppercase file path. I would expect to get the current path in a case sensitive way. The following assumes that your problem is that the pathname hasn’t been updated, not that the reconstituted URL no longer gives access to the desired file. If the bookmark no longer works, then ignore the rest of this. What you expect is plausible, but it’s also plausible that it’s not in the API contract: The most that’s directly promised is that the bookmark will be as robust as possible _in gaining access_ to a volume, directory, container, or file. Your expectation isn’t disclaimed, but I don’t think Foundation promises to make good on it. So long as the grants-access promise is kept, it’s not necessary to report the identical URL string you’d get if you passed the current path to +fileURLWithPath: : * We don’t know whether alias resolution even looks at the string you originally put in the bookmark container. It’s an implementation detail; the string you gave might be kept only as a courtesy (or a last resort). We don’t know, and I don’t think we’re supposed to care. * In the Mac’s default case-insensitive HFS+, correcting for case is pointless. The string you asked the container to contain is still fit for purpose. * Presentation to the user don’t enter into it. Path (and URL) strings have never been safe for presentation to users. (To take one example, standard system directories are localized, but the BSD paths never change from their US-English names.) I’m not saying the documentation disclaims your interpretation, just that it leaves it open to Foundation’s doing what you’re seeing. — 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
Re: Issues with applications running on background (Alarm Application)
On Dec 16, 2014, at 9:55 PM, Claudio Maximiliano Edison Bastos Iorio selecter...@gmail.com wrote: soundName property is OK, and allows to use any embedded sound. But there’s no way to load any custom view dispatched right from the LocalNotification, at least no with a previous user interaction. I’ve just found UIApplication’s beginBackgroundTaskWithExpirationHandler, who allows me to run a background task. Based on Apple, the purpose of this background task is for instance to complete a server request when the app goes to background. I still need to check if this is a proper solution, however, I wonder if Apple will allow me to use this task to keep my Application running on the background. Do you guys have any idea about that? You should study the documentation again, taking care against confirmation bias. beginBackground… really is for brief completions. iOS will allow you ten minutes at most. You are subject to eviction at any time before, so you must structure your task to tolerate its not completing. Within those constraints, you can do whatever you like in that time. If it's a matter of a download, which I gather it isn't, look at the NSURLDownload family. Apple lets you claim an exemption for specific tasks like VOIP or audio, but that doesn't help you. Look them up. There is no leeway for any other exemption. ― 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
Re: WTF is happening?
I can be dense. Do I understand correctly that - You have an application that ideally should run continually. - It accepts plugins that provide one or more classes. - Those classes must at least observe a protocol; otherwise there would be no sensible way to use them. - They must have unique names. - As is typical of ObjC plugins, the classes are packaged in a dynamic library; and as is typical, the library is wrapped in a package directory, which your application has registered with Launch Services as a package, of a certain type and edit/view/associate relationship to your application. I'm sure this is so in your case, as plugins typically need to carry resource files. - If a package, the plugin might carry an Info.plist file — plugins commonly do. - You mean to load and unload plugins dynamically, as they appear and disappear in a designated directory, without interrupting the application. Do I follow you so far? If so, I have some comments. You can't unscramble the egg: Dynamically-loaded classes can be loaded any time you like, but they cannot be reloaded or unloaded. Surely you know this; surely I misunderstand (or am behind the times). If you are (practically) committed to a package structure with an Info.plist, why can't you add an array key listing the names of the provided classes? Or for that matter, a text file containing the names? That's one of the things NSBundle is for. It is a universal practice. Just works is a great ideal, but one can expect someone who knows how to build a dynamic library to understand such things. The declared classes might not implement the required methods, but that's easy and safe to detect once they are loaded. If you must reject, your duty ends when you log the problem and put up an alert. Am I missing something? — F On Dec 15, 2014, at 11:59 AM, Maxthon Chan m...@maxchan.info wrote: What I am doing here is to determine a format handling class based on file extension. I want to achieve a drop-to-plugin-folder-and-it-will-work effect and allow one plugin to include multiple format handling classes. Also since I am creating an open system I don’t want to require other plugin writers to register their classes, instead the main code shall discover plugins on its own. This means that the main code will not be able to call any plugin classes methods so +initialize never get called. Also your approach means that the main code will hold a strong reference to the plugin code which prevents plugin unloading. Class walking may be fragile, but it is fragile enough to allow plugins to come and go easily without having to restart the main code. ___ 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: Swift Interface vs Implementation
On Nov 22, 2014, at 1:27 AM, Richard Charles rcharles...@gmail.com wrote: Perhaps it is just me, but it is not uncommon for my source file to have many more methods than what is in my header. So for me it is not the replicated code in the header file that is a negative but rather it is being forced to define the interface that ends up being a positive. My documentation style is patterned after Richard Hipp’s SQLite project where a detailed description of each interface routine is found in the source code. A quick glance at the header file gives you an overview of the interface. If you need more information then go to the source code. Overall this results in smaller header files and a more readily comprehended interface. I find this very beneficial when working with a large project, it help me keep my sanity. There’s another approach. I resist it, but I suspect the resistance comes mostly of my not being used to it. Swift extensions are not like Objective-C categories. They’re cheap; they have first-class access to the class’s internals. (Not privates, I hope.) Put your public interface in the main class file, and the private workings in the extension. You still have to expose your source, but at least you can restrict it to public API. I respect your concern about summary vs. detailed documentation. My solution is surrender: I have Ruby scripts and C-family headers that are 80% documentation, because I think of them as source for a consolidated reference, not a quick lookup. I was happy enough with the summaries extracted by aggregators like Doxygen, for which there is no replacement, and I’m glum about there being one any time soon. How dismal is the current situation with reStructuredText is off the topic of this thread, so I’ll restrain myself. — 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
Re: NSPersistentDocument, Export (Save As) and wal/shm
On Nov 14, 2014, at 8:02 PM, Richard Charles rcharles...@gmail.com wrote: I just checked my OS X application (Xcode 6.1, Objective-C source, 10.10 SDK, running on 10.9.5). When doing a save as the new document also appears on disk with external journaling files (shm and wal). That is nasty, very distasteful from a users point of view! rdar://18994451; I classified it as a data-loss bug, given the near-certainty of the loss of the journal files. — 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
NSPersistentDocument, Export (Save As) and wal/shm
OS X application, Yosemite (host and target), Xcode 6.1, all-Swift. If you duplicate (save-as) an existing document, the new document appears on disk with external journaling files (SHM, WAL). It is impossible to state how undesirable this is without descending into sarcasm. The solutions I’ve seen from a web search are a year or more old, and have proven ineffective. What is the current thinking on this? This is another of those things that are so conspicuous that I must be missing something obvious. Details below the fold. — F This concern seems to have been perking along since the introduction of Mavericks. One commenter said DTS volunteered these solutions: 1. Continue to use the Mountain Lion SDK for Mavericks development. 2. Swizzle something. I stopped reading. Time’s run out on those. A year ago, it was suggested on this list that the persistent-document subclass should override the method for which the Swift signature is: configurePersistentStoreCoordinatorForURL(_: NSURL!, ofType: String!, modelConfiguration: String?, storeOptions: [NSObject : AnyObject]!, error: NSErrorPointer) - Bool … and pass @{ NSSQLitePragmasOption : @{ @journal_mode : @DELETE } } as storeOptions: to super. With that pragma set, SQLite is supposed to suppress the journal files. An account of the strong-typing nightmare would veer once again into sarcasm. I’m unhappy about assuming storeOptions will always be nil. Here is my attempt: ``` let newOpts = [NSSQLitePragmasOption : [journal_mode : DELETE]] // Also suggested: // let newOpts = [JOURNAL:DELETE] // This doesn’t work, either. return super.configurePersistentStoreCoordinatorForURL(url, ofType: fileType,modelConfiguration: configuration, storeOptions: newOpts, error: error) ``` The breakpoint at the return line fires. newOpts has the expected content. I still get WAL and SHM files. Using … [journal_mode : OFF]] does no better. ___ 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: updating NSTextField before spinner animates
On 12 Nov 2014, at 2:58 AM, sqwarqDev sqwarq...@icloud.com wrote: Thanks for this Fritz. I think I get it. I need to get a clearer idea of how the run loop works. This isn't the first time I've been confused about why a line doesn't appear to return the result I expect before the next line executes. I suppose this is part of the difference between using traditonal procedural languages and these /new-fangled/ object-oriented ones... :~) For the record, this isn’t a procedural-vs-object-oriented matter. Procedural applications may run in an asynchronous environment and OO languages can be run in a synchronous environment. — 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
Re: updating NSTextField before spinner animates
On 11 Nov 2014, at 4:15 AM, sqwarqDev sqwarq...@icloud.com wrote: I have an NSTextView, whose string I want to update while I wait for another method to complete. Since this method is going to take around 10-30 seconds, I'm displaying a spinner progress indicator. However, I want the text field to update before (and, ideall, during, but I'll settle for before) the spinner starts, but no matter where I put the text field message, it waits until the spinner has finished before updating. I've even tested to make sure the update happens first (see the conditional clause below), but the update is not shown in the view until the spinner finishes. ... [_mySpinner startAnimation:nil]; [_infoField setString:@display something...]; NSString *didChange = [_infoField string]; NSRange r = [didChange rangeOfString:@something]; [_infoField needsDisplay]; if (r.location !=NSNotFound) { NSLog(@hit sleep); sleep(5); } [_mySpinner stopAnimation:nil]; Putting the _infoField setString call before the spinner's startAnimation call makes no difference. What am I doing wrong? -needsDisplay schedules a view’s -drawRect: for the next pass through the runloop. You’re putting your process to sleep at the OS level, so the runloop is suspended along with everything else. What you posted is evidently a minimal case, and maybe, instead of sleep(), your lengthy method is called instead. Same principle: Unless that method runs asynchronously (or simulates asynchrony by doing its work piecewise on an NSTimer, or by periodically sending -runMode:beforeDate: to the runloop), the runloop never has the chance to dispatch view updates. — 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
Re: Weak linking
On Nov 7, 2014, at 5:54 AM, Satyanarayana Chebrolu satyanaraya...@ivycomptech.com wrote (slightly more appropriate to xcode-users): The app is getting crashed when we launch it on 10.5 and 10.6 machines saying that “dyld: Symbol not found: _OBJC_CLASS_$_NSTableCellView”. Understand that NSTableRowView, NSTableCellView are not existing on 10.5 and 10.6, so the subclasses should be weakly linked. Tried, by making Cocoa X.frameworks as Weak linking(Optional) under Link Binary With Libraries section of the application target, but still the same issue. It seems, I am missing something. Have you set the “Deployment Target” (most easily found under the General tab in the Target editor) to 10.5? — 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
Re: Can an use introspection to determine if its a production app from the App Store?
On 31 Oct 2014, at 6:40 AM, Charles Jenkins cejw...@gmail.com wrote: My day job is programming in C# for Windows computers. I was really excited when Swift came out because it’s so similar to other languages I know well and use and admire. I’ll take this as the root theme of your message. Many of your objections amount to being unhappy that Cocoa, OS X, and their tools are not C# on Windows. C# and Windows are worth knowing, but most things that are worth knowing are neither C# nor Windows. They are that way for thoughtful reasons, and not as duct tape over their falling short of being C#. Even if you never use any other tool or environment again, knowing about others will make you a better C# developer. Named arguments and strict typing are found in many modern languages. Smart people differ on the merits, but many smart people think they are good ideas. An out-of-band value for “no result” has been a feature of programming languages since SQL’s NULL at least; as late as the 1980s, the biggest horror stories of computing centered on collection proceedings for utility bills of $99,999.99. Some such languages use it inconsistently, and stick developers with the pain of debugging it. It is rational to provide an out-of-band value; to make it uniform; to take advantage of modern computers’ ability to detect fatal errors in its use; and to force developers, the only ones able to abate such errors, to abate them. The compiler pelts you with ! and ? gotchas precisely because you hadn’t noticed the pitfalls. I infer you don’t like the Delegate design pattern used in (NS|UI)TableView and elsewhere. The Delegate pattern has been documented as sound OO practice for twenty years, and not just in ObjC/NeXTStep. Even critics allow it is one of Cocoa’s strengths. It will never go away. See Wikipedia. “Banish[ing] Objective-C from all libraries” would be like superseding every C# library with a total redesign: conceivable, pointless, will never happen. On the other side: When I am feeling especially cynical, it seems Swift syntax has a lot of sugar that makes it less intimidating in a 30-minute presentation, but harder to write.* The impedance mismatch with Cocoa is artfully minimized and is improving, but it makes Swift much more complicated. The error messages are often inscrutable, or can be scruted only by reference to API that for now is mostly unpublished.** Welcome to tech. What can get better has been getting better. * (For some of this — maybe most — I’m held back because I haven’t developed the instincts I have for ObjC and Ruby. Bang-suffixed types and `??` are sugar for things that could be clearer if expanded, but I wouldn’t give them up.) ** (Unless you add `import swift` to a .swift file and command-click `swift`. I wish I could properly credit the humanitarian I learned this from — NSHipster?) — 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
Re: Closing window on Yosemite crashes (isFlipped)
I haven’t encountered this myself. This is stream-of-consciousness, adding the presence of convertRect:toView: in the trace as the immediate caller… … The classic cause of a message arriving at the wrong object is that the expected object had been deallocated and its address recycled for the object that eventually got the bad call. The bad call comes of the calling object’s keeping an orphan pointer to the original. I’d think ARC would make that very rare, but maybe not impossible, especially if the orphan pointer were unsafe_unretained. It’s too bad you don’t have a reproducible case; if there were one, I’d use the Allocations and Leaks instruments, with Allocations set to record the complete malloc/retain/release/free life cycles. … It’s worse in that if it is an orphan pointer, it smells as if it was kept in the view hierarchy of a framework-managed object. … I wonder if _NSThemeCloseWidget is an NSCell; a cell wouldn’t implement any of those messages, assuming the subclass doesn’t add them. From the selectors you mention (plus the caller being inside convertRect:**toView:**), the caller seems to expect an NSView. — F On 30 Oct 2014, at 9:59 AM, Allan Odgaard lists+cocoa-...@simplit.com wrote: Since Yosemite I have seen a lot of crash reports submitted where the crash is triggered by closing a window and it mostly ends with sending `isFlipped`, `_isLayerBacked`, or `transformRect:` to a wrong object. Application Specific Information: objc_msgSend() selector name: isFlipped Performing @selector(_close:) from sender _NSThemeCloseWidget 0x6119c560 Thread 0 Crashed:: Dispatch queue: com.apple.main-thread 0 libobjc.A.dylib 0x7fff897530dd objc_msgSend + 29 1 com.apple.AppKit 0x7fff8afb7d79 -[NSView convertRect:toView:] + 212 2 com.apple.AppKit 0x7fff8b094b0e -[NSView(NSInternal) _updateLayerTreeRenderer] + 935 3 com.apple.AppKit 0x7fff8b1c1548 -[NSView(NSInternal) _pauseLayerTreeRenderer] + 144 4 com.apple.CoreFoundation 0x7fff830bacbc __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ + 12 5 com.apple.CoreFoundation 0x7fff82fac1b4 _CFXNotificationPost + 3140 6 com.apple.Foundation 0x7fff903acea1 -[NSNotificationCenter postNotificationName:object:userInfo:] + 66 7 com.apple.AppKit 0x7fff8b0c70f4 -[NSWindow _reallyDoOrderWindow:relativeTo:findKey:forCounter:force:isModal:] + 4151 8 com.apple.AppKit 0x7fff8b0c5e17 -[NSWindow _doOrderWindow:relativeTo:findKey:forCounter:force:isModal:] + 829 9 com.apple.AppKit 0x7fff8b0c5a6b -[NSWindow orderWindow:relativeTo:] + 159 10 com.apple.AppKit 0x7fff8b1bf587 __18-[NSWindow _close]_block_invoke + 444 11 com.apple.AppKit 0x7fff8b1bf395 -[NSWindow _close] + 363 12 com.apple.AppKit 0x7fff8b1bf145 -[NSWindow __close] + 312 13 libsystem_trace.dylib0x7fff8fc41cd7 _os_activity_initiate + 75 14 com.apple.AppKit 0x7fff8b1765e7 -[NSApplication sendAction:to:from:] + 410 15 com.apple.AppKit 0x7fff8b176410 -[NSControl sendAction:to:] + 86 16 com.apple.AppKit 0x7fff8b34adaf __26-[NSCell _sendActionFrom:]_block_invoke + 131 17 libsystem_trace.dylib0x7fff8fc41cd7 _os_activity_initiate + 75 18 com.apple.AppKit 0x7fff8b1bef2c -[NSCell _sendActionFrom:] + 144 19 com.apple.AppKit 0x7fff8b331ab2 -[NSButtonCell _sendActionFrom:] + 39 20 libsystem_trace.dylib0x7fff8fc41cd7 ... ___ 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: NSComboBox in the tab ring
On 18 Oct 2014, at 11:14 PM, Luther Baker lutherba...@gmail.com wrote: Is it possible to keep an NSComboBox in the tabbing ring if I set its Behavior to Selectable. Tabbing reaches the control if the textfield is editable but I don't want to allow the user to type randomly into the text field ... but unfortunately, once I remove its editability, the tabbing cycle skips the control. An NSComboBox is an instance of a subclass of NSTextField. Use as a free-form text-entry control, _assisted by_ suggested completions, is the essence of the class. Text fields are either editable or not. One might wish NSComboBox were a different object, but it isn’t. The text field delegate methods let you constrain the user’s input on-the-fly, and there are additional delegate methods and notifications for combo boxes; see if you can get what you want that way. Maybe CocoaPods has something, it’s a commonly-desired feature. — 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
Re: Mac containment segues, and prepareForSegue
You’ve gone to trouble; thank you. However, I need some help understanding your answer. I can’t find a “Container View Controller” in the Xcode 6.1 object library. Typing “contain” in the search field gets you a “container view,” which is an NSView. The only special thing about it seems to be that it comes pre-populated with an embed segue to a new NSViewController. You can drop a view into a view-controller scene, but not into a window-controller scene. Searching for Controller gets you [blue] descendants of NSViewController; [green] the NSController (object, array, tree…) family; and [blue] data controllers for scripting and Quartz Composer. Only the view controllers can be dropped into the canvas and serve the window controller as content controllers. None of them (apparently) gives the window controller any clue of their existence. I see NSWindowController conforms to NSSeguePerforming, but as we found, prepareForSegue… never hits the standard-issue window controller, and in fact, I don’t see how you can attach an NSStoryboardSegue to a window controller at all. I understand from your comments that other containment relationships (e.g. from split-view controllers) aren’t segues, either; that’s what I see, too. I have a workaround — cut the window-content relationship off and make the view controller a standalone object in the storyboard, with an identifier. The window controller can load it, initialize it, keep a reference, propagate a represented object, and install its view as the content view of the window. That makes some kind of sense, but IB posts a warning that you’re not spozed to have windows without content controllers.* Thus my question about the correct way to do it. My design question is less urgent now. But controller hierarchy is an essential design pattern; and Apple’s storyboard template recommends a way to practice it. It’s my job to understand it. I don’t. — F * (Someone [me, for a second or two] will think of posting a notification from the view controller to let the document know about itself. For the benefit of the archives: More than one document might be loading windows at the same time, as it might be in a state-restoration process that is within contract if not currently used. For at least one document, the first notification it sees will be for another document’s views.) On 28 Oct 2014, at 2:47 AM, Roland King r...@rols.org wrote: On 28 Oct 2014, at 11:40 am, Fritz Anderson fri...@manoverboard.org wrote: I'm glad of the correction. Yes, I am speaking exactly about the relationship link between the window in a window controller scene and the view in the view controller as provided in the template's Main.storyboard. I think it absurd that there is no obvious way for a document class that loads that window controller to get at the contents of the vote controller, even to the extent of passing on a Core Data context. It being absurd, it's evident I'm missing something embarrassingly obvious. [Top-posted because I'm using my iPhone] I just watched the WWDC video you were talking about, had an hour in the gym with nothing better to do. That video of course uses different terminology from everything else I’ve seen before, however if you watch the piece where they first talk about prepareForSegue and listen carefully to what’s being said and how it’s being compared to iOS, I’m pretty sure that they are only talking about *presentation* segues, not the ones at the top of the slide which they call *containment* segues. later in the talk they first talk about their containment stuff, like splitview etc, and they don’t mention any prepareForSegue on that, then they talk about “Triggered” segues, and those are the ones which have identifiers and which use prepareForSegue. Those are the popover, modal etc etc. segues. Just to make things a little more complicated, there is such a thing as a Container View Controller (you can drag it out of the well and dump it on a storyboard), that has an Embed segue which does have settable name and does call prepareForSegue. So if you write your own containers, you get the call, I have. So from all that I deduce that what in that video is called ‘containment’ actually appears on storyboards called ‘relationships’ and are segues in name-only, they don’t trigger prepareFromSegue, you can’t name them, they are lines on the storyboard. The segues which are real, and cause actions and can be hooked into are the triggered segues which cause popups and modal windows etc. Those you can name, those you get the callback for. ___ 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
Re: Expected identifier or '(' and other errors occur after copying working code to a second machine
A shot in the dark… What are the line endings of the files (LF [UNIX/Mac], CR [legacy Mac], CRLF [Windows/Internet protocols]), and how are they set in the Text Editing panels of the Preferences window in the respective machines? Inconsistent line endings have confused Xcode in the past, particularly for line numbering and live parsing, so the theory comes to mind. Also, have you looked at the preprocessor output for those files? Get one for an .m file that leads to the error messages. — F On 28 Oct 2014, at 8:44 AM, Saunderson, Rik rik.saunder...@baesystems.com wrote: Hi all, We created an iOS app quite a while ago which works perfectly on the Mac on which it was developed, but throws up errors when we try to compile it on a different Mac. Both Macs are running version 5.0.2 of XCode and are building for iOS 6.1 for legacy compatibility reasons. In order to transfer it to the second Mac, we simply copied the entire source directory onto a USB stick. If this is the cause of my issues, then could somebody let me know a better way to transfer projects. The project has a number of dependencies pulled in through CocoaPods. The Pods project/target builds correctly on both laptops. When trying to build the main project, we get several errors of the type: * Expected identifier or '(' * Unexpected '@' in program * Missing context for method declaration * Expected method body This is an example of the compilation errors on one of my header files (note once again that the code is exactly the same as that which is compiles correctly on the other Mac): #import UIKit/UIKit.h @interface DiagnosticViewController : UIViewController UITextFieldDelegate @property (weak, nonatomic) IBOutlet UITextView *diagnosticReadout; @property (weak, nonatomic) IBOutlet UITextField *connectionNameTextBox; - Unexpected '@' in program -(void) messageReceived:(NSString*)webPublisherMessage; - Missing context for method declaration @end -Expected method body All of the errors seem to be in .h files rather than in .m files. Some, but not all, of the issues seem to revolve around file a failing to pick up object types defined in file b, although not all of the issues are caused by this. I have checked all of the header search paths and they all seem to be correct. I have tried to doing a deep clean (Cmd + Opt + Shft + K), but this has not helped. A colleague suggested that I should do a Perform Action - Preprocess command on the file in question, but since all of the files are .h files, this command is not available. Does anyone have any ideas about what's going on? I can only assume that there's something wrong with the build settings or include paths or something, but I've checked through all of them and they all appear to be identical on both Macs. Thanks, Rik Rik Saunderson System Designer BAE Systems Applied Intelligence ___ T: +44 (0) 1483 81 7359 | E: rik.saunder...@baesystems.com BAE Systems Applied Intelligence, Blue Fin Building, 110, Southwark Street, London SE1 0SU. www.baesystems.com/aihttp://www.baesystems.com/ai Please consider the environment before printing this email. This message should be regarded as confidential. If you have received this email in error please notify the sender and destroy it immediately. Statements of intent shall only become binding when confirmed in hard copy by an authorised signatory. The contents of this email may relate to dealings with other companies under the control of BAE Systems Applied Intelligence Limited, details of which can be found at http://www.baesystems.com/Businesses/index.htm. ___ 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/fritza%40manoverboard.org This email sent to fri...@manoverboard.org ___ 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
Mac containment segues, and prepareForSegue
This is Yosemite, in Swift under Xcode 6.1. The summary: I don’t understand NSStoryboard containment relationships. I’ve never received a prepareForSegue(_, sender:), and without it, I can’t figure out how to propagate data from a document into its views. This is completely elementary. I can’t figure it out. What am I missing? The idea I get from the WWDC presentation (2014, #212) is that when containment relationships are realized (views are put into their containers), the container controller receives a prepareForSegue(_, sender:) message. Just provide prepareForSegue(_,sender:), always do it, it’s all you need to do. Like all Cocoa innovations, it is as simple as it is delightful. This seems important to me. If you have an NSPersistentDocument, which loads an NSWindowController, with a root NSViewController, and the view controller's business is to display objects from the documents managed-object context, the chain of prepare… calls can propagate the context pointer down to where it is needed. This is what happens with containment segues in UIKit. The need isn’t confined to Core Data: It often happens that the contents of a document are displayed in the document's windows. I've put prepareForSegue methods everywhere I could think of; Xcode makes sure I tag them as overrides. (I even put one in the document class, even though it’s not an override, and the document can get to the window controller at load time.) They look like this: override func prepareForSegue(segue: NSStoryboardSegue, sender: AnyObject?) { let segid = segue.identifier ?? (none) println(\(__FUNCTION__) hit, segue ID = \(segid)) } My prepareForSegue()s are never called. I had my suspicions: Interface Builder does not let you edit the containment “segues,” meaning you can’t assign an intelligible identifier to guide the prepare function in initializing the incoming controller. As far as I can tell: * They are “segues” only in the sense that they are lines drawn between scenes in a storyboard. They do not share any other characteristic. * There is no property or function in NSWindowController giving access to the “window content controller,” despite IB’s insistence that there be one. * IB affords no way to access the containment relationship or the controllers at either end of it. I’ve watched the WWDC2014 presentation (212), and it turns out as it does so often, that it handwaves precisely what I need to know. Just provide prepareForSegue(_,sender:). Well, apparently not. I apologize for being so annoyed, but… I’m missing something that must be there, and have been able to find no trace of it. How do I accomplish what I need to do? — 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
Re: Mac containment segues, and prepareForSegue
I'm glad of the correction. Yes, I am speaking exactly about the relationship link between the window in a window controller scene and the view in the view controller as provided in the template's Main.storyboard. I think it absurd that there is no obvious way for a document class that loads that window controller to get at the contents of the vote controller, even to the extent of passing on a Core Data context. It being absurd, it's evident I'm missing something embarrassingly obvious. [Top-posted because I'm using my iPhone] ― F On Oct 27, 2014, at 7:53 PM, Roland King r...@rols.org wrote: Are you talking in this case about the thing which looks like a segue and goes from the NSWindowController to the main NSViewController and is designated a ‘Relationship Segue’? Seems that’s also the type between NSSplitViewController and its splits? Indeed they appear to be uneditable and not like real segues at all despite being listed in the ‘Triggered Segues’ of the View Controller they come from. ___ 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: Mac containment segues, and prepareForSegue
... of the _view_ controller. ― F On Oct 27, 2014, at 10:40 PM, Fritz Anderson fri...@manoverboard.org wrote: the contents of the vote controller ___ 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: Bad EXC_BAD_INSTRUCTION on drawRect call in Swift
[Usual disclaimer about incomplete information.] On Aug 22, 2014, at 11:25 PM, Peters, Brandon bap...@my.fsu.edu wrote: I am getting this error: EXC_BAD_INSTRUCTION (code=EXC_I386_INVOP, subcode 0x0) over this line of code: if self.contentView!.frame.size.width photo.size.width { docRect.size.width = self.contentView!.frame.size.width imageLocation.origin.x = (self.contentView!.frame.size.width - photo.size.width) / 2.0 } ... I will also add the stack trace: This is not a stack trace, which would be a history of the calls that led down to the current execution point. It is a disassembly of the execution point itself. It appears to be for code that comes after the Swift source you show. ArnoldTransformer2`@objc ArnoldTransformer2.ATView.drawRect (ArnoldTransformer2.ATView)(C.CGRect) - () at ATView.swift: So this is the very end of your drawRect(_:CGRect) method in (am I right?) class ATView, subclass of UIView (I’m guessing iOS because of the use of CGRect, but you really should say so when you ask questions), part of your application ArnoldTransformer2. Yes? 0x1e550: pushq %rbp 0x1e551: movq %rsp, %rbp 0x1e554: subq $0x30, %rsp [Make room for an additional 48 bytes in the stack.] 0x1e558: leaq 0x10(%rbp), %rax 0x1e55c: movsd (%rax), %xmm0 0x1e560: movsd 0x8(%rax), %xmm1 0x1e565: movsd 0x10(%rax), %xmm2 0x1e56a: movsd 0x18(%rax), %xmm3 0x1e56f: movq %rdi, -0x8(%rbp) 0x1e573: movsd %xmm2, -0x10(%rbp) 0x1e578: movsd %xmm3, -0x18(%rbp) 0x1e57d: movsd %xmm0, -0x20(%rbp) 0x1e582: movsd %xmm1, -0x28(%rbp) 0x1e587: callq 0x100018f1a ; symbol stub for: objc_retain 0x1e58c: movsd -0x20(%rbp), %xmm0 0x1e591: movsd -0x28(%rbp), %xmm1 0x1e596: movsd -0x10(%rbp), %xmm2 0x1e59b: movsd -0x18(%rbp), %xmm3 0x1e5a0: movq -0x8(%rbp), %rdi 0x1e5a4: movq %rax, -0x30(%rbp) 0x1e5a8: callq 0x1bc60 ; ArnoldTransformer2.ATView.drawRect (ArnoldTransformer2.ATView)(C.CGRect) - () at ATView.swift:224 This instruction is a call to drawRect(_:CGRect). (Attention world: it’s a _direct_ call!) In fact, it looks to be a recursive call to this very function. Look at line 224 of ATView.swift (see the clue in the disassembly?). Are you calling self.drawRect(_:CGRect) from inside itself? In that case, the infinite recursion will run the stack out of memory, and you will crash. The clue would be the _real_ stack trace, in the Debug navigator, which I will bet shows at least 150,000 consecutive calls to drawRect(_:CGRect). 0x1e5ad: addq $0x30, %rsp - Problem is here [Relinquish those 48 bytes.] That instruction isn’t the problem. It’s the callq instruction immediately before it. 0x1e5b1: popq %rbp 0x1e5b2: retq Return from drawRect(_:CGRect). If you do not know why it should be very rare that you should call drawRect(_:CGRect) directly, you shouldn’t be calling it at all. Show us the whole source of your function. Expect questions about what you are trying to accomplish. Let us know what platform you’re coding for. Could be OS X, but I get a whiff of iOS Simulator. — 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
Re: What is the modern Cocoa way to send an Apple Event to yourself?
On 22 Aug 2014, at 10:40 AM, Kyle Sluder k...@ksluder.com wrote: This is a very strange idea. Cocoa applications do not do this; they just call straight into NSDocumentController. Even if they want to be recordable? — 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
Re: True Type Fonts
On Aug 9, 2014, at 10:11 PM, Raglan T. Tiger r...@crusaderrabbit.net wrote: I will find out about the licensing issue, but we are not changing or making a derivative. Just to be clear: Preparing a derivative font is _one_ way to breach the license, but not the only, or even the primary, way. The core issue is that you should not render the font _at all_ beyond the terms of the license. With the outline we can apply our embroidery digitizing engine to get a font that can be sewn. I know of competitors who do this with no licensing issues. That’s a rendering. And I’d be surprised if your digitizer didn’t adjust the outlines to fit the unique medium of embroidery, making its output a derivative work. You know your line of business better than anyone here, but when I hear “I’ve never heard of anyone else having a problem,” that’s one of four things: “If there _has_ been trouble, it was settled under NDA, and word never reached me.” or “No one else has gotten in trouble. Yet.” or “They asked the rights holders, and were told there was no problem with their doing it.” or “_We_ asked the rights holders, and were told there was no problem with _our_ doing it.” The last is the only one your management should be comfortable with. This isn’t judgment, or even advice; just that the professionals you work for should perform their due diligence. The DMCA can be stupid and draconian, but it’s a fact of life, and having to destroy your inventory is a bigger deal than taking a website down. — 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
Re: NSAlert NSOpenPanel on a background thread
On 22 May 2014, at 10:54 AM, edward taffel etaf...@me.com wrote: i find no mention of thread safety in the NSOpenPanel doc, but the doc mentions ‘Open panels are drawn in a separate process by the powerbox’: perhaps this is the reason. This is one of those rules so universal in Apple APIs that it is never repeated, so it can be easy to miss: No Apple API is thread-safe unless expressly documented as being so. Breaking the rule may work for some combinations of hardware, application, OS, and luck, but breaking it is as far outside the API contract as you can get. What you found in the documentation makes your inference reasonable, but “reasonable” and “true” are not the same thing. — 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
Re: How to check if file exists?
On May 10, 2014, at 2:06 PM, William Squires wsqui...@satx.rr.com wrote: If I have an NSString that contains a filename (and possibly a path, as typed on the command-line), how can I check to see if the specified file actually exists? [ code fragment that collects a string representing a file name (not an absolute path) from argv[] ] How can I make sure MyFile.txt exists before trying to read it in? 1. See -[NSFileManager fileExistsAtPath:] or -fileExistsAtPath:isDirectory:. Careful practice would be to convert the partial path to an absolute one. Xcode handles working directories differently than the shell does. 2. Don’t do it. In the time between detecting the presence (or not) of the file and the time you attempt (or don’t) to read it, the file may have been deleted (or created). Preflighting file access works, until it doesn’t, when something happens that is nearly impossible to reproduce, or malware takes advantage of the gap. Just attempt the read. If the file doesn’t exist then, you’ll be given an error or exception that will tell you so. Errors and exceptions are there to help you. It’s not much harder to write, and it works. — 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
Re: Creating selector for nonexistent method
On 29 Apr 2014, at 9:29 PM, Charles Srstka cocoa...@charlessoft.com wrote: int main (__unused int argc, __unused const char **argv) { @autoreleasepool { NSArray *array = [NSArray new]; #pragma clang diagnostic push #pragma clang diagnostic ignored -Wselector array = [array sortedArrayUsingSelector:@selector(compare:)]; #pragma clang diagnostic pop } return 0; } As with any such solution, you become responsible for minimizing its scope so it doesn’t extend to unintended code. Maybe I’m missing something. — 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
Re: cocoapods: Problem with loading nib for a NSWindowController
To be less Hermetic… case-sensitivity has been an option in HFS+ installation for many, many years. I think you’d be ill-advised to pick it, as I am confident that there is a large codebase that inadvertently depends on case-insensitivity. (That is, the developer sometimes opened Polish.dat, and sometimes polish.dat.) You have to have very particular circumstances, or be of a certain personal disposition, to want to do it anyway. — F On 18 Apr 2014, at 4:14 PM, Gerd Knops gerti-cocoa...@bitart.com wrote: Dangerous (and entirely wrong) assumption. On Apr 18, 2014, at 12:07 PM, Quincey Morris quinceymor...@rivergatesoftware.com wrote: — Check the capitalization of your XIB file name. It’s possible that case matters to nib loading, even though the Mac file system is case insensitive. ___ 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: cocoapods: Problem with loading nib for a NSWindowController
Oh, also, HFS+ is case-sensitive in iOS, lacking NSWindowController though it be. (Is it HFS+? I’m too eager to get out the door for me to check.) — F On 18 Apr 2014, at 5:30 PM, Fritz Anderson fri...@manoverboard.org wrote: To be less Hermetic… case-sensitivity has been an option in HFS+ installation for many, many years. I think you’d be ill-advised to pick it, as I am confident that there is a large codebase that inadvertently depends on case-insensitivity. (That is, the developer sometimes opened Polish.dat, and sometimes polish.dat.) You have to have very particular circumstances, or be of a certain personal disposition, to want to do it anyway. — 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
Re: Automatically resize parent view when subviews resize
On 13 Apr 2014, at 11:01 PM, Lorenzo Thurman lore...@thethurmans.com wrote: I have an NSView with two subviews (A B) placed horizontally with respect to each other. The subviews can take a variable number of uniformly sized subviews. I’ve placed these constraints on subviews A B, (all done in IB): (They should both have the same height) Top space to container Bottom space to container Horizontal spacing between A B Intrinsic View - Placeholder - Width checked to None Horizontal content hugging priority set to 1 The left has: Leading space to container The right has: Trailing space to container The parent view has: Intrinsic View - Placeholder - Width checked to None Horizontal content hugging priority set to 1 With these constraints, I would expect the parent view to resize itself horizontally as the subviews (A B) try to expand to accomodate the addition of more subviews. But instead, the parent view does not resize at all, subviews A B do not resize and their subviews are crammed together as more are added. If I remove the Horizontal spacing between A B, they both resize horizontally, and if I add enough subviews to each, they extend beyond the right edge of the parent view. So, how what mojo do I need to apply to get the parent to resize horizontally? I’m really just getting started with Auto layout, and it seems more confusing than it probably really is or should be. Thanks What constraints are you putting on the subviews you add dynamically to A and B? — 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
Re: NSTask: how to launch a binary as if I launched it via terminal?
On 14 Apr 2014, at 10:08 AM, Colas B colasj...@yahoo.fr wrote: OK. But without the simple quotes, it also fails. With the quotes, the error is /bin/bash: pico /Users/colas/myfile.txt: No such file or directory Without the quotes, the error is Error opening terminal: unknown. Thanks! Le Lundi 14 avril 2014 16h19, Jerry Krinock je...@ieee.org a écrit : From documentation of -[NSTask setArguments:] : The strings in arguments do not undergo shell expansion, so you do not need to do special quoting” I don’t know what they mean by “special”, but anyhow, the ‘ ' you put around your last argument will be passed to your tool and cause it to fail. ___ Try putting /usr/bin/pico /Users/colas/myfile.txt into separate items in the argument NSArray. I find the man page ambiguous, and I lack direct experience, but that may be what bash expects. I can’t guarantee that this will solve the larger problem of whether the effect would be to launch Terminal.app and execute the command, but it’s worth trying. — 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
Re: Excessive open gui graphics files on Mavericks
(The attribution chain is wrong, because I’m coming to this after the message that raised libcramfs.) It’s remarkably hard to get an answer to this, so I may be talking through my hat: Does this involve linking libcramfs.a into the binary you distribute? Have you published the source of your app? — F On 10 Apr 2014, at 2:16 AM, Michael Watson mikey-...@bungie.org wrote: On 9 Apr, 2014, at 0:52, Maxthon Chan xcvi...@me.com wrote: LOL I actually used cramfs once in a game carried the rules database. The rules are so complicated so I tried to make it smaller without sacrificing the efficiency of the game code. Ended up using cramfs for that. ___ 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: Memoryleak in SpriteKit?
On 9 Apr 2014, at 9:58 AM, Jens Alfke j...@mooseyard.com wrote: Frankly, I don’t even know what that memory-usage graph in Xcode’s debugger pane is showing. I’ve found that “memory usage” is a slippery concept in a modern OS, and unless you know exactly what you’re looking at, it’s easy to draw the wrong conclusions. (Obvious example: people looking at VMSIZE and thinking their app is using a gigabyte of RAM.) My memory (h’m) is that it’s RPRIV. Not a great measure, but it’s supposed to be lightweight, and anything more accurate is a _lot_ heavier. It’s a canary for runaways, not a precise gauge of ebb-and-flow. — F -- Xcode 5 Start to Finish — not so bad. Gone to press this week. ___ 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: To find if a file is fragmented
On 8 Apr 2014, at 9:19 AM, Nick Rogers roger...@mac.com wrote: I just need to know, if a file is fragmented or not. I don’t need the frags details etc. Its for showing extended info about the selected file, like whether it is fragmented or not. Is it possible with out raw reading the volume (for its catalog file)? I have also seen Carbon File Manager’s FSGetCatalogInfo() and fstat() and they don’t return this info. I agree that it’s an implementation detail of the filesystem, and in any event not a matter for a Cocoa discussion list. In a modern file system, physical storage of files is either meaningless, or always (three-nines) fragmented, barring first write on a virgin disk. — 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
Re: error details in a NSAlert
On 6 Apr 2014, at 2:52 PM, Daniel Luis dos Santos daniel.d...@gmail.com wrote: I want to display some text indicating a list of errors the user should correct before submitting data. I am using a modal NSAlert in which i set a message with a localised string from a table. I want to include the error details and for that I was setting the informativeText field but it doesn’t show up unless its a string literal. I need it to be a variable value. That’s not what I see. I made a quick experiment, with the stock Cocoa/AppKit template. I dropped a text field into the window, and a button to trigger an alert. doAlert: harvests the informative-text string from the field, which means the string can vary. Everything else is the same as your code (stripped of the accessory view, which you describe as being merely an attempt to work around the failure of the informative text to appear). Note that you should set the informative-text format to the string you want to display; use %@ and then the string. What this suggests to me is that your “informativeText” variable is not what you assume it is. Have you set a breakpoint before you create the alert, and inspected it? — F #import KVAAppDelegate.h @interface KVAAppDelegate () @property (weak) IBOutlet NSButton *alertButton; - (IBAction)doAlert:(id)sender; @property (weak) IBOutlet NSTextField *informativeField; @end @implementation KVAAppDelegate - (void) awakeFromNib { self.informativeField.stringValue = @This space for rent.; } - (IBAction) doAlert: (id) sender { NSString *informativeText = self.informativeField.stringValue; NSAlert * errorAlert; errorAlert = [NSAlert alertWithMessageText: NSLocalizedStringFromTable( @The user data is not valid. Correct it and try again, @AccountInfoTab, @The user data is not valid. Correct it and try again ) defaultButton: nil alternateButton: nil otherButton: nil informativeTextWithFormat: @%@, informativeText]; [errorAlert runModal]; } @end ___ 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: Ordered to-many relationship CoreDataGeneratedAccessors
On 29 Mar 2014, at 3:11 AM, Rick Mann rm...@latencyzero.com wrote: I'm getting -[WireSegment replaceObjectInNodesAtIndex:withObject:]: unrecognized selector sent to instance When I try to send that message. This is one of the CoreDataGeneratedAccessors, for an ordered to-many relationship. I don't see anything in the docs about those. What am I missing? -- Rick I assume WireSegment is an object variable despite the name. I believe that what KVC is giving you for .nodes is an NSSet. What you want to do is [[wireSegment mutableOrderedSetValueForKey: @nodes] replaceObjectAtIndex: anIndex withObject: newObject]; … which you’d likely want to wrap in a method of your own. I think. Written in Mail, uncompiled, untested. — 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
Re: Cocoa-dev Digest, Vol 11, Issue 170
On 29 Mar 2014, at 2:42 PM, Rick Mann rm...@latencyzero.com wrote: Oh, thank you! My googling turned up all sorts of stuff for the old accessors, but I couldn't find anything about this. I wish they'd generate the stubs like they used to. On Mar 29, 2014, at 09:11 , Rick Aurbach rla...@me.com wrote: Rick, I believe you’ve run into the well-known problem of Core Data’s missing Ordered Set accessors. The documentation says that Core Data provides accessors for ordered sets, but (at least in iOS 5, which is the last time I looked), it doesn’t. This has been radar-ed; the workaround is to provide your own accessors. Annnd… I’ve fallen victim to someone breaking the thread by replying to the digest instead of the subject. Never mind. — 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
Re: Understanding Application crash
On 25 Mar 2014, at 12:48 AM, Appa Rao Mulpuri appar...@ivycomptech.com wrote: All of this depends on your being able to produce the exception at least once. I agree that this is easier said than done. Exception type is: ERROR 2014-03-22 08:21:59 +0530 An uncaught exception occured Name: NSUncaughtSystemExceptionException Reason: Uncaught system exception: signal 11 Have you set an exception breakpoint? (Seventh inspector tab, cmd-7, click the + button at the bottom and select Add Exception Breakpoint. You’d probably be well-served to right-click on the new exception to get the breakpoint editor, and restrict it to Objective-C exceptions.) 4 libsystem_c.dylib 0x7fff8770394a _sigtramp + 26 5 ??? 0x 0x0 + 0 6 AppKit 0x7fff8d3ed7b7 -[NSControl sendAction:to:] + 85 Since the exception is triggered by a control sending its action, the problem is likely that the object that¹s the target of the control got deallocated. Agreed, Since this exception is getting rarely. Do we have any provision to extend the stack trace to print in which method the object is getting deallocated in our class? You might learn something from Instruments: Add the Allocations instrument to your trace document, click the (i) button, and check “Record reference counts” and “Enable NSZombie detection.” Click the (x) button, and hope you can reproduce the crash. If a message to a zombified object gets trapped, note the address, display the allocation history in the detail (bottom) area, and put the address in the search field. You should be able to see where any objects with that address were allocated, and the retain/release history. Open the Extended Detail view (View control in the toolbar, third segment); you’ll be shown a stack trace for any event you click on. That does assume the zombified object gets messaged before this exception. (I am delighted/dismayed to find that “zombified” is apparently in the Apple spelling dictionary.) — 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
Re: EULA presentation requirements?
On 10 Feb 2014, at 10:25 PM, rick.langschultz rick.langschu...@me.com wrote: Doesn't [EULA] stand for end-user LICENSE agreement, aren't such licenses prohibited per the clear language in the agreement as outlined? My rule, if you have a question about it, don't. I must not be clear on your meaning. First, the review guidelines cited refer to the iOS Human Interface Guidelines, which relate to user experience, not the behavior or legal affairs of the app in general (those are covered by the review guidelines themselves and the terms-of-use for iTunes Connect). The HI guidelines certainly discourage (I’d forbid) withholding the value of your app by loading it up with advertising (splash screens), tap-through disclaimers, and EULA notices. But developer-specific EULAs, as such, are certainly not forbidden; indeed, they are supported. The iTunes Connect registration process allows developers to substitute their own licenses for those in the iTunes Terms and Conditions, so long as they afford Apple no less protection than it demands for itself. Custom EULAs are displayed in the purchase process. Maybe that’s what you meant to say. I would not consider adopting a custom EULA without including it in the iTunes Connect registration — you’d likely be bound by the iTunes EULA rather than your own. You can have different ones for different jurisdictions, or forbid distribution in jurisdictions for which you can’t provide a EULA. (In other words, don’t indulge the hope that a German EULA will work in Saudi Arabia — look back in this thread.) It’s also a good idea to have an “about” popover/view that presents the EULA for inspection (without forcing it onto the screen), or at least a prominent link to the current EULA (consult counsel on how to go about changing the license on existing purchasers). — F -- Xcode 5 Start to Finish — crafted by artisans for your enlightenment. April 2014. ___ 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: bouncing icon in dock
On 12 Mar 2014, at 12:15 PM, iseecolors iseecol...@rsqrdc.us wrote: I do override sendEvent:, but I don’t see how that would matter. Begging pardon, but I’d think your next move is to see whether it _does_ matter. If you saw that something in your code would matter in causing a bug, you’d have fixed it already, right? So the problem is in something you _didn’t_ see, and now you have to look, not just “see.” Take out the override. Do you call through to super? I’m betting that you aren’t duplicating _everything_ NSApplication does with that method. — 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
Re: NSArray's objectAtIndex compiles to objectAtIndexedSubscript?
On 7 Mar 2014, at 6:54 AM, Bill Cheeseman wjcheese...@gmail.com wrote: My code calls -[NSArray objectAtIndex:]. I compile it with Xcode 5.0.2 on OS X 10.9.x Mavericks in a project with the target's Base SDK set to 10.9 and the OS X Deployment Target set to OS X 10.7. It works fine when I run it on OS X 10.9 or OS X 10.8. However, when I run it on Mac OS X 10.7 Lion, I get a runtime error claiming it encountered an invalid argument, namely, the unrecognized selector -objectAtIndexedSubscript:. The NSArray Class Reference notes that -objectAtIndexedSubscript: is available only in OS X 10.8 and later, and that it is identical to objectAtIndex:. Of course, -objectAtIndex: still exists in the 10.9 API, and it is not marked as deprecated. It appears, therefore, that the compiler generated a call to -objectAtIndexedSubscript: even though my source specifies -objectAtIndex: and a deployment version of 10.7. I tried a Foundation command-line tool, 10.9 SDK, 10.7 deployment: int main(int argc, const char * argv[]) { @autoreleasepool { NSArray * myArray = @[ @alpha, @beta, @gamma, @delta ]; NSString * zerothString = [myArray objectAtIndex: 0]; NSLog(@The string is %@, zerothString); } return 0; } Note that I’m using an array literal, which is backwards-compatible, and you’d think that might tempt the compiler to emit objectAtIndexedSubscript:. My disassembly of main.o (Hopper Disassembler, UI a bit odd, but very valuable) shows no reference to objectAtIndexedSubscript:, so it’s not the compiler. There is a reference to _objc_msgSend_fixup, which you’d expect to be generic. The runtime _might_ special-case objectAtIndex: as an alias for objectAtIndexedSubscript:, but that’s a runtime issue, not compile-time. I saw nothing in the public source of the runtime, but I didn’t put much effort into it. And wasn’t the indexed-subscript notation supported in ObjC in late 10.7.x? And I seem to remember that objectAtIndexedSubscript: was implemented then (and retroactively supported as “public” API in 10.7 MAS submissions). I may be wrong about the chronology. See the Assembly assistant while your code is in the main editor. This is all bloviation on what Jens said: Check the backtrace. — 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
Re: secure uitextfield is not secure
On 5 Mar 2014, at 1:17 PM, Luther Baker lutherba...@gmail.com wrote: I'm generally a big fan of Cocoa Touch - but why does the secure option on a UITextField still display the character you are typing? Touch keyboards offer almost no user feedback compared to physical ones. The keys on the iPhone keyboard are, to my thinking, too small to operate reliably. My hands are on the clumsy side of normal, and my error rate on the iPhone is about 10–20%. Left blind, there’s no way I could ever enter a correct password. And, is there any way I can turn this off? I’d be surprised. iOS meets the (low-level, but nontrivial) security standards of a number of governments, and if I owned UITextInputField, the fewer hooks into password security, the better. At least, I don’t see any such hook in the API. File a radar. Its generally hard to get non-employee AD credentials created or to stand up DEV Active Directory services ... so everywhere I've ever worked, folks like me are always entering their real AD creds in the app during development. This is embarrassing when you are pairing and even worse, was in a demo today and the leader is asking everyone not to look while they entered their AD credentials in front of a whole host of people. At an institution with HIPAA/FERPA/national-security exposure, exposing live credentials to development, much less demos, is a felony waiting to happen. I’m trying to swear off of impugning others’ professionalism (and I have no reason to impugn yours), but if software development is part of the company mission, it’s the admin’s job to support that mission. My long-run strategy would be to escalate the matter on my management chain. If there is a privacy/security organization, let them know the risks of the current situation in the most gruesome terms you can muster. I guess one could write something to work around this ... People have tried to implement text field look-alikes (or heavily hooked text fields) that sort-of do what you want, but it’s easier said than done. It’s close to a from-scratch proposition. And, Apple is always going to provide a better, more-secure password (or even plain-text) field than you can build for yourself. There’s more to security than screen appearance. I understand what you’re saying, and I sympathize, but I don’t _think_ Apple is going to make it a priority to help you. Apple will argue that it can’t assume the user’s responsibility to keep live assets off projection screens, and to look over his shoulder before entering a password. The only way to find out is to file a radar and see what comes out in iOS 8. In the mean time, yeah, you’ll have to use the delegate methods to hot-swap bullets for typed characters. but does anyone know if that is really necessary - and what would have motivated Apple to implement textField.secureTextEntry this way ... or not provide a textField. *really*SecureTextEntry option which would mask ALL the characters. Maybe an option that doesn't even show how many # the user is actually typing. I'm surely not counting 14+ characters anymore. Anything that encourages people to adopt passwords short enough to survive a 15% error rate is not secure at all. — 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
Re: tableView - message sent to deallocated instance
On 25 Feb 2014, at 2:39 PM, Pax 45rpmli...@googlemail.com wrote: This is a really weird problem (in my view, anyway), because it only occurs in a very particular set of circumstances. My application is NSDocument based (just in case it makes a difference), and my application uses ARC. [Detailed description of various does-work execution paths] If I open the document and then double click on a file in the list, but then close my document **before** closing the newly opened file my application crashes with message sent to deallocated instance. You don’t say whether you have profiled the app with Instruments, using the Zombies template, which is the first-resort method for handling this situation. Product Scheme Edit Scheme… (cmd-), and make sure the target you want to investigate is selected at the top-left popup. Select the Profile action, and then Zombies in the Instrument popup. Run the Profile action (various ways, including Product Profile, cmd-I). Reproduce your bug, and examine the Allocations trace to see the retain/release history of the object in question. At least you’ll know more, and can refine your question. — 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
Re: NSNumber : method to return pointer to represented value
On 21 Feb 2014, at 6:12 AM, jonat...@mugginsoft.com wrote: I require an pointer to the value represented by an NSNumber. (Assuming “value represented” means @1 - 1, @HUGE - HUGE.) No interior pointer exists as the class is immutable. Immutability isn’t the point. The point is that the class is free to represent the value any way it wants. As you point out, integers in the range (I believe) +/- 2^55 are “stored” as tagged pointers; others in one form of internal data or another. My best attempt, a category that shadows the represented value, is as follows though I am wondering if I have missed a trick somewhere. NSNumber uses tagged pointers and my unit tests indicate that the category works okay with tagged pointers such as @(1). [elaborate code that uses size-for-subclass and runtime associated objects to get the represented value as NSData, and cache the NSData with each NSNumber; further use of the NSData not clear, nor why it may be assumed that every instance of [NSNumber numberWithFloat: 3.14] would deliver the same object with the same associated object] Why do I need the pointer? I am using NSNumber instances in collections as keys. (Assuming that the collections are sparse, so an array [a collection indexed by integers] isn’t practical. And if they aren’t integers, you’re in more trouble than this.) In order to index a Mono collection with the NSNumber instance I require to pass a pointer to the represented value to Mono. All part of https://github.com/ThesaurusSoftware/Dubrovnik (A project large enough that I don’t have time to clear up what I’m not certain about.) Am I right that all you need is a pointer to a plain-old-data (C scalar) variable? Am I right in assuming that your Mono interface doesn’t care whether “5” is at a consistent address, so long as there’s a 5 in it? (Very strange otherwise.) And once the interface sees the value that’s pointed-at, it doesn’t keep the pointer? I must not understand, then, because this makes more sense to me: int five = 5; SomeMonoCall(here's two more than three: , five); I _know_ I’m missing something. Could you clarify? Also, if you _really_ need a consistent POD pointer for every NSNumber, and you can somehow work out the uniquing problem, why not have a “number” class that contains an NSNumber and a buffer big enough to contain the bits of any possible value? (You’d probably need a tag for the type, as well, but you see where I’m going. Do POD unions still work in ARC?) (And if you need to support all NSNumber methods as well, see -forwardingTargetForSelector:, which would be tedious to set up, but there should be tricks, and you can fall back on -forwardInvocation: to clear up unexpected selectors.) — 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
Re: Changes in -performSelectorOnMainThread: from iOS 6 to 7?
On 12 Feb 2014, at 1:29 PM, Rick Mann rm...@latencyzero.com wrote: I think you misunderstand my question. I know about the new concurrency types. I'm not interested in that. I want to know why my old code works better on iOS 7 than 6. Given that the new concurrency method goes back a couple of years (iOS 5), surely your interest in how the old way works is academic? — F -- Xcode 5 Start to Finish — due in stores March/April 2014 ___ 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: Changes in -performSelectorOnMainThread: from iOS 6 to 7?
On 11 Feb 2014, at 6:04 PM, Rick Mann rm...@latencyzero.com wrote: I'm updating an old project that was built long ago, skipping udpates for iOS 5 6. One of the things my app does, in an NSOperation, is call -performSelectorOnMainThread: (waiting until done) as it integrates downloaded data into the Core Data store (Core Data operations all happen on the main thread). In iOS 6, this can bring the app to a grinding halt, despite the fact that each record integrated is done as a separate -performSelector call (I would've thought that'd let the main thread handle user events). In iOS 7, it actually works really well, leading me to believe something changed in the way this is handled. Any insight? Thanks! http://stackoverflow.com/questions/8637921/core-datas-nsprivatequeueconcurrencytype-and-sharing-objects-between-threads It contains a reference to a WWDC video. Then search the Apple docs for NSMainQueueConcurrencyType, and follow the links from there. — F -- Xcode 5 Start to Finish — due in stores March/April 2014 ___ 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: EULA presentation requirements?
On 10 Feb 2014, at 7:36 PM, SevenBits sevenbitst...@gmail.com wrote: What's funny is that Xcode - distributed through the Mac App Store - does show a license screen at first launch. This would mean that Apple is breaking its own rules, if in fact that clause means what you say. Old Latin aphorism, which has applied to Apple-platform development since 1984: “Quod licet Jovi non licet bovi.” “What is permitted to the Father of Gods is not for the cattle.” Apple has _always_ adopted human-interface elements that are unsupported by the SDK, or forbidden by its HIGs. --- As for the EULA (and we have experience only with the iOS App Store), look up the iTunes Terms and Conditions. http://www.apple.com/legal/internet-services/itunes/ww/. It includes a EULA with more-or-less standard disclaimers along the lines of “if the app kills your children, we’ll refund the cost of purchase.” You’ll also notice that there are some 150 TC statements. U.S. common law, Vietnamese Communism, and Saudi Shari’a are apt to have different requirements for the written language of contracts and the substance of disclaimers of liability. When I pointed this out to our intellectual-property office, which wanted a custom EULA, they required the app’s distribution be limited to the United States. (They later relented, which was a relief when we got to a reader for the French Encyclopédie and various readers and dictionaries for Classical Greek. There are rather a lot of francophone jurisdictions.) Turn the U.S. Terms and Conditions over to your management, and see if they can live with it, especially compared to giving up international distribution (which prudence dictates you’d have to). — 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
Re: Getting QuickLook to work with NSDocument
On 8 Feb 2014, at 5:32 AM, Pax 45rpmli...@googlemail.com wrote: I'm trying to get QuickLook preview to work with NSDocument - much as in the QuickLookDownloader example provided by Apple. I thought I had it all set up correctly - #import Quartz/Quartz.h @interface Document : NSDocument NSToolbarDelegate,QLPreviewPanelDataSource, QLPreviewPanelDelegate { QLPreviewPanel* previewPanel; } Something is clearly amiss though - because acceptsPreviewPanelControl is never called. Does anyone know of any really simple, dumbass examples (simpler even than QuickLookDownloader) that might help me untangle this conundrum? An is-it-plugged-in question: Have you set the “Document” object (a worse-than-unwise choice of class name, by the way) as the preview panel’s delegate? — 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
Re: Core Data : Synchronizing objects with SQLite file
On 7 Feb 2014, at 3:58 PM, Jerry Krinock je...@ieee.org wrote: Executing an ‘update’ query with another program upon the SQLite file, I changed a different attribute of the problem object. Upon re-executing the fetch request in lldb, the problem object was now a fault. I then sent [myObject foo], which still returned nil, but this apparently caused the data to be “faulted in”, because a subsequent fetch request in lldb no longer showed a fault, but now showed all of the old data. That is, foo=nil still, and the different attribute was still at its old value. Do I misunderstand how this stuff is supposed to work? Am I correct that you routinely use your Core Data store as a straight SQLite database? Not just peeking with a browser or the sqlite3 command line? If I do understand you correctly, that’s a “voids your warranty” situation. The Core Data schema is proprietary, and accessing it directly may have… unanticipated effects, no matter how confident you are in your reverse-engineering. My strategy (off the top of my head): 1. Work out a way not to use SQLite directly. 2. Write a command-line tool that recovers your data, one way or another. 3. Write it to a clean CD store. 4. Serve and enjoy. — 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
Re: Legal Opinion on GCUndoManager
On 29 Jan 2014, at 11:24 PM, Jerry Krinock je...@ieee.org wrote: On 2014 Jan 29, at 13:03, Keary Suska cocoa-...@esoteritech.com wrote: unfortunately it [GCUndoManager] is not App Store safe … as it relies on a private method call for proper NSDocument change tracking… I just spent the last half hour studying this and wrote my own concise legal opinion arguing why GCUndoManager is OK. Now having read Graham’s post, it’s probably redundant. But I’m posting it here anyhow in case I or anyone else ever needs it :) Although -[NSUndoManager _processEndOfEventNotification:] is a non-public API, -[GCUndoManager _processEndOfEventNotification:] is NOT a non-public API. As a matter of fact, it is not even an Apple API! It’s the same as if I defined a class CorePerformer and innocently named a method -[CorePerformer _corePerformAction]. There also happens to be an Apple non-public method -[NSMenuItem _corePerformAction]. Certainly my definition should not result in an app store rejection. I can’t offer legal opinions or advice (retirees from the bar are particularly forbidden to do so), but this isn’t a matter of law. Apple says explicitly that the guidelines are only that: a description of the principles that characterize a completely discretionary process. They are not rules, because there are none. Rules (binding promises) could be gamed to defeat Apple’s purpose in conducting reviews. Legalism does no good (as is so often the case in life). Apple says it will do no good. If I were implementing the review process, my automated checker would run strings(1) on the binary, and flag the collision with private API. Under my notional process, the reviewer would have to reject, because he has no way of knowing how the selector is used; or, even if your use is innocent, whether it propagates down into the framework so the collision with private API happens anyway. You could appeal, and may win — solely on the technical question — but if I’m right, the app would not simply sail through to acceptance. — 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
Re: Xcode 5 Obj-C++
On 30 Jan 2014, at 4:14 PM, Jens Alfke j...@mooseyard.com wrote: And C++ partisans would tell you that many of these things are limitations of the usual C++ runtimes, not the language itself, but I'm not aware of any current runtimes that avoid them. For reference, see http://en.wikipedia.org/wiki/No_true_scotsman. — 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
Re: Legal Opinion on GCUndoManager
On 31 Jan 2014, at 11:46 AM, Quincey Morris quinceymor...@rivergatesoftware.com wrote: On Jan 31, 2014, at 09:32 , Fritz Anderson fri...@manoverboard.org wrote: I can’t offer legal opinions or advice (retirees from the bar are particularly forbidden to do so) … I can’t help asking: Was the retirement voluntary, or did the bar just close at 2 am? Earlier than that. All the patrons wanted to do was fight with each other. [Off topic. No more responses to jokes, I promise.] — 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
Re: What iOS device?
On 31 Jan 2014, at 12:45 AM, KappA rejek...@gmail.com wrote: I came across this the other day. Have you already looked at this? http://stackoverflow.com/questions/448162/determine-device-iphone-ipod-touch-with-iphone-sdk Very strange that nobody (until I did) noticed that if you want to convert from one unique constant NSString to another, you use an NSDictionary, not a cascade of if ([a isEqualToString: @b]) return @c; And if you load a plist instead of hardcoding every damn pair, your code gets a lot simpler. Sigh. This is always the point where I miss something crucial… — 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
Re: Non-breaking hyphen in UILabel?
On 24 Jan 2014, at 2:19 AM, Rick Mann rm...@latencyzero.com wrote: Thanks. That certainly works, but I found the trick: set the line break mode for the whole thing to word, and put in the non-breaking hyphen using the Special Characters palette. I see there is such a thing as a nonbreak hyphen (U+2011) but the traditional Mac keyboard never emitted it. Opt-minus is an en dash (U+2013). For visual effect, it may serve your intention, but it does not parse the same. — 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
Re: IOBluetoothDeviceSelectorController and NSImage compositeToPoint
On 21 Jan 2014, at 3:52 AM, Livio Isaia lis...@tiscalinet.it wrote: when I call (self is NSObject NSApplicationDelegate) [deviceSelector beginSheetModalForWindow:[self window] modalDelegate:self didEndSelector:@selector(browseEnd: returnCode: contextInfo:) contextInfo:NULL] in the output window appears *** WARNING: -[NSImage compositeToPoint:fromRect:operation:fraction:] is deprecated in MacOSX 10.8 and later. Please use -[NSImage drawAtPoint:fromRect:operation:fraction:] instead. does anybody know what I can do to avoid this? I think I’ve installed the latest xcode sdk... I don’t have the whole story, but some system APIs emit warnings like that routinely. If your audit of your code convinces you you are passing the proper arguments, and the method works properly, you can ignore them. It’s Apple’s problem, and Apple will correct it before it affects your applications. — 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
Re: Resizing Detail View of UISplitViewController
On 9 Jan 2014, at 8:49 AM, Viacheslav Karamov ubuntul...@yandex.ru wrote: I'm using a UISplitViewController in my iPad app and I don't really like the way the popover view slides in and covers a third of the screen and stays there when in Portrait mode. I want it to look like it does when in Landscape mode. How can I resize the overall detail view including navigation bar? In other words, you’d like the sidebar to be present at all times, and for the remainder of the screen to be narrow, instead of being covered. Right? You can’t do that with UISplitViewController. Since you don’t need to track the visibility of the sidebar, it’s trivial to build your own. Look up container view / child view controller. There may be hacks to force UISplitViewController to do what you want, but they’d be harder to do than building your own solution, probably fragile, and probably unacceptable to the App Store reviewers. — F -- Fritz Anderson fri...@mac.com Xcode 5 Start to Finish: Available April 2014 from Addison Wesley ___ 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: Auto Layout with NSSplitView, NSScrollView
On 4 Jan 2014, at 1:38 PM, thatsanicehatyouh...@me.com wrote: I like your user name. I have a couple of questions about using auto layout (AL) with NSSplitView and NSScrollView. I have watched the (excellent) WWDC videos from 2012, but am having problems. I'm trying to implement an NSSplitView [… that collapses one of the views if the user resizes it below a set minimum.] The next thing I’d try (meaning I have no experience and no time to make the experiment; others’ solutions would trump mine; and I seem to remember this is a solved problem to be found in the archives of this list, Stack Overflow, or [ugh] the Developer Forums) is to see whether listening to the collapsing view’s NSFrameDidChangeNotification was of help. If the frame goes below minimum width, replace the width constraint with a zero. This does involve more code than you’d hope the constraint mechanism would require, but I don’t think the option is available. Sometimes (often) Apple’s automated services require more and harder code to handle needs that go beyond the basic. (One could debate whether the old split-view behavior wasn’t basic, but even it had its problems.) Constraints for contained views would tend to push the collapsed view’s width out, but reducing the priorities of some of the constraints on the views that would push back should take care of that. Secondly, I have a button that loads a large image into an NSScrollView into one of the split view's panes. I have a slider to scale the image down. As the image scales, I'd like it to remain centered. I have this working with auto layout, but the container NSImageView is not resizing. It needs to resize down to but not smaller than the clip view (I want to show a background color). Can someone suggest how to do this as well? You know the size of the image, and of the clip view, and therefore the range of valid zoom levels. Can’t you limit the values the slider reports (or the controller accepts) so the zoom doesn’t go below minimum? — 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
Re: How is my CFRunLoopTimer getting called during a CFReadStream client callback? ANSWER
On 5 Jan 2014, at 8:31 PM, Jim O'Connor jocon...@orderndev.com wrote: XCode hides stack frames it thinks are unimportant. Like the stack frame that had the CFRunLoop in it inside a CFMessagePortSendRequest. I found the problem when I copied out the stack crawl to show a friend, and low and behold there were 4 extra stack frames in there… I understand the problem. If it’s biting you, it should be taken seriously, but I have a quibble. Xcode draws a line across the stack trace where frames are elided; and it provides a slider at the bottom of the Debug navigator to control how aggressive the elision is. It’s not obvious, but it isn’t hidden. There’s a tradeoff between making the feature self-documenting and keeping it from being so blatant that it distracts from the principal content of the view. Self-documentation of something that can’t be explained briefly, and is very peripheral _once you know about it,_ is Hard. Making the line solid and three points wide, instead of dotted and one point, wouldn’t be enough. But people miss the feature as currently implemented, it can be mislead them, and it can waste their time — as it wasted yours. I’m not saying you’re wrong, or that Apple shouldn’t spend resources on solving the problem, but it is a problem to which I see no easy solution. (And anyway, the current system is lucrative for me.) — F -- Fritz Anderson fri...@mac.com Xcode 5 Start to Finish: Available April 2014 from Addison Wesley ___ 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: NSShadow with [bezierPath addClip]
On 31 Dec 2013, at 6:15 AM, Leonardo mac.iphone@gmail.com wrote: In my NSView subclass, I have to draw an image within a bezierPath and apply an NSShadow to the result. So within the drawRect: method I add [bezierPath addClip]; [mImage drawInRect:inRect fromRect:fromRect operation:NSCompositeSourceOver fraction:mOpacity]; It works. The image gets clipped by the path. Now I would like to apply the NSShadow to the result, so before those lines above I add [bezierPath addClip]; [mShadow set]; [mImage drawInRect:inRect fromRect:fromRect operation:NSCompositeSourceOver fraction:mOpacity]; I can't get the shadow drawn because the bezierPath is clipping the drawing area where the shadow should fall. How to solve this trouble? I have tried to use a layer, but I get weird results when I resize, rotate and modify other parameters of the view. This worked for me: - (void) drawRect:(NSRect)dirtyRect { NSBezierPath * bezierPath = [[NSBezierPath alloc] init]; [bezierPath appendBezierPathWithRoundedRect: self.clipPathRect xRadius: 10.0 yRadius: 10.0]; [bezierPath setLineWidth: 0.0]; NSGraphicsContext * context = [NSGraphicsContext graphicsContextWithWindow: self.window]; // Clear the view [context saveGraphicsState]; { [[NSColor whiteColor] set]; [NSBezierPath fillRect: dirtyRect]; } [context restoreGraphicsState]; // Stroke the (zero-width) clipping path [context saveGraphicsState]; { [self.shadow set]; [bezierPath stroke]; // No width means no visible boundary line, // but the shadow is still drawn. } [context restoreGraphicsState]; // Draw the image, clipped to the path [context saveGraphicsState]; { [bezierPath addClip]; [_image drawInRect: self.clipPathRect fromRect: self.selectedSourceRect operation: NSCompositeSourceOver fraction: self.imageFraction]; // The image obscures the inner shadow. // Bug: The shadow shows through to the extent imageFraction 1. // Can the shadow drawing be clipped to the inverse of the clipping path? } [context restoreGraphicsState]; } — 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
Re: NSTextTable with only certain text selectabled
On 21 Nov 2013, at 10:55 AM, Andrew Arrow one...@gmail.com wrote: How do I make a drag select on a NSTextView with an NSAttributedString that contains a 2 column NSTextTable, only select the text in the 1st column? You can see a video of the mac app skype doing this here: https://dl.dropboxusercontent.com/u/2510380/skype.mov What leads you to believe that Skype is using the very specific technique you ask about? Did you point a debugger at it? Disassemble? From what I see in the animation, your guess looks very unlikely. Assuming your actual goal is to select across disjoint text containers: A quick examination of the API persuades me that the option isn't available in a single NSTextView. There's no royal road. I'm sure there's some way to do it in HTML/CSS/JavaScript, but I can't help you there. What you can do is to divide the column into a series of NSTextViews. There is a text-storage (attributed string) with the full contents of the column. It is associated with one layout manager. Ask the layout manager for the height of each block of text you want to put on its own row, and initialize a container from it. Put each container into its own NSTextView. See xcdoc://osx/documentation/TextFonts/Conceptual/CocoaTextArchitecture/TextSystemArchitecture/ArchitectureOverview.html (assuming Xcode documentation URLs work; it's Cocoa Text Architecture Guide Text System Organization Creating Text System Objects Your App Creates the Objects Explicitly) Also TextSizingExample in the sample code. My experiment shows that if you drag down from one text view to the next, the selection spans the views. There's no question of the selection spilling out to other views, because the text system never sees them. This is the first thing that comes to mind, from WWDC ~2005. I haven't done this sort of thing in years, and I'm probably missing some technique the kids are using these days, with their bow ties and hipster music. I can imagine doing something by hit-testing the table drags and being clever with the setSelectedRange: family, but that's worse. — 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
Re: UISlider with custom images narrow thumb
On 21 Nov 2013, at 8:36 AM, John Spicer jspi...@synacor.com wrote: I'm trying to get a UISlider working with custom images. I've gone through the docs, and I know how to set the images. The question (and the problem) is a little different. Our design department has given us a thumb image that is wide at the bottom, and narrow at the top (1 pixel). When I use this image, it does not line up properly with the current value of the slider. UISlider takes a UIImage as its thumb image. UIImage and UISlider do not care about the bit-by-bit drawable content of the image. All they know is that if you initialize a UIImage from a 24 x 24-point PNG, the image is 24 x 24 points in size. Is the drawn content 24 x 24 of black pixels? A circle, which is necessarily 24 points wide at the middle? 24 x 24 of transparent pixels? A black triangle that's half the pixel width at the middle? Does not matter. The thumb image will be drawn so at the extremes of the slider, the image (not its drawn content) is flush against the end of the track. Run the experiment with two sliders, one with your image and the other with the default one, and you'll see they behave identically. They line up properly; they just don't line up as you'd hoped. All the examples I've seen on the net show a thumb that's fairly fat and round – never one like I've been given. The docs don't SAY you have to use a fat one, but it seems implied. And anyone who attempts anything else soon finds out. If you care, find the part of the documentation where you think the warning ought to go (maybe the Sliders section of UIKit User Interface Catalog), and click the feedback link. So the question is: can I use a thumb like this, and if so, how do I get the positioning of the narrow top of the image (center) to align with the current value of the slider? Your premise is incorrect. The thumb _is_ aligned with the current value of the slider. What surprises you is that you didn't know that UISlider does not draw the thumb outside the frame of the control, and that you assumed UISlider knew, in this particular case, what part of the thumb you find most significant. If the track is the problem, use a house shape, or a diamond, or something else that takes the full width of the image at the middle. Or maybe you can do something with the track images like providing images that are transparent for as much of the track as you want to hide. If you're trying to line up with tick marks in an adjacent view, place the marks to line up with the actual positioning of the thumb. — 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
Re: DockTile sample code, Principal class is DockTile ?
On 28 Nov 2013, at 5:13 PM, Eden zeppenw...@lafn.org wrote: In Apple's DockTile sample code there is a an app and a dock tile plug-in. In the DockTilePlugIn-Info.plist, the Principal class is valued as DockTile, but there is no such class-- the class in the source code is DockTilePlugIn. Isn't that a mistake? But the thing works anyway? The name of the bundle is DockTile.docktileplugin, so... does Principal class really refer to the name of the bundle? Regardless, I can change the name of the finder file and it still works. In fact, I can delete the value for Principal class and it still works... although I can't be sure the working version of something wasn't cached somewhere... Probably a foolish question, but this is my first time with loadable bundles, I just want to understand... The setting in Info.plist is a bug. The reason it works is that when -[NSBundle principalClass] can't find a class from Info.plist, it falls back to the first class loaded, as determined by the link order of the plugin. As the plugin consists of only one class, the fallback happens to be correct. Documentation bug filed. — 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
Re: NSArray firstObject?
On Dec 22, 2013, at 11:31 AM, Trygve Inda cocoa...@xericdesign.com wrote: [Quotes the documentation that says -[NSArray firstObject] is available since Mac OS 10.6.] This seems to be an error in the docs as the method does not seem to exist for me. I didn't see the method at all in the docs until I drew upon a very recent version of the documentation, and I see what you see. On Dec 22, 2013, at 11:46 AM, Michael Starke michael.sta...@hicknhack-software.com wrote: It's been a private API until 10.9 and iOS 7. Clearly a documentation error. That's not what NSArray.h says… - (id)firstObject NS_AVAILABLE(10_6, 4_0); … and that's closer to what I remember. Perhaps it was private at the time the 10.6 SDK was first published, but made available retroactively later. But you should be able to find it in the SDK — what version are you building against? — F -- Xcode 5 Start to Finish — due in stores in April ___ 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: AutoLayout and and views not appearing after segues.
On 10 Dec 2013, at 8:58 AM, Alex Zavatone z...@mac.com wrote: I've just run across a nasty behaviour where with AutoLayout on iOS 7, sometimes a view will not appear at all after a segue. The scary thing is that this is intermittent, and will either happen all the time for a build or never for a build. Turning off AutoLayout appears to fix the issue, but I need to test more. This is verified under Xcode 5.0.2 and iOS7 on both the simulator and on an iPhone5. Has anyone else seen this? I've seen this when a constraint chain either pushes the view off-screen or collapses it to zero on one axis or the other. The conflict might not strike every time, because autolayout's response is indeterminate (other than logging the problem), and you've mostly been lucky. If you're developing for iOS 7, you're running Xcode 5.x, and I pray you've set the file for the Xcode 5 file type. Using the controls at the bottom-right of the Storyboard canvas, set the idiom to iOS 7. Open the Assistant editor and choose Preview. See what happens as you fiddle around with orientation and screen size, again with those controls at bottom-right. If something disappears, select it in the document outline (left side of the canvas, expandable with the button at bottom-left), and see what the Size inspector says. If that doesn't help, see what repeating those variations in the iOS (7) Simulator does. Some autolayout surprises show up only on a (simulated) device. But if I'm right, then surely you'd have gotten warnings, both in the console at runtime, and in the form of yellow and red badges in the document outline next to the controller names. (Click one and get a list of issues; clicking one of those will get you a popover offering solutions. And, the scene itself would show in yellow the layout each view _ought_ to have if autolayout were fired. You'd have mentioned this, so all I can say is that in my own experience, this the only way I saw what you're seeing. One approach that helped me was to use the elegantly-named Editor Resolve Auto Layout Issues submenu to clear out all the constraints in the scene, and then generate IB's guess at what the constraints ought to be. The result is unlikely to be good enough for release (try the orientations, idioms, and sizes to see), but at least you'll have a fresh constraint set to work from. — 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
Re: AutoLayout and and views not appearing after segues.
On 10 Dec 2013, at 1:41 PM, Fritz Anderson fri...@manoverboard.org wrote: Using the controls at the bottom-right of the Storyboard canvas, set the idiom to iOS 7. Open the Assistant editor and choose Preview. See what happens as you fiddle around with orientation and screen size, again with those controls at bottom-right. That was sloppily-expressed. The Preview assistant has orientation, size, and idiom controls of its own. — 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
Re: ToolTips for Matrix Cells
On 3 Dec 2013, at 9:45 AM, Jerry Krinock je...@ieee.org wrote: Possibly this does not work because there is actually only [one] cell instance? But, whatever the reason, if this requirement is important enough for you to write some extra code, you could try defining tool tip rects on the matrix. I think that would work. See -[NSView addToolTipRect:owner:userData:] [The bracketed text is what I assume was meant.] NSMatrix keeps unique cells for each element of the matrix. — 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
Re: Best way to put a fixed view in a UITableViewController scene?
On 26 Nov 2013, at 12:53 AM, Rick Mann rm...@latencyzero.com wrote: On Nov 25, 2013, at 21:11 , Luther Baker lutherba...@gmail.com wrote: Maybe I am missing something - but I just created a new Tab based project and dropped a UITableView directly on the FirstViewController, under the View node in the expanding tree. If I right click on the UITableView, I see both the delegate and datasource outlets. I can click them and easily drag/connect to the parent First View Controller. Do you mean something else? You can't put a UITableViewController into a Container View, and link from the UITVC back to the containing view controller. Sure you can (if I understand you correctly). The containment segue has an identifier, and you can capture the .destinationViewController in -prepareForSegue:sender:. Bear in mind that no other NIB loading has been done at that point. — 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
Re: Stale xib files
On Nov 17, 2013, at 8:50 AM, Roland King r...@rols.org wrote: No I'm not sure that it is. Appstore updates really do blow things away and start over. I'm not sure that anything less than that does that. Has that changed? At WWDC 2012 (as I remember), one of the big features of iOS 6 was that so long as you kept your file names consistent (there were a few slides on how to do that), App Store downloads would be incremental. Incrementally downloading new and revised files doesn't stop the installer from removing the deleted ones. This is a separate issue from merging the download and the (surviving) existing files into a fresh application bundle, transferring the user's files and preferences, and swapping the new bundle in. As far as I know, that's still what happens, but it's orthogonal to whether the download is incremental or from-scratch. — 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
Re: UIPopover arrow not centered on source frame
On 13 Nov 2013, at 11:28 PM, Rick Mann rm...@latencyzero.com wrote: I use a storyboard segue to present this popover, but it's not centered on the button: http://cl.ly/image/1S153u1a1I3O Any idea what's wrong? TIA, [Shows something that looks like a gray gear-icon UIBarButtonItem in a UIToolbar at the top of (guessing, and if it matters) the detail part of an iPad UISplitViewController. Toolbar is flush at the bottom of the status bar. iOS 7 presentation. A popover descends from an X location that is close to, probably exactly at, the trailing edge of the button. Y location at or close to the bottom of the button.] More information would be helpful. Is that gear button actually a UIBarButtonItem? And are you using presentPopoverFromBarButtonItem:…? If not, is the area that visually contains the button a UIToolbar? Is the area that visually contains the button object its actual superview (moot in the case of bar items, because they don't have superviews, or frames, or bounds)? If it's not a bar item, is there anything funny about how it draws its content; specifically, is the icon drawn off-center in the bounds? Is there any applicable justification/alignment property? If you are using an actual button, or other object that is a view, and therefore not a bar item, and therefore are using presentPopoverFromRect:inView:…, are you using the object's frame, and not bounds? [View, not bar item] Are you passing the actual, and not the visual, superview? Have you verified it by breaking at the call site and examining what you're passing? While you're at that breakpoint, have you examined the rect? If you're using …FromRect:…, are you (or whatever is giving it to you) offsetting the rect by half its width? Not easy to imagine why, but if the workings of the code were easy to imagine, you wouldn't have a bug. [Bizarre] Are there any affine transforms on the button object (must be a view) or its superview? Most of these questions are dead ends, depending on the answers of the precedent ones, but the interaction on mailing lists and fora has latency problems. — 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