Re: Cocoa File Close Notification

2016-08-10 Thread Jens Alfke
> On Aug 10, 2016, at 12:10 PM, Gurkan Erdogdu wrote: > > I try to get file close notification in Cocoa/Swift. Is there any way to do > this? I tried to use FSEvent API but this does not provide any notification > for file close events. I don’t think there’s any such notification. File handle

Re: NSImage drawInRect deadlock

2016-08-09 Thread Jens Alfke
>> I was under the impression from the docs that macOS >> handles the thread pool “automatically”. GCD’s pool does use a thread per CPU core … but only as long as none of the operations run for a long time. If its entire thread pool is busy for “a while” and there are more blocks waiting in the

Re: NSImage drawInRect deadlock

2016-08-08 Thread Jens Alfke
> On Aug 8, 2016, at 2:54 PM, Aaron Tuller wrote: > > "The following classes and functions are generally not thread-safe. In most > cases, you can use these classes from any thread as long as you use them from > only one thread at a time." The images are only being used on one thread at a tim

Re: NSImage drawInRect deadlock

2016-08-08 Thread Jens Alfke
> On Aug 8, 2016, at 12:46 PM, Aaron Tuller wrote: > > Search for NSImage here: > > https://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/Multithreading/ThreadSafetySummary/ThreadSafetySummary.html#//apple_ref/doc/uid/1057i-CH12-126728 > >

Re: Emailing from a daemon process

2016-08-03 Thread Jens Alfke
> On Jul 7, 2016, at 6:56 PM, Bruce Stephens wrote: > > Could use a simple Perl script… quick easy and nasty… We already spent many messages dissecting why simply invoking sendmail doesn’t work. > Works!!! It might work on your machine, because you’ve configured Postfix to route mail proper

Re: NSFileHandle and thread safety

2016-07-25 Thread Jens Alfke
> On Jul 25, 2016, at 12:37 PM, Daniel Stenmark wrote: > > 2. Can I read from a single file using two NSFileHandles on two threads at > the same time? > > Why would you need to do that in the first place? To get multithreaded access to the file contents. This is pretty common when using da

Re: kCFStreamPropertySSLSettingC

2016-07-25 Thread Jens Alfke
> On Jul 25, 2016, at 6:47 AM, Gerriet M. Denkmann wrote: > > What would be the right thing to choose? “Mac Developer” while you’re developing, I.e. for your regular build-and-run cycle. “Mac Distribution” is for Release builds you’re going to submit to the Mac App Store. “Developer ID” is fo

Re: kCFStreamPropertySSLSettings

2016-07-22 Thread Jens Alfke
> On Jul 22, 2016, at 2:46 AM, Gerriet M. Denkmann wrote: > > When it gets some streams it will show a panel: > “MyApp wants to sign using key “something” in your keychain” / “Allow” “Deny” Presumably this app is either acting as an SSL server, or is sending SSL clients. Either of those roles

Re: Ending NSTask doesn't release file handle opened by the task it wraps.

2016-07-21 Thread Jens Alfke
That’s strange. I would use the `lsof` tool to figure out which process has that file open. You can also use `fs_usage` while the tool is running to monitor all the filesystem activity on that file. —Jens ___ Cocoa-dev mailing list (Cocoa-dev@lists.ap

Re: Vertical orientation of UISlider

2016-07-20 Thread Jens Alfke
> On Jul 20, 2016, at 12:02 PM, Carl Hoefs > wrote: > > I was looking for the obvious, a simple property like slider.orientation or > some such. In AppKit, an NSSlider’s orientation is determined simply by whether its bounds rectangle is longer than it’s wide, or vice versa. Is the same true

Re: Root URL and URLByDeletingLastPathComponent

2016-07-17 Thread Jens Alfke
> On Jul 17, 2016, at 6:49 AM, thatsanicehatyouh...@me.com wrote: > >> It might be a mishandling of the two sorts of rot URL. If you try feeding in >> this URL manually: >> >> file://localhost/ >> >> and removing the last component, what do you end up with? > > That just treats it as a file

Re: WKWebView and Mobile Safari and cookie sharing

2016-07-09 Thread Jens Alfke
> On Jul 9, 2016, at 10:29 AM, Torsten Curdt wrote: > > Hm - noone? > Any idea where else to ask or read up on? The webkitsdk-dev list (on this same server.) —Jens ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin re

Re: Emailing from a daemon process

2016-07-08 Thread Jens Alfke
> On Jul 8, 2016, at 8:44 AM, Alastair Houghton > wrote: > > It has a very high probability of being marked as spam, whatever headers you > use, because it’ll be delivered direct to the recipient’s mail server Oh — I hadn’t thought of that. I sent my test email to myself, so of course it con

Re: Emailing from a daemon process

2016-07-08 Thread Jens Alfke
> On Jul 8, 2016, at 8:13 AM, Sal Conigliaro wrote: > > You can send mail using sendmail without having to configure Postfix or > Sendmail. > Out of the box OS X can use sendmail to send messages. I didn’t think this would actually work, but I tried it and it does. It relayed to the SMTP server

Re: Encoding of Swift string literals?

2016-07-07 Thread Jens Alfke
> On Jul 7, 2016, at 6:16 PM, William Squires wrote: > > Is it NSASCIIStringEncoding, or UTF8 (or something else)? Is it dependent on > the system locale or language setting? (in my case, locale is US, and > language is US English, with a US keyboard). I think you’re asking about what string

Re: Emailing from a daemon process

2016-07-07 Thread Jens Alfke
> On Jul 7, 2016, at 10:01 AM, Carl Hoefs > wrote: > > I seem to recall that in the distant past I accomplished issuing emails from > a daemon process on Linux by directly interfacing to /usr/sbin/sendmail. Is > this the 'Postfix mail tools' you mentioned? Yes, and sendmail on macOS is just

Re: Emailing from a daemon process

2016-07-07 Thread Jens Alfke
> On Jul 7, 2016, at 9:44 AM, Carl Hoefs wrote: > > It seems a bit odd to me that I can connect all sorts of little network > devices (webcams, network monitors, remote power switches, etc) to a LAN and > they can all be set to issue email. The manufacturers are probably running their own SMT

Re: Emailing from a daemon process

2016-07-07 Thread Jens Alfke
> On Jul 7, 2016, at 9:13 AM, Carl Hoefs wrote: > > I have a daemon app built on Foundation (aka "command line tool") running in > the background and I need it to issue a textual email on certain conditions. Do you mean daemon or agent? A daemon runs outside of any user login session and is

Re: Prioritize my own app's disk access

2016-07-06 Thread Jens Alfke
> On Jul 6, 2016, at 3:06 AM, Jonathan Taylor > wrote: > > I should also clarify that (in spite of my other email thread running in > parallel to this) I am not doing any complex encoding of the data being > streamed to disk - these are just basic TIFF images and metadata. Since you said pre

Re: Prioritize my own app's disk access

2016-07-05 Thread Jens Alfke
> On Jul 5, 2016, at 2:40 PM, Jonathan Taylor > wrote: > > As far as the quality of service goes, I can't see the APIs for that (looking > in the 10.9 SDK, at least). Am I looking in the wrong place? IIRC, QoS was added in 10.10. > I confess that currently I am using pure cocoa -writeToFile:

Re: Property synthesis trouble - 32 vs 64 bit builds

2016-07-05 Thread Jens Alfke
> On Jul 5, 2016, at 2:10 PM, Jonathan Taylor > wrote: > > Quicktime. Oh, you poor thing. That’s one nasty API. (Actually dozens of nasty APIs.) O_o > My code has been 32-bit only since I first wrote it, because I make use of > the APIs in QuickTime/ImageCompression.h for encoding movies. It

Re: Property synthesis trouble - 32 vs 64 bit builds

2016-07-05 Thread Jens Alfke
> On Jul 5, 2016, at 4:36 AM, Jonathan Taylor > wrote: > > It surprises me that I have to write different synthesis code for 32- or > 64-bit builds It’s because they use different Obj-C runtimes. For compatibility reasons, 32-bit Mac apps still use the old runtime, while 64-bit apps (and all

Re: Prioritize my own app's disk access

2016-07-05 Thread Jens Alfke
You might try asking on the darwin-userlevel mailing list. In addition to increasing I/O priority, there may be other ways to make your disk writes more efficient. For example you can preallocate space for the file before writing to it. Writing in larger chunks may also help. (Of course you may

Re: Issue with read/write to NSFileHandle

2016-06-30 Thread Jens Alfke
> On Jun 29, 2016, at 8:40 PM, Graham Cox > wrote: > > Reading the documentation, NSFileHandle seems to have only one file offset, > which is common to both read and write, which is a bit puzzling, because > surely you’d want to write at the end of the file, but

Re: How can I get a single threaded network call in ObjC on iOS?

2016-06-28 Thread Jens Alfke
> On Jun 28, 2016, at 12:52 PM, Jim Adams wrote: > > I have an application that has the requirement that the accesses to the > server be single threaded, i.e. the second request cannot go through until > the first request has completed. That’s pretty unusual. I take it this is a restriction o

Re: Nullability question (NSEvent)

2016-06-27 Thread Jens Alfke
> On Jun 27, 2016, at 10:03 AM, Stefan Haller wrote: > > I see that -[NSEvent characters] is marked nullable; however, the > documentation seems to say otherwise. Have you checked the 10.12 SDK? From the API diffs I’ve seen, Apple's been correcting nullability annotations where they conflict

Re: Security with Streams

2016-06-27 Thread Jens Alfke
> On Jun 26, 2016, at 11:30 PM, Gerriet M. Denkmann > wrote: > > Could it, instead of getting the SecIdentityRef from the keychain, just use > MyServerCertificate.cer instead? Nope. The server has to have a SecIdentityRef, because its side of the SSL handshake requires using the private key

Re: Security with Streams

2016-06-26 Thread Jens Alfke
> On Jun 26, 2016, at 8:13 PM, Gerriet M. Denkmann wrote: > > Assume that an evil entity has got hold of “MyServerCertificate.cer”, but has > no access to my keychain and thus to the private key of MyServerCertificate. > Could they use this certificate to open a secure stream to a client? Or d

Re: Security with Streams

2016-06-26 Thread Jens Alfke
> On Jun 25, 2016, at 7:44 PM, Gerriet M. Denkmann wrote: > > Following TN2326 I created a (self signed) Certificate Authority and a > Digital Identity called "MyServerId". You probably used the Keychain Access app for this? That works fine, but you’ll probably want every instance of the serv

Re: Security with Streams

2016-06-25 Thread Jens Alfke
> On Jun 18, 2016, at 2:34 AM, Gerriet M. Denkmann wrote: > > 1. (important) the client really wants to know that: > (1a) it is talking to the right server and not to some evil entity > masquerading as the real server. > (1b) the data it receives has not been tampered with on the wa

Re: Storing cache data in NSDocument

2016-06-16 Thread Jens Alfke
> On Jun 16, 2016, at 4:58 PM, Rick Mann wrote: > > Yeah, that's what I'm currently doing. I guess the frequency with which files > are transferred is very low. Regenerating some of the data can take many > hours, though… Maybe you could add an Export command that copies the document with the

Re: Storing cache data in NSDocument

2016-06-16 Thread Jens Alfke
> On Jun 16, 2016, at 3:46 PM, Rick Mann wrote: > > My complex app generates a lot of intermediary data that's cached to speed up > operations. Would it be reasonable to store this inside the document package? > The idea being that that way, the entire set of data can be moved around > easily

Re: Properties: A question of style

2016-06-15 Thread Jens Alfke
> On Jun 14, 2016, at 4:48 PM, Graham Cox wrote: > > @property (readonly) BOOL isFoo; > > or: > > @property (readonly, getter=isFoo) BOOL foo; Are you asking whether it’s better to name a boolean property “foo” or “isFoo”? Or are you asking about the naming of the getter method for a no

Re: KERN_INVALID_ADDRESS

2016-06-13 Thread Jens Alfke
___ 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.co

Re: Tick marks on scroll bars

2016-06-13 Thread Jens Alfke
> On Jun 13, 2016, at 9:18 AM, じょいすじょん > wrote: > > Did you do run into any issues with rubberbanding and responsive/momentum > scrolling? Why would I? I just overrode the method that draws the background. —Jens ___ Cocoa-dev mailing list (Cocoa-d

Re: Tick marks on scroll bars

2016-06-13 Thread Jens Alfke
I've done it by subclassing NSScroller. (The code's not open-source, though.) As far as I know, that's the only way to do it. It's fairly easy. —Jens ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator

Re: quicklook audio sample rates

2016-06-10 Thread Jens Alfke
> On Jun 10, 2016, at 10:37 AM, じょいすじょん > wrote: > > I assumed the OP is interested to know whether listening to the playback in > QuickLook is going to be a valid exercise > for a pro audio person, versus opening the file in any particular application. If the sample rates didn’t match, and C

Re: quicklook audio sample rates

2016-06-10 Thread Jens Alfke
> On Jun 9, 2016, at 6:03 PM, George Toledo wrote: > > Does Quicklook play audio of a previewed file at the sample rate it was > encoded at, or is it somehow doing a samplerate conversion on the fly? QuickLook is just calling AVFoundation, which is calling CoreAudio. CoreAudio [obviously] trie

Re: NSFileWrapper

2016-06-05 Thread Jens Alfke
> On Jun 4, 2016, at 11:52 PM, Charles Srstka wrote: > > Every time I’ve ever tried to use NSFileWrapper, I’ve always ended up having > to switch to something else because of the memory issue that Jens mentions. > Never really understood the point of that class. I was going to say that "AFAIK

Re: NSFileWrapper

2016-06-04 Thread Jens Alfke
> On Jun 4, 2016, at 9:51 AM, Peter Hudson wrote: > > “If your app’s performance is suffering because of large files, then use > streams instead, and try to only read the part of the file that’s necessary.” > Could you point me at some material about this technique ? It sounds very > interest

Re: NSFileWrapper

2016-06-04 Thread Jens Alfke
> On Jun 4, 2016, at 9:18 AM, Peter Hudson wrote: > > You're right - I want the behaviour of a package. Do you happen to know how I > can achieve it? I had presumed it might be some mix of flag setting at > system level. If for example i set the extension on an NSFileWrapper to > .bundle

Re: Simplest way to generate audio tones?

2016-05-29 Thread Jens Alfke
> On May 28, 2016, at 8:24 PM, Graham Cox wrote: > > I’m looking for general pointers to the simplest/quickest way to generate an > audio tone (sine wave) of a given frequency and duration. Most of the audio > APIs seem concerned with playing samples rather than generating tones, so > it’s no

Re: debugging AirDrop (update)

2016-05-27 Thread Jens Alfke
File a bug report with Apple! —Jens (who has intermittent troubles with AirDrop too) > On May 27, 2016, at 10:47 AM, Gerriet M. Denkmann > wrote: > > >> On 27 May 2016, at 23:18, Steve Christensen wrote: >> >> I haven't worked with AirDrop, but I just looked at the docs and one of the >> d

Re: NSAlert and threading

2016-05-23 Thread Jens Alfke
> On May 23, 2016, at 2:41 PM, Fritz Anderson wrote: > > 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. Less dogmatically, you can use -performSelector:withObject:aft

Re: Need advice on a custom run-loop mode

2016-05-21 Thread Jens Alfke
> On May 20, 2016, at 11:55 PM, Graham Cox wrote: > > The view is definitely being marked dirty, and I’m explicitly calling > -displayIfNeeded, and -drawRect: is getting called as a result. But the > screen is not updated. I tried making an explicit call to flush the graphics > context but th

Re: Need advice on a custom run-loop mode

2016-05-20 Thread Jens Alfke
> On May 20, 2016, at 12:58 AM, Graham Cox wrote: > > First question: does that even sound like a proper use for a custom run-loop > mode? Yes. > If the answer is yes, how do I cause the run loop to run in that mode? Do I > have to run the loop mysef until the operation is done? Yes, use a

Re: iOS - the joy of observers and NSInternalInconsistancyException for KVO

2016-05-19 Thread Jens Alfke
> On May 19, 2016, at 1:24 PM, Alex Zavatone wrote: > > In this case, I'm trying to see what is causing this deallocation. In my > code, I explicitly remove the observer before I nil the object, so I don't > know where this is happening. If you’re observing an object, you should probably e

Re: iOS - the joy of observers and NSInternalInconsistancyException for KVO

2016-05-19 Thread Jens Alfke
> On May 19, 2016, at 9:54 AM, Alex Zavatone wrote: > > OK, fair enough. Looks like I'll have build a little weak referenced dealy > that subclasses dealloc and stops if it detects any observers. Holy crap, don’t do that. First, you can’t stop a dealloc. Instead you’d have to override retai

Re: iOS - the joy of observers and NSInternalInconsistancyException for KVO

2016-05-19 Thread Jens Alfke
> On May 19, 2016, at 7:51 AM, Alex Zavatone wrote: > > Is there a means to have an object know when it's being observed so that it > will refuse to nuke itself in this condition? Nope. Remember, objects don’t “nuke” themselves; they are dealloced when no other objects have references to them

Re: Decide which mail app to use for mailto: links

2016-05-18 Thread Jens Alfke
> On May 18, 2016, at 10:04 AM, Paul Brown wrote: > > Is it possible to have the user select their preferred mail application that > will respond to this? The Launch Services framework has C functions that allow you to (a) find applications that register a handler for a URL scheme, and (b) se

Re: Recurrent background thread

2016-05-13 Thread Jens Alfke
> On May 13, 2016, at 12:34 PM, Carl Hoefs > wrote: > > As a test, the above works if run on the main thread, so I'm guessing it has > something to do with there being no runloop after the background thread > exits. Yup. More precisely, the background thread has no runloop at all. Its top-l

Re: objc [66375] class Foo is implemented in both BundleA and BundleB

2016-05-13 Thread Jens Alfke
> On May 13, 2016, at 1:23 AM, Jeff Szuhay wrote: > > 1) Project headers are only available within the framework and not to any > other “consumer” of the framework. >Which is to say, my bundles, which “consume" the framework, cannot see > project headers. Right. “Project” is just the defa

Re: ARC [was Protecting against "app nap"]

2016-05-12 Thread Jens Alfke
> On May 12, 2016, at 1:16 AM, Jonathan Taylor > wrote: > > you would definitely recommend ARC then, would you? Totally. As Roland said, I would never go back. > I've been a bit put off by what seems like regular questions on the list(s) > about debugging and fixing edge cases where ARC does

Re: Protecting against "app nap"

2016-05-11 Thread Jens Alfke
> On May 11, 2016, at 2:31 AM, Jonathan Taylor > wrote: > > I guess I just found method naming a bit odd (not really referring to an > object at all), and might have expected it to have an ‘alloc/new’ naming > since I’d have thought the API would be almost exclusively used for > activities t

Re: objc [66375] class Foo is implemented in both BundleA and BundleB

2016-05-11 Thread Jens Alfke
> On May 10, 2016, at 11:05 PM, Jeff Szuhay wrote: > > Class Foo is a base class. It is subclassed in BundleA, BundleB, … BundleZ. Where is Foo itself implemented? If there are copies of the Foo class in each bundle then yeah, you’ll get that warning. > Is there a better way to do it? I can’

Re: Receiver type for instance message is a forward declaration

2016-05-10 Thread Jens Alfke
> On May 10, 2016, at 4:05 PM, Carl Hoefs > wrote: > > Yes, yes, and yes! I'm using a nil context. I'm not sure how context is to be > used here... Is this an arbitrary value that I check in > -observeValueForKeyPath? Yes, but I’m not aware of it being required … what goes wrong if it’s NULL

Re: Receiver type for instance message is a forward declaration

2016-05-10 Thread Jens Alfke
> On May 10, 2016, at 1:38 PM, Carl Hoefs > wrote: > > )}: An -observeValueForKeyPath:ofObject:change:context: message was received > but not handled. > Key path: operations > Observed object: {name = 'Upload Queue'} An object got a KVO notification but doesn’t have a observer method to handl

Re: Protecting against "app nap"

2016-05-10 Thread Jens Alfke
> On May 10, 2016, at 10:26 AM, Jonathan Taylor > wrote: > > However, I was a bit surprised to find that I seem to need to explicitly > retain the object I get back [this is non-ARC code…] if I want my request to > remain in effect or even for the object to remain allocated to allow me to >

Re: XCode snapshot function?

2016-05-09 Thread Jens Alfke
> On May 9, 2016, at 6:48 PM, Graham Cox wrote: > > So what’s the best way to mothball and archive my project in its current > state so I can then fork it for the next version, and so on? Git. The Snapshot feature was basically made redundant once Xcode added support for Git, so it makes sen

Re: discontiguous bounds ?

2016-05-09 Thread Jens Alfke
> On May 8, 2016, at 10:32 PM, Miller Dale wrote: > > I wish to provide a facility with a NSTableView wherein the leftmost > (specifiable) columns remain statically on the left of the display (subject > to vertical scrolling) while the remaining columns scroll normally > constrained to the ri

Re: NSTableView is messaging zombie delegate

2016-05-08 Thread Jens Alfke
> On May 8, 2016, at 12:19 PM, Matthew LeRoy wrote: > > Unfortunately, setting the table view’s delegate to nil during tear-down > (either in -windowWillClose: or in NSViewController’s -dealloc) doesn’t seem > to fix the issue. I still get random but regularly reproducible crashes, with > the

Re: Receiver type for instance message is a forward declaration

2016-05-06 Thread Jens Alfke
> On May 6, 2016, at 1:42 PM, Carl Hoefs wrote: > > I would have thought that this earlier line would have been flagged if > RAOperation.h hadn't been included: > > RAOperation *op = [self _popOperation: listPtr]; There must be a forward declaration (“@class RAOperation”) somewhere abov

Re: NSTableView is messaging zombie delegate

2016-05-06 Thread Jens Alfke
> On May 6, 2016, at 1:03 PM, Matthew LeRoy wrote: > > My understanding is that NSTableView's delegate is a zeroing weak reference Are you sure? Historically it’s been unsafe_unretained — in the old days before weak references or ARC, the view never retained nor released the delegate. The typ

Re: Where are my bytes hiding?

2016-05-05 Thread Jens Alfke
> On May 5, 2016, at 12:01 PM, Martin Wierschin wrote: > > Is there any way a user file might be compressed in such a way through normal > user actions? Yes, there are various user-level utilities for compressing files, like Clusters (http://clustersapp.com ). The `di

Re: Where are my bytes hiding?

2016-05-05 Thread Jens Alfke
> On May 5, 2016, at 4:38 AM, Gerriet M. Denkmann wrote: > > The sum of all decmpfs in the folder is 4057 bytes - still no idea how Finder > gets its: “29 KB on disk” . Any file, even if empty, occupies at least one 4k disk sector. In this case I would guess there are 7 files in that director

Re: Yosemite NSCollectionView appropriate for spreadsheet-like view?

2016-05-03 Thread Jens Alfke
> On May 3, 2016, at 12:33 PM, Alex Kac wrote: > > There is the old NSCollectionView and the new. You have to use the new > delegate methods and so on. Its the same class, but behind the scenes the new > collection view is literally the UICollectionView from iOS ported over > (syslog even say

Re: Yosemite NSCollectionView appropriate for spreadsheet-like view?

2016-05-03 Thread Jens Alfke
> On May 3, 2016, at 12:08 PM, thatsanicehatyouh...@me.com wrote: > > I should have been more specific - my understanding was that NSCollectionView > from 10.11 onward did not do this... which Alex Kac just beat me to > mentioning! I was curious if anyone was aware of limitations of this scope

Re: Yosemite NSCollectionView appropriate for spreadsheet-like view?

2016-05-03 Thread Jens Alfke
> On May 1, 2016, at 9:06 AM, thatsanicehatyouh...@me.com wrote: > > As I've been thinking about this problem it occurred to me that the new(ish) > NSCollectionView might be a viable replacement in this case. Before I go down > the rabbit hole, is it reasonable to use to create a spreadsheet-li

Re: Using a Core Data model by itself

2016-04-28 Thread Jens Alfke
> On Apr 28, 2016, at 10:56 AM, Daryle Walker wrote: > > Can I use a CD model object without managed contexts nor persistent stores? I’m pretty sure you can’t, but if you’re not doing anything fancy in your modeling, the classes will just be pretty vanilla classes with some properties. So you

Re: Correct way to specify anchors with NSURL?

2016-04-21 Thread Jens Alfke
> On Apr 20, 2016, at 10:16 PM, Graham Cox wrote: > > Annoying that the ‘fragment’ property of NSURL is read-only, that looks like > an obvious way to do it, if the API was sane. The API is sane. NSURLs are immutable, just like NSStrings and many other Foundation classes. NSURLComponents ba

Re: How to make an app launch on login?

2016-04-20 Thread Jens Alfke
FYI, I just filed a bug report complaining about the lack of a reasonable native API for this. rdar://25834170 . —Jens ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact

Re: Proper way to set up constants when building an iOS framework

2016-04-20 Thread Jens Alfke
> On Apr 20, 2016, at 11:11 AM, Alex Zavatone wrote: > > I wasn't thinking that I'd make yet another header, (the .pch) to then > include the constants header and then it would need to be at the same level > in the framework as the constants file or would need to be able to see the > path to

Re: How to make an app launch on login?

2016-04-19 Thread Jens Alfke
> On Apr 19, 2016, at 2:43 PM, Jeff Szuhay wrote: > > The preferred way seems to be through the use of launchd I don’t think so. I’ve worked with launchd before — it provides very low-level functionality for starting background processes, and there’s no visible UI for configuring it. Not at a

Re: How to make an app launch on login?

2016-04-19 Thread Jens Alfke
> On Apr 19, 2016, at 2:35 PM, Jeff Szuhay wrote: > > I spoke too soon; yes, all of this is marked as “available but deprecated on > 10.11”. Yeah, interesting that Apple added LSSharedFileListItemCopyResolveURL in 10.10 and then deprecated it in 10.11. Oops! I guess I’ll use this API anyway

How to make an app launch on login?

2016-04-19 Thread Jens Alfke
One of my companies’ apps has a “Launch at login” pref, which no longer works in OS X 10.11. I’m not surprised, since the existing code implements this by writing into loginwindow’s user defaults :-p I’m trying to find the currently supported API for this. The “Adding Login Items” page says: >

Re: Proper way to set up constants when building an iOS framework

2016-04-19 Thread Jens Alfke
> On Apr 19, 2016, at 11:19 AM, Alex Zavatone wrote: > > How might I create one that the framework knows how to use? Should I create > some .pch, then include the constants.h in it? If so, once I create the > .pch, where is the setting to tell my framework that it needs to use it? OH. Now I

Re: BOOL parameter passed as nil object

2016-04-19 Thread Jens Alfke
> On Apr 19, 2016, at 10:22 AM, Alex Zavatone wrote: > > I believe that a BOOL can only be YES or NO. A nil value on a BOOL would be > NO if I am correct. At the language level, yes. The problem is, this behavior is occurring at runtime, at the machine-code level. The delayed-perform implem

Re: Proper way to set up constants when building an iOS framework

2016-04-19 Thread Jens Alfke
> On Apr 19, 2016, at 10:13 AM, Alex Zavatone wrote: > > No. I'm simply trying to find out how to make my constants.h (which has the > constants.m as well) visible to all of the classes in my framework, just as > the .pch would be visible to all of the classes within an iOS app. Add #import

Re: Proper way to set up constants when building an iOS framework

2016-04-19 Thread Jens Alfke
> On Apr 19, 2016, at 10:20 AM, Alex Zavatone wrote: > > So, since we have to create a constants file in a framework with .h and .m > files, I've never seen a .m compliment to a .pch. I have no idea how this > would work at all or how I would be able to set this up. I’m not sure why you keep

Re: Proper way to set up constants when building an iOS framework

2016-04-18 Thread Jens Alfke
> On Apr 18, 2016, at 2:03 PM, Alex Zavatone wrote: > >> Is Constants.h in the framework’s Headers directory, next to the main >> framework header file? > > Where in the project? In target framework's Build Phases Headers section? Is this in a different project that uses your framework? If s

Re: Does NSString's "- initWithContentsOfURL:usedEncoding:error:" use the tightest encoding possible?

2016-04-16 Thread Jens Alfke
> On Apr 16, 2016, at 7:35 PM, Daryle Walker wrote: > > If the given method is used to read in a pure ASCII file, will the encoding > be set to ASCII? Or could the method return a superset encoding (like > Latin-1, MacRoman, or UTF-8)? I don’t know; you could try it out, of course, but it so

Re: Creating a series of sequenced files

2016-04-16 Thread Jens Alfke
> On Apr 16, 2016, at 2:56 PM, Alex Zavatone wrote: > > The easy route is to use the file manager to see if the filename exists, then > […] keep doing that until it finds a file that hasn’t yet been created and > then write the file. This is generally considered a bad approach, because it’s s

Re: Proper way to set up constants when building an iOS framework

2016-04-15 Thread Jens Alfke
> On Apr 15, 2016, at 1:34 PM, Alex Zavatone wrote: > > One thing though. I did do a #import of "Constants.h" into my framework's > header file and that's not filling the role of what a .pch would fill in a > standalone app, even though I thought that someone said it would. > > If I put the

Re: Signed App can't retrieve passwords from keychain

2016-04-15 Thread Jens Alfke
> On Apr 15, 2016, at 3:07 AM, Siddarth Alva > wrote: > > However when i try it with a signed version of the App (using a developer > certificate) It fails to pop up the password prompt. The status received is > "The user name or passphrase you entered is not correct.” I don’t think signing

Re: Make a version of NSData "rangeOfData: options: range:" for multiple search parameters

2016-04-15 Thread Jens Alfke
> On Apr 14, 2016, at 9:33 PM, Daryle Walker wrote: > > I need a version of the method listed in the subject that works on multiple > search strings instead of one, stopping at the first & longest match. Any > ideas? Depends on your requirements… If performance isn’t critical, just call -ra

Re: Proper way to set up constants when building an iOS framework

2016-04-12 Thread Jens Alfke
> On Apr 12, 2016, at 10:30 AM, Alex Zavatone wrote: > > How should they be initialized in the .m? Within an init method? No, just NSString * const ABC_MY_IMPORTANT_CONSTANT = @"abc"; > Also, I'm quite familiar with the .pch for iOS apps, but are frameworks > allowed a file like this

Re: WKWebView and cookies

2016-04-12 Thread Jens Alfke
> On Apr 12, 2016, at 9:20 AM, Torsten Curdt wrote: > > Cookie headers are added later. I haven’t used WKWebView, but when using an > NSURLSession the cookies aren’t part of the NSURLRequest, but get added when > the request is sent. > > Hm - but shouldn't they be available in the response at

Re: WKWebView and cookies

2016-04-12 Thread Jens Alfke
> On Apr 12, 2016, at 2:27 AM, Torsten Curdt wrote: > > but I still cannot see the cookie on the client. Cookie headers are added later. I haven’t used WKWebView, but when using an NSURLSession the cookies aren’t part of the NSURLRequest, but get added when the request is sent. > I also trie

Re: [NSWorkspace openURL:] - any way to avoid a new tab?

2016-04-07 Thread Jens Alfke
-openURL is pretty generic, working with any type of URL that there's an app registered for, so it doesn't have a notion of specific UIs like tabs. If you send an AppleEvent directly to Safari, there might be a param to control tab behavior. But that would annoy users who have a different defaul

Re: How to turn of the Journal logging of CoreData/Sqlite?

2016-04-06 Thread Jens Alfke
> On Apr 6, 2016, at 8:45 AM, James Cicenia wrote: > > This is only at the install. The WAL file grows to over 500MB. Then when the > app is restarted this WAL file is truncated and app goes down to about 35MB. Oh, you mean _disk_ storage. I thought you meant RAM. Looking through the WAL docs

Re: How to turn of the Journal logging of CoreData/Sqlite?

2016-04-06 Thread Jens Alfke
> On Apr 6, 2016, at 7:43 AM, James Cicenia wrote: > > What is the magic combination of options to send to the sqlite to completely > turn off journaling. > I have an initialization on install that brings down a lot of data. I don’t > need journaling at this point > and it balloons the memory

Re: NSFileWrapper serializedRepresentation

2016-04-04 Thread Jens Alfke
> On Apr 4, 2016, at 9:59 AM, Gerriet M. Denkmann wrote: > > Both the Simulator and the OS X App compress the same folder (which resides > on OS X). OK, but the raw data size is significantly different, so they must be zipping different data. I don’t know why that would be; maybe the file pat

Re: NSFileWrapper serializedRepresentation

2016-04-04 Thread Jens Alfke
> On Apr 4, 2016, at 1:18 AM, Gerriet M. Denkmann wrote: > > When I do this in OS X 10.11.4 dataRaw = 30380898, dataCompressed = 5638680 ( > 18.6 %) > But in the iOS Simulator 9.3.1: dataRaw = 28206422, dataCompressed = 4282602 > ( 15.2 %) > > That is OS X (10.11.4) makes an 8 % bigger FileWr

Re: How to find the file (url) that was double-clicked to open my Cocoa Application?

2016-03-30 Thread Jens Alfke
> On Mar 30, 2016, at 1:47 AM, Motti Shneor wrote: > > But still, If a package file was double-clicked to launch the Installer App, > and it received an “Open File” event, is there a way to get to the file later > on, without actually catching this event? No, not as far as I know. It’s an ‘od

Re: NSThread to NSOperation and blockUntil

2016-03-22 Thread Jens Alfke
> On Mar 22, 2016, at 2:33 AM, Trygve Inda wrote: > > So I need to be able to have a process done in 30 seconds for example At > full speed it could be done in 4 seconds but I'd like it done with as little > impact as possible. I don’t think it makes much difference to other system threads

Re: question about last used date

2016-03-14 Thread Jens Alfke
> On Mar 14, 2016, at 6:11 PM, Rick C. wrote: > > 2. NSURLContentAccessDateKey returns the current date like mentioned here - > http://stackoverflow.com/questions/13914600/get-the-real-last-opened-date > > 3. The sam

Re: question about last used date

2016-03-14 Thread Jens Alfke
> On Mar 14, 2016, at 2:24 AM, Rick C. wrote: > > My problem is I’m only getting a kMDItemLastUsedDate on about 10% of files I > check, I don’t know whether that attribute is wired up to the filesystem, or whether it’s just something that has to be manually updated by app/framework code. From

Re: creating an application on the Mac

2016-03-12 Thread Jens Alfke
> On Mar 12, 2016, at 3:13 PM, Scott Berry wrote: > > Hello there, > > I am wondering if I am creating a wizard because I need to step people > through a process of choosing from a few devices on the Mac such as a Victor > Stream Reader which is a digital reader for the blind that uses an SD

Re: Thoughts on a line-at-a-time data-reading class

2016-03-10 Thread Jens Alfke
> On Mar 9, 2016, at 11:53 PM, Daryle Walker wrote: > > In my head, I came up with (in Swift): This is exactly the kind of thing that frustrates me about the Cocoa APIs: they’re so very bad at streams and producer/consumer patterns. This kind of problem really calls out for a proper stream A

Re: UITableView: combining row moves with insert/delete/reload in animation

2016-03-08 Thread Jens Alfke
> On Mar 8, 2016, at 11:58 AM, Luke Hiesterman wrote: > > If you’re getting asked to create a row at index 3 from that code snippet, > then that looks like a UIKit bug. I’d advise filing it at bugreport.apple.com > including a sample app showing that behavior. Wi

<    1   2   3   4   5   6   7   8   9   10   >