Re: Confusion with app settings / NSUserDefaults

2023-08-06 Thread Marco S Hyman via Cocoa-dev
Use the commend “defaults delete de.zach.ArtSaverApp” to delete all your prefs. 
 That should remove them everywhere.

At least that is what as worked for my in my limited experience.
___

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 framework or Object class to uncompress files

2022-10-24 Thread Marco S Hyman via Cocoa-dev



> 
> I'm hoping there's a built-in solution or framework that I'm just overlooking.

Guess: The Apple Archive framework

https://developer.apple.com/documentation/applearchive


___

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: Indexing broken for one project

2022-02-13 Thread Marco S Hyman via Cocoa-dev
On Feb 13, 2022, at 4:39 PM, Jack Brindle via Cocoa-dev 
 wrote:
> 
> In Monterey, /tmp is now only writeable by root.

??? Does terminal.app have special privs?

~% ls -l /tmp
lrwxr-xr-x@ 1 root  wheel  11 Feb  6 13:22 /tmp@ -> private/tmp
~% ls -ld /private/tmp
drwxrwxrwt  23 root  wheel  736 Feb 13 17:03 /private/tmp/
~% echo foo > /tmp/foo
~% cat /tmp/foo
foo
~% 


___

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: /Library/Application Support off limits?

2021-04-14 Thread Marco S Hyman via Cocoa-dev


> Our app isn't sandboxed, but when I try to create a "/Library/Application 
> Support/NewFolder" folder in there I get the following message:
> 
> /*You don't have permission to save the file "NewFolder" in the folder 
> "Application Support."*/

Yup.  You want ~/Library/Application Support/NewFolder for per user files.  Use 
FileManager.  In swift something like

let fileManager = FileManager.default
let supportDir = fileManager.url(for: .applicationSupportDirectory,
 in: .userDomainMask,
 appropriateFor: nil,
 create: true)

that creates the app support directory for your app.  You can then append 
NewFolder to the resulting URL and create it.

I *think* (never used it, might be wrong) if you replace .userDomainMask with 
.localDomainMask you will get a URL available to all users on the local machine.

There may be other options that are better suited to your use.
___

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 signature and notarization?

2021-04-12 Thread Marco S Hyman via Cocoa-dev
I don’t know about zip file distribution, but I have both the app AND the dmg 
that I use for distribution notarized.  I create the DMG from a folder 
containing the notarized app and a link to /Applications then run codesign on 
the DMG and upload the result to Apple for notarization.   Once notarized I 
staple the ticket to the dmg.
___

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 Info.plist's

2020-08-19 Thread Marco S Hyman via Cocoa-dev
On Aug 19, 2020, at 11:11 AM, Saagar Jha via Cocoa-dev 
 wrote:
> 
> Which file are you modifying? The one in your source directory? Because the 
> one that goes in the final product doesn’t get copied over until after you’ve 
> lost most control over the build process (it’s done by Xcode after the normal 
> build stages).

My build script generates the values for CFBundleBuildVersion, 
CFBundleShortVersionString, and CFBundleVersion.  It uses PlistBudy to update 
the values.  The plist it updates is

   # Run Script build phases that operate on product files of the target that 
defines
   # them should use the value of this build setting [TARGET_BUILD_DIR].
   #
   INFO_PLIST="${TARGET_BUILD_DIR}/${INFOPLIST_PATH}”

Works a charm.

Marc
___

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 another app with command line arguments

2020-06-20 Thread Marco S Hyman via Cocoa-dev


> On Jun 20, 2020, at 4:31 PM, Gabriel Zachmann  wrote:
> 
>> 
>> If app B can be treated as a sub-process of app A you can use Process.  I 
>> know that argument passing works with Process.
> 
> Sounds good.  How can A launch B as its sub-process?  (and pass command line 
> arguments?)
> 
> 

let process = Process()
process.standardOutput = FileHandle.nullDevice
process.standardError = FileHandle.nullDevice
process.launchPath = url.path   // path to app
process.arguments = [“arg1”, “arg2”, “arg3”]
process.launch()

and if you need to

process.waitUntilExit()

Obviously don’t wait on the main thread!

I do this in an app where the URL points to a helper located in the bundle.  
Not sure what extra hoops you’d need to jump through to launch an app outside 
of the sandbox.   Probably needs user approval which can be remembered using a 
security scoped bookmark.
___

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 another app with command line arguments

2020-06-20 Thread Marco S Hyman via Cocoa-dev



> On Jun 20, 2020, at 4:16 PM, Gabriel Zachmann  wrote:
> 
> So, the new question is: is there any easy way how my app A can launch my app 
> B
> and pass a simple piece of info from A to B, such as a boolean flag or an 
> integer?

If app B can be treated as a sub-process of app A you can use Process.  I know 
that argument passing works with Process.
___

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 another app with command line arguments

2020-06-20 Thread Marco S Hyman via Cocoa-dev


> 
> That works fine, *except* the command line arguments are not passed along :-(

Is your app sandboxed?  Arguments are ignored in sandboxed applications.
___

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: Points vs pixels in a bash script

2020-06-08 Thread Marco S Hyman via Cocoa-dev
Using
>   system_profiler SPDisplaysDataType
> I can retrieve the size of a Mac's display in pixels. 
> 
> However, the command
> 
>   tell application "System Events" to get the size of every window of every 
> process


tell application “Finder”
set screen_resolution to bounds of window of desktop
end tell

screen_resolution on my 5K iMac is 0, 0, 2560, 1440

Marc
___

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: Performance issue on macOS 10.15 obtaining display name for ~/Desktop, ~/Documents, and ~/Downloads

2020-04-23 Thread Marco S Hyman via Cocoa-dev
>> Also weird, why would it phone home for a shell script which has neither 
>> been stapled nor even code-signed?
>   I think you answered the question just then…  a "shell script which has 
> neither been stapled nor even code-signed”.  Google XProtect & Gatekeeper.

1) The executable part of a shell script is the shell.
2) The shell is signed by apple as can be seen from the output of, for example, 
   codesign --verify --display --verbose=4 /bin/sh
   or bash, or zsh, etc.
3) network monitoring shows no traffic due to running a shell script on my 
machine

We’re getting pretty far afield from the original subject, no?
___

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: Image GPS Properties Question

2020-04-02 Thread Marco S Hyman via Cocoa-dev
Update to what I wrote:

> So the data I need is somewhere in the metadata, but CGImage... can’t see it. 
>  This is only reported to be an issue when processing Cannon raw CR3 format 
> files.

FWIW this issue was resolved by the release of macOS 10.15.4.  Did not even 
need to recompile using the latest Xcode and frameworks.  Old code on the new 
macOS now works.
___

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


Image GPS Properties Question

2020-03-02 Thread Marco S Hyman via Cocoa-dev
Hello all,

Given a URL to an image I currently do this to grab image properties (ignoring 
error handling to simplify the example code)

let imgRef = CGImageSourceCreateWithURL(url as CFURL, nil)
let imgProps = CGImageSourceCopyPropertiesAtIndex(imgRef, 0, nil) as 
NSDictionary?
let GPSDictionary = kCGImagePropertyGPSDictionary as NSString
let gpsData = imgProps[GPSDictionary] as? [String: AnyObject]

gpsData contains only one entry, the GPS Version.  FWIW Apple’s Preview.app has 
the same issue.  It, too, only sees the GPS Version.  Yet when I use something 
like exiftool to request GPS info I see this:

exiftool -a -gps:all /Users/marc/Desktop/IMG_4843.CR3
GPS Version ID  : 2.3.0.0
GPS Latitude Ref: North
GPS Latitude: 52 deg 32' 12.00"
GPS Longitude Ref   : East
GPS Longitude   : 13 deg 25' 39.92"
GPS Altitude Ref: Above Sea Level
GPS Altitude: 40.51099831 m

So the data I need is somewhere in the metadata, but CGImage... can’t see it.  
This is only reported to be an issue when processing Cannon raw CR3 format 
files.

Does anyone have any hints on how else I might grab the GPS info?

Marc
___

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: Confusion about screen resolution

2020-02-22 Thread Marco S Hyman via Cocoa-dev
> 
> But a typographical  point is a unit of distance. There are 27 points per 
> inch. (I.e., a typographical point is 0.0139 inches or 0.353 mm).

Transposition typo? There are 72 points/inch.  The given inch and mm values are 
correct if rounded to 3 digits.
___

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: NSDatePicker display format

2020-01-21 Thread Marco S Hyman via Cocoa-dev
On Jan 21, 2020, at 3:04 PM, robmar...@frontiernet.net wrote:
> 
> Have you tried adding a NSDateFormatter to the DatePickerCell (in code or in 
> the xib) and setting its format string to what you want?

There doesn’t seem to be any way to get the DatePickerCell to use the 
formatter.  At least not one that I’ve yet to find.  Bummer.

Marc
___

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: NSDatePicker display format

2020-01-21 Thread Marco S Hyman via Cocoa-dev
On Jan 21, 2020, at 3:04 PM, robmar...@frontiernet.net wrote:
> 
> Have you tried adding a NSDateFormatter to the DatePickerCell (in code or in 
> the xib) and setting its format string to what you want?
> 
> Haven't tried it, but might work...

No, I hadn’t.  I dragged a DateFormatter over the cell in the Storyboard.  It 
looks like I can set a custom format.  Thanks.

Marc
___

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


NSDatePicker display format

2020-01-21 Thread Marco S Hyman via Cocoa-dev
Is there a way to change the date format used by NSDatePicker?

The dateValue I’m seeing, for example, is "1/20/2020 1:41:42 PM”.  At a minimum 
I’d like the time displayed in 24 hour mode instead of AM/PM.  Ideally I’d like 
the date to be “:MM:dd HH:mm:ss” because that is how it is used elsewhere 
in the user interface.

Marc
___

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: UIView block-based methods

2019-11-09 Thread Marco S Hyman via Cocoa-dev

> What is this 'block-based animation API’?\


The section of the doc named Animating Views starts with: Use of these methods 
is discouraged. Use the UIViewPropertyAnimator class to perform animations 
instead.

I’d start looking there.
___

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: Thoughts on Cocoa

2019-10-02 Thread Marco S Hyman via Cocoa-dev
On Oct 2, 2019, at 1:15 PM, Sam Ryan via Cocoa-dev  
wrote:
> 
> It has felt like the support is not there the
> last few years, with much of the documentation "archived" and the new
> documentation focused on Swift.

While the text in the doc window shows me the Swift version I can always click 
on the Objective-C language selection to see the Objective-C version.  Unless 
I’m looking at something newish which doesn’t exist in Objective-C, e.g. the 
Combine framework.

I’ve assumed that the doc window shows me Swift because I’m coding in swift.
___

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: Cannot include Carbon on Mojave

2019-05-14 Thread Marco S Hyman
On May 14, 2019, at 2:11 PM, Vojtěch Meluzín  wrote:
> 
> I know it has been deprecated, no argues there, but my point is that the
> headers are there, yet the compiler doesn't find them.

Interesting.

  $ find /Applications/Xcode.app -name CarbonSound.h -print

returns no results.  Where are you finding it?  I see that the file is 
reference in some other headers, but the file itself seems not to exist.
___

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: Notarization porcess

2018-10-24 Thread Marco S Hyman


> On Oct 24, 2018, at 12:45 PM, James Merkel  wrote:
> 
> Has anyone actually been able to get an App notarized in Xcode?

Yes.

> However, back in Xcode in the Organizer window it says “Processing” and the 
> “Export Notarized App” button isn’t enabled.

I didn’t have that issue.  Well, I thought I had that issue but Xcode changed 
state to allow exporting within 5 minutes of receiving the message.

> A second question: Assuming notarization of the App eventually happens, do I 
> also need to separately notarize the DMG that I distribute the App in (in the 
> Terminal CLI) ?
> If I need to do both, this could take nearly forever.

I created my .dmg using the notarized app.  The website implies that I could 
create a .dmg with the un-notarized app then use "xcrun altool”.  I’ve yet to 
find any more info on altool other than this blurb on developer.apple.com

"To submit software you've already published, upload it using the xcrun altool 
command line tool. Several file types are supported, including .zip, .pkg, and 
.dmg, so you can upload the same package you already distribute to users.”

Marc
___

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 clear macOS app bundle cache

2018-09-04 Thread Marco S Hyman
Have you tried disabling SMB client side caching?  
https://support.apple.com/en-us/HT207520

I don’t know if that note pertains to current versions of macos.
___

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


macOS sandbox aliases question

2017-11-16 Thread Marco S Hyman
I open or drag a group of files into my sandboxed app.  The app then acts upon 
those files.  When I exit the app I see that sandbox 
(~/Library/Containers/org.snafu.app/Data/Documents) still contains aliases to 
the files I opened.

What gets rid of those aliases?

My “save” operation does not invoke NSSavePanel. It iterates over files that 
have been modified, writing the modifications to disk.

Marc
___

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 anyone suggest an open source license for Nursery framework?

2017-10-28 Thread Marco S Hyman

> Can anyone suggest an open source license for Nursery framework?

https://creativecommons.org/share-your-work/


___

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: MKMapView pin dragging question

2017-10-25 Thread Marco S Hyman

> On Oct 25, 2017, at 6:11 PM, Alex Zavatone  wrote:
> 
> This might be simple.  Please correct me if I am wrong, I think the last time 
> I dealt with this was in 2012.  
> 
> Isn’t there a method or property such as canDragPin that you have to override 
> or implement in your subclass?

I’m setting isDraggable to true in the MKAnnotationView.  That is the closest 
thing I can think of.  I’m also setting an otherwise unneeded title in the 
MKPointAnnotation because searches say a title is necessary to make dragging 
work.

Marc

___

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


MKMapView pin dragging question

2017-10-25 Thread Marco S Hyman
I'm not sure what I'm doing wrong or failing to do, but I can't get a map pin 
annotation to drag.  Instead I'm dragging the entire map.

Pin is created and placed on a map using this code:

mapPin = MKPointAnnotation()
if let pin = mapPin {
pin.coordinate = location;
pin.title = "location"
mapView.addAnnotation(pin)
}

This MKMapViewDelegate function is called to create the annotationView

func mapView(_ mapView: MKMapView,
 viewFor annotation: MKAnnotation) -> MKAnnotationView? {

let identifier = "pinAnnotation"
var annotationView = 
mapView.dequeueReusableAnnotationView(withIdentifier: identifier) as? 
MKPinAnnotationView
if (annotationView == nil) {
annotationView = MKPinAnnotationView(annotation: annotation,
 reuseIdentifier: identifier)
if let av = annotationView {
av.pinColor = .red;
av.animatesDrop = false
av.canShowCallout = false
av.isDraggable = true
} else {
unexpected(error: nil, "Can't create MKPinAnnotationView")
}
} else {
annotationView!.annotation = annotation
}
return annotationView
}

However, a breakpoint on the the delegate function that should be called 
durring a drag operations is never triggered.

// A pin is being dragged.
func mapView(_ mapView: MKMapView,
 annotationView view: MKAnnotationView,
 didChange newState: MKAnnotationViewDragState,
 fromOldState oldState: MKAnnotationViewDragState) {
// ...
}

What did I forget?

High Sierra (10.13)
Xcode 9.0.1 (9A1004)
I'm attempting to drag using a three finger gesture on a tablet.

___

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: MKMapView userLocation heading & a dropped pin

2017-06-23 Thread Marco S Hyman
> I am trying to determine whether or not the pin is in front, left, right,
> or behind the user. I am going to perform calculations within
> 
> func locationManager(_ manager: CLLocationManager, didUpdateLocations
> locations: [CLLocation]) {
> 
> I already determine distance. How might I go about doing this?

The Haversine forumula will give you distance and bearing between two points.  
I think you can use the bearing to get your desired info.

Marc
___

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 you have a helper scripts in a sandboxed app?

2016-09-09 Thread Marco S Hyman
ARRRGGGHHH... this was supposed to go to the Xcode list.  Sorry for the
noise.


> On Sep 9, 2016, at 3:53 PM, Marco S Hyman <m...@snafu.org> wrote:
> 
> I’ve an app that uses a perl helper script.  I’d like to sandbox the app but 
> haven’t had any luck it getting it to work.  Can it be done? If so can 
> someone point me to some doc that might indicate how?
> 
> I've tried grabbing a security scoped bookmark to the perl script.  
> Apparently that worked at one time, but not any more.
> 
> I’ve tried including the script in the app bundle... doesn’t help as the 
> script isn’t signed and I’ve not come up with the magic signing invocation 
> that does the job I need.
> 
> Thanks for any pointers.
> 
> Marc
> ___
> 
> 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/marc%40snafu.org
> 
> This email sent to m...@snafu.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

Can you have a helper scripts in a sandboxed app?

2016-09-09 Thread Marco S Hyman
I’ve an app that uses a perl helper script.  I’d like to sandbox the app but 
haven’t had any luck it getting it to work.  Can it be done? If so can someone 
point me to some doc that might indicate how?

I've tried grabbing a security scoped bookmark to the perl script.  Apparently 
that worked at one time, but not any more.

I’ve tried including the script in the app bundle... doesn’t help as the script 
isn’t signed and I’ve not come up with the magic signing invocation that does 
the job I need.

Thanks for any pointers.

Marc
___

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: Init in Swift

2016-09-06 Thread Marco S Hyman
> 
> My Swift book (2.2) has no mention of “private” (Swift 3 beta has).
> But even assuming I had Swift 3, I do not quite understand how this should be 
> done (I may be a bit dense).

Page 508 in the Swift 2.2 book I just downloaded from iBooks.

“Getters and Setters
Getters and setters for constants, variables, properties, and subscripts 
automatically receive the same access level as the constant, variable, 
property, or subscript they belong to.

You can give a setter a lower access level than its corresponding getter, to 
restrict the read-write scope of that variable, property, or subscript. You 
assign a lower access level by writing private(set) or internal(set) before the 
var or subscript introducer.

”

Excerpt From: Apple Inc. “The Swift Programming Language (Swift 2.2).” iBooks. 
https://itun.es/us/jEUH0.l



___

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: slicing in Swift

2016-09-06 Thread Marco S Hyman

> On Sep 6, 2016, at 5:33 PM, Gerriet M. Denkmann  wrote:
> 
> var numbers: [UInt64] = …
> 
> func numbers( upTo nbr: Int ) -> [UInt64]  
> {
>   let slice = numbers[ 0 ..< nbr ] 
>   return slice
>   //  Cannot convert return expression of type ‘ArraySlice' 
> to return type '[UInt64]' 
> 
>   //  workaound:
>   var outCopy:[UInt64] = []
>   for i in 0 ..< nbr { outCopy.append( numbers[i] ) }
>   return outCopy
> }
> 
> Any better way to do this?

I don’t know if it is better, but this works in beta 6

var numbers: [UInt64] = ...

func numbers( upTo nbr: Int ) -> [UInt64]
{
var outCopy:[UInt64] = []
outCopy += numbers[ 0 ..< nbr ]
return outCopy
}



___

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 argument list

2016-06-25 Thread Marco S Hyman
> 
>   NSString* argString = [NSString stringWithFormat:@"-i \"%@\" -c copy 
> %@", [url absoluteString], [self.outputFileURL absoluteString]];
>   
>   self.ffMPEGTask = [NSTask launchedTaskWithLaunchPath:execPath 
> arguments:@[argString]];

I believe arguments is an array of arguments, not an array containing a string 
that matches a command line.

> What the argument string should look like is:
> 
> -i  -c copy 

Then your arguments array should contain five items.

1: -i
2: 
3: -c
4: copy
5: 



___

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 NSArray ever have a count of -1?

2016-02-19 Thread Marco S Hyman

>> On Feb 19, 2016, at 4:29 PM, Jens Alfke  wrote:
>> 
>> NSInteger is a typedef of ‘long’ in 64-bit, and ‘int’ in 32-bit.
>> You’re correct that %d should be used for NSInteger in 32-bit.
> 
> The recommended way to use an NSInteger, as per Apple documentation, is to 
> use %ld and explicitly cast it to long.
> 
> NSLog(@“foo is %ld”, (long)foo);
> 
> This will work regardless of platform.
> 
> For NSUInteger, you use %lu and cast to unsigned long.

This was posted on the xcode list a while back by Quincey Morris:

"As suggested by Greg Parker on this list a couple of years ago, you can use

%t… (%td, %to, %tu %tx, %tX) for unsigned results
%z… (%zd, %zo, %zu %zx, %zX) for signed results

and these work on NS[U]Integer-sized variables on all platforms and
architectures that are supported by Apple (without having to cast the 
parameters).”

They are documented in (all version I think) of the String Programming Guide.
___

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: Panes vs. Separate Windows

2016-01-11 Thread Marco S Hyman
> My reasoning is that if you make it inflexible, you risk getting (say) 50% 
> lovers and 50% haters. If you make it flexible, you risk getting 40% lovers 
> and 40% haters, and 20% people who are annoyed because it’s too flexible or 
> too complicated. That’s a net loss in satisfaction.

I think you can make a UI flexible without annoying too many people.  Example: 
start with one window with panes that can be toggle on-off a la Xcode. Now make 
the panes repositionable. That shouldn’t upset people too much, especially if 
you add a “restore default window layout” option in a menu.   Finally allow a 
pane to be dragged outside of the main window to form a new window.  For the 
finishing touch allow a pane to be dragged to an existing window.

The complexity is hidden for those that don’t want it.  The hard part is how to 
document operation without overwhelming those who are happy with the most basic 
of operations.

Marc
___

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: Translating offset from crash dump

2015-12-19 Thread Marco S Hyman
> corresponds to your code.  You might want to get the assembly from each of 
> lldb and "otool -tV", as each may provide symbolication that the other 
> doesn't.  Hopefully, nearby references to selectors or strings will help you 
> figure out which line of code the crash occurred on.

otool -t -V -function_offsets /path/to/obj/file

gives you the requested offsets, too.  At least it does in
$ otool --version
otool(1): Apple Inc. version cctools-877.8
disassmbler: Apple LLVM 7.0.2 (clang-700.1.81)



___

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 - internal class conforming to public protocol

2015-11-24 Thread Marco S Hyman

>> if I define an internal class which implements a public protocol, who is 
>> able to call the methods in that protocol? Anyone (it’s a public protocol), 
>> only classes in the same framework or source file (the class is internal)?
> 
> If you declare it internal it's internal. Adopting a public protocol doesn't 
> change that.

There is a specific note in the Swift book:

“If you define a public protocol, the protocol’s requirements require a public 
access level for those requirements when they are implemented. This behavior is 
different from other types, where a public type definition implies an access 
level of internal for the type’s members.”

Excerpt From: Apple Inc. “The Swift Programming Language (Swift 2.1 
Prerelease).” iBooks. 

As I read that adopting a public protocol requires the methods that implement 
the protocol to be public (but only those methods).
___

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: Dead Reckoning

2015-10-09 Thread Marco S Hyman
The code is in Swift. #define is not an option.

> There’s very little reason to use macros for things like this, when an inline 
> function is as efficient and safer.

IMHO function calls also help readability. My version looks like this:

private let π = M_PI
private let d2r = π / 180   // degrees to radians adjustment
private let r2d = 180 / π   // radians to degrees adjustments

private func degreesToRadians(degrees: Double) -> Double {
return degrees * d2r
}

private func radiansToDegrees(radians: Double) -> Double {
return radians * r2d
}


Yeah, "π = M_PI" wasn’t really needed.

Marc

___

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: questions on WebView for Mac apps

2015-09-30 Thread Marco S Hyman
On Sep 30, 2015, at 2:20 PM, Alex Hall  wrote:
> 
> Thanks everyone. I'm now using WKWebView, but it's… odd. I see only WebView 
> in the object library in Xcode, no WKWebView at all.

No WKWebView in IB. You have to build your view in code.  At least it was that 
way last time I checked.
___

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: using constants from Obj-c in swift

2015-09-25 Thread Marco S Hyman
Arrgh... typo

> scrollview.borderType = NoBorder

That should be 

scrollview.borderType = .NoBorder

of course.  How come I never see that kind of thing until AFTER I hit send.
___

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: using constants from Obj-c in swift

2015-09-25 Thread Marco S Hyman
On Sep 25, 2015, at 11:43 AM, Boyd Collier  wrote:
> 
> In objective-c programs, there are places where one can write lines like the 
> following:
> 
> [scrollview setBorderType:NSNoBorder];
> 
> with NSNoBoarder being specified in an enum in NSView.  But enums in swift 
> are a different sort of beast, and I’ve not yet figured out what get the same 
> job done.

Swift will replace an accessor like setFoo with direct access to the property 
foo.  For your case the documentation for setBorderType says the swift version 
is

var borderType: NSBorderType

If you then look at NSBorderType you’ll see this:

enum NSBorderType : UInt {
case NoBorder
case LineBorder
case BezelBorder
case GrooveBorder
}

> Is there a straightforward way to do this?  (I’m using swift 2 in Xcode 7)

Translating [scrollview setBorderType:NSNoBorder]; to swift is

scrollview.borderType = NoBorder


After doing this a few times the pattern will become pretty obvious and you’ll 
need to go to the doc less and less.

Marc
___

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: String.join()?

2015-09-04 Thread Marco S Hyman

> Searching the documentation for joinWithSeparator turns up nothing.

I’ve found the doc to be lacking in most beta builds, at least with respect to 
swift. One of the first things I commonly do is open a playgound and “import 
Swift” then command click on Swift to see the header.  If I remember I’ll save 
that header so I can diff it against the previous version (assuming I saved it, 
too) to see what’s new.

joinWithSeparator is defined for SequenceType and String.

Marc
___

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: Help understanding Apple's approach in documentation a little better.

2015-08-16 Thread Marco S Hyman
 
 If the debugger's variable pane exposes it, it's misleading if it doesn't 
 somehow indicate that it's not for the developer to access.

It is there for the developer to access -- when debugging.  Might even be 
useful. I sometimes find the information useful when trying to understand how 
something is put together.  But don’t use it for development. 

 At the least, it's confusing, because the docs say it's not supposed to be 
 there, yet there it is.  

The docs say no such thing or did I miss explicit statements that only 
documented methods and properties will ever exist?  I think Ken is correct in 
saying Their non-presence in the documentation and headers” is what shows them 
as private.  Private is not that same as “not supposed to be there”.
___

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 enums and NSNotificationCenter

2015-08-06 Thread Marco S Hyman

 On Aug 6, 2015, at 10:38 AM, Rick Mann rm...@latencyzero.com wrote:
 
 I guess. But we need some kind of extensible way of defining a set of valid 
 selectors, ideally with optional string conformance and raw values (but not 
 required to be strings). 

Maybe. Sounds like you want to use all of the familiar Objective-C patterns in 
Swift. Not all patterns translate to a strongly typed language.  That may be a 
good thing.

If you are thinking in terms of selectors you might not be thinking in Swift. 
Try searching for the term selector in “The Swift Programming Language” :)
___

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: 'Bool' is not convertible to 'BooleanLiteralConvertible'

2015-07-27 Thread Marco S Hyman
On Jul 27, 2015, at 3:06 PM, Quincey Morris 
quinceymor...@rivergatesoftware.com wrote:

 The problem is that kSecReturnData is a CFString, which is not a type that’s 
 bridged automatically in the construction of a dictionary. The following 
 works for me in a playground (b4):
 
   let d1 = [ kSecReturnData as NSString : true ]


or
let d1 = [ String(kSecReturnData) : true ]

if you can/want to use a String type.

Marc
___

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: Generics Question

2015-07-26 Thread Marco S Hyman
 func genericForT(s:String) - T {
 
return T(s)!  // error. ’T’ cannot be constructed because it has no 
 accessible initializers
 }

At compile time there is no way of determining if T has an initializer that
takes a string. You could do something like this



protocol InitFromString {
init?(_ value: String)
}

func genericForT: InitFromString(s:String) - T {

   return T(s)!
}



Then add extensions to the various types you want to convert to make sure
they conform to the InitFromString protocol.


___

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

Window size and location defaults

2015-07-05 Thread Marco S Hyman
Hello,

I’m playing with an OS X app using storyboards.  I’ve assigned an
Autosave name to the window in Xcode (version 7) and see this in user
defaults after starting the program.

  NSWindow Frame MainWindow = 1040 566 540 300 0 0 2560 1417 “;

If I change the window size and check defaults I see the change.

  NSWindow Frame MainWindow = 1040 490 619 376 0 0 2560 1417 “;

The change is still there when checking the defaults after app termination.
However, the next time I run the app I get the original window size and
autosave info is reset to its initial value.

What am I doing wrong and/or not doing?

Marc
___

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 TypeA - TypeB?

2015-07-02 Thread Marco S Hyman

 
 I can write in-line handlers for this, but I'm trying to write a separate 
 method, and just assign the method as a handler, and I can't seem to get the 
 signature right.


It gets interesting when you want to also specify that the handler uses the
C calling convention to pass as a callback to legacy code.  AFAICT you can’t
do that using a function, but you can when assigning a closure to a variable.
The handler winds up looking something like

let handler: @convention(c) UnsafeMutablePointerVoid - Void = {
arg in
// ...
}


___

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 2 init() with CF types and throws

2015-07-01 Thread Marco S Hyman

 class
 Context
 {
init()
throws
{
let cocoaCTX = NSGraphicsContext.currentContext()
guard let sysCTX = cocoaCTX.graphicsPort as! CGContextRef else { throw 
 Errors.InvalidContext }
CGContext = sysCTX;
}
 
var CGContext : CGContextRef
 }

You can’t do that. The CGContext variable MUST be initialized before you
can throw, even in a failable initializer (which this isn’t). It’s a current
shortcoming of the language.  That is likely causing some of the errors you
are seeing.

Something like this works (Xcode 7)

if let currentContext = NSGraphicsContext.currentContext() {
var context: CGContext! = nil
// 10.9 doesn't have CGContext
if #available(OSX 10.10, *) {
context = currentContext.CGContext
} else {
// graphicsPort is type UnsafePointer()
context = unsafeBitCast(currentContext.graphicsPort,
CGContext.self)
}
// do something with context
}

That’s not an initializer, but the point is you can’t guarantee that the
context won’t wind up nil and must account for that.  Also, I found when
using graphicsPort on 10.9 (this code originally predated Swift 2) the
unsafeBitCast was necessary to get a working value of context.   Using
the currentContext.CGContext property is so much easier.

Marc
___

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 and parameter names

2015-06-24 Thread Marco S Hyman
On Jun 24, 2015, at 4:09 PM, Rick Mann rm...@latencyzero.com wrote:
 
 I guess I disagree: it's obvious in most cases. Again, I'm just arguing for 
 the OPTION. You can always choose to use the parameter name if you wish.

You have the option.  Given this signature:

   func foo(intArg: Int, stringArg: String) - Bool { ... }

add this code to call the function without named arguments.

   func foo(intArg: Int, _ stringArg: String) - Bool {
   return foo(intArg, stringArg: stringArg)
   }

Now you can call it either way.  

I like that I do NOT have the ability to mix and match calling conventions
by accident which could possibly confuse code readers. Especially when I am
the code reader!  If I really need the the option to do mix styles adding
code such as that above wouldn’t be an issue.

Marc
___

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 and parameter names

2015-06-24 Thread Marco S Hyman

 code such as that above wouldn’t be an issue.
 
 Again, pretty huge burden. 

Only a burden to one who wants the ability to call functions or methods with
or without argument names.  Many (most?) are not asking for that ability.
___

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: Trouble With NSURLSession...

2015-06-16 Thread Marco S Hyman
 swift:20:26: Cannot find an initializer for type 'NSURLSession' that accepts 
 an argument list of type '(configuration: NSURLSessionConfiguration, 
 delegate: HSNDataManager.Type, delegateQueue: nil)’

You are passing “self” as the delegate in a *class* method. The class is
not a NSURLSessionDelegate?.  Instances of the class are.

Marc
___

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: for case and if case (Swift 2)

2015-06-11 Thread Marco S Hyman

 yes ‘=‘ instead of ‘==‘. I hit on that trying random things and don’t really 
 understand it, an ‘=‘ in an if() test is something I’m having trouble 
 getting my brain around.
 
 It’s not that strange. The statement contains an initializer (conceptually 
 'let a = y.assocatedValue’), so there’s gonna be a “=“. Note that in your 
 original version:
 
 if case test.two( let a ) == y {  }
 
 what’s on the LHS of the “==“ isn’t a value of any kind — what were you 
 expecting the value of ‘a’ to be?

You extract each associated value as a constant (with the let prefix) or a 
variable (with the var prefix) for use within the switch case’s body...”

Given that I’d expect if case to act as if I’d done roughly the same thing
with a switch statement

switch test {
case .two(let a)
// do something with .two’s associated value
default:
// do something else
}


Marc
___

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 this Swift initializer legal

2015-06-06 Thread Marco S Hyman
 public class RDKBLEService : NSObject
 {
   let peripheral : CBPeripheral
 
   public init( peripheral: CBPeripheral )
   {
   self.peripheral = peripheral
   }
 }

Swift doesn’t think init in NSObject is a designated initializer.  Add
“override” as you would with a designated initializer and you get an error
stating “does not override a designated initializer from its superclass”.

I do not know why.

Marc
___

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: Looking at self = [super init].

2015-06-01 Thread Marco S Hyman
On Jun 1, 2015, at 4:16 PM, Michael David Crawford mdcrawf...@gmail.com wrote:
 
 The paper entitled Goto Considered Harmful - by Dijkstra? - was
 criticizing spaghetti code.  At the time, commonly used programming
 languages did not have control flow statements like if/then/else,
 do/while, while or switch/case.  Instead, other than fortran's
 do/continue you had to roll your own control flow; often it was done
 quite poorly.

Minor nit... Dijkstra was one of the authors of Algol 60 which had plenty
of control flow statements.  He explicitly mentions goto with respect to
algol in his “considered harmful” note:

   Finally I should like to record (as I remember it quite distinctly) how
Heinz Zemanek at the pre-ALGOL meeting in early 1959 in Copenhagen quite
explicitly expressed his doubts whether the go to statement should be
treated on equal syntactic footing with the assignment statement. To a
modest extent I blame myself for not having then drawn the consequences
of his remark.”

However, he follows that with this:

   I remember having read the explicit recommendation to restrict the use of
the go to statement to alarm exits, but I have not been able to trace it;
presumably, it has been made by C. A. R. Hoare.”

which sounds like the “religion” being discussed.   My feelings on that topic
are private, as I feel most religious beliefs should be :)

Marc
___

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: Anyone else having trouble with the Provisioning Profile?

2015-05-28 Thread Marco S Hyman
On May 28, 2015, at 10:26 AM, Rick Mann rm...@latencyzero.com wrote:
 
 And, it's still not resolved. Would everyone please email 
 devprogr...@apple.com and let them know you're seeing it, too? Give them a 
 screenshot, and let them know the following:

I was seeing the issue until I turned off Ghostery.  Whitelisting the page
in Ghostery seems to have resolved the issue for me.

Marc

___

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: Stupid ! and ?

2015-04-25 Thread Marco S Hyman
On Apr 25, 2015, at 7:59 AM, William Squires wsqui...@satx.rr.com wrote:

 Where I'm running into problems is this line of code:
 
 func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: 
 NSIndexPath) - UITableViewCell
 {
 var cell = tableView.dequeueReusableCellWithIdentifier(simpleTableIdentifier) 
 as? UITableViewCell
 if (cell == nil)
  {
  cell = UITableViewCell(style: UITableViewCellStyle.Default, reuseIdentifier: 
 simpleTableIdentifier)
  }
 cell!.textlabel.text = dwarves[indexPath.row] // Problem here
 return cell
 }
 
 Xcode is complaining that a ? or ! is needed after textLabel, and 
 before the .text, but I don't really understand which one to use.

If you know and can prove that textLabel is NEVER nil then use !.
! translates to “I know this is not nil and if I’m wrong it’s OK to throw an
exception that terminates the program”.

If textLabel could be nil then use ?

Also, you are returning cell which is an optional but your function says it
is returning a UITableViewCell.   Either return cell! or change the function
to return an optional UITableViewCell.

I find optionals to be fantastic.  It’s interesting to find how optional
values thread their way through an application until you get to the point
where they must be unwrapped… and then you find it is nil because you made
a coding error 7 levels up the call tree.


___

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: Crash at iOS App Startup - What Could Have Gone Wrong?

2015-04-21 Thread Marco S Hyman
On Apr 21, 2015, at 5:35 AM, Michael Crawford mdcrawf...@gmail.com wrote:
 
 The reason I haven't been using version control is that I prefer to
 operate my own servers - but then I have to set them up, and it's
 quicker just to roll a tarball.

Huh?  Nothing about a version control system limits your use of your own
servers.  Pick one you can live with and use it.  git, svn, mercurial, cvs,
old rcs, whatever.  Doesn’t cost anything more than the time to download
and install.  With Xcode you’ve already got git (and svn?).

Use of version control make answering the “what the hell did I change that
caused that to happen” question trivial to answer.   Commit early and often.

Roland King r...@rols.org wrote

 Have you set an exception breakpoint which fires at the time the exception is 
 thrown, if there is an exception? That helps sometimes. 

And if you do have exception breakpoints enabled check to be sure that you are
only breaking on Objective-C breakpoints.

Marc
___

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: How to determine if a Character represents whitespace?

2015-04-03 Thread Marco S Hyman

 extension Character {
 
   func isMemberOfSet( set:NSCharacterSet )
 - Bool
   {
 // The for loop only executes once;
 // its purpose is to convert Character to a type
 // you can actually do something with
 for char in String( self ).utf16 {
   if set.characterIsMember( char ) {
 return true
   }
 }
 return false
   }
 
 }

I believe your comment that the loop executes once is incorrect.   It may
execute more than once when the Character is a composed character that
maps to multiple utf16 characters.

Example (stolen from this link):
  
http://stackoverflow.com/questions/27697508/nscharacterset-characterismember-with-swifts-character-type


let acuteA: Character = \u{e1}   // An a with an accent
let acuteAComposed: Character = \u{61}\u{301}// Also an a with an accent

Both are a single Character.  The latter will cause the loop to iterate twice.

Marc
___

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: How to determine if a Character represents whitespace?

2015-04-03 Thread Marco S Hyman

 On Apr 3, 2015, at 11:04 AM, Quincey Morris 
 quinceymor...@rivergatesoftware.com wrote:
 
 On Apr 3, 2015, at 04:00 , Charles Jenkins cejw...@gmail.com wrote:
 
for char in String( self ).utf16 {
  if set.characterIsMember( char ) {
return true
  }
 
 Now we’re back to the place we started. This code is wrong. It fails for any 
 code point that isn’t representable a single UTF-16 code value, and it fails 
 for any grapheme that isn’t representable as a single code point.

No it doesn't.   Give it a test.

let acuteA: Character = \u{e1}   // An a with an accent
let acuteAComposed: Character = \u{61}\u{301}// Also an a with an accent

func howManyChars( c: Character) - Int {
var count = 0
for char in String( c ).utf16 {
count += 1
}
return count
}

howManyChars(acuteA)// returns 1
howManyChars(acuteAComposed)// returns 2

The original code will return true only if all code points map to white space.

Marc

___

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 move a file out of the way?

2015-03-30 Thread Marco S Hyman

 On Mar 29, 2015, at 10:51 PM, Daryle Walker dary...@mac.com wrote:
 
 An idea... move the destination file, if it exists, to the trash.
 See NSFileManager's trashItemAtURL:resultingItemURL:error: to do that in a
 safe manner.   Trash the old file then save the new.
 
 That was one of my suggestions. Sometimes, when I trash something when a long 
 trash-emptying is already happening, a warning alert appears that says the 
 newly trashed file will be directly deleted instead. I wonder if that alert 
 still gets displayed when the trashing is programmatically instigated. That 
 would be a surprise to the user since my program is a command-line tool 
 (which may be called from a script someday).

I would not expect an alert, but I'm just guessing.  What I would expect is
an error return.   Shouldn't be too hard to create a very large Trash and
and some test code to see what happens in that situation.


___

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 move a file out of the way?

2015-03-24 Thread Marco S Hyman
 If renaming is the answer, is there any sample code to do this safely, taking 
 care of all cases?  (For example, replacement name already taken, or adding 
 an extension if the file doesn’t start with one, etc.)

An idea... move the destination file, if it exists, to the trash.
See NSFileManager's trashItemAtURL:resultingItemURL:error: to do that in a
safe manner.   Trash the old file then save the new.

Marc
___

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: Finding the use of a private API

2015-03-16 Thread Marco S Hyman

 nm -u on my iOS app's binary emits:

Run nm on each of the .o files that make up the binary.

$ cd ~/Library/Developer/Xcode/DerivedData/...
$ for f in *.o; do echo $f  nm -u $f | grep {whatever}; done

Marc
___

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: NSRunningApplication executableURL issue in Swift

2015-03-11 Thread Marco S Hyman

 The consequence of this possible future scenario would be that an Apple 
 engineer writing code for an interoperable framework would write the .m file 
 in Obj-C, but the public .h file in Swift.

Except that swift doesn't have .h files.  The auto generated files your
are seeing are not .h files. Perhaps you are thinking of them that way because
of your C/Obj-C background.   Think of them instead as abbreviated .swift
files.

Marc
___

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: Create a NSURL as a way to validate urls - not working

2015-03-03 Thread Marco S Hyman

 class Utils: NSObject {
 
class func isValidUrl(url: NSURL?) {
   var lower = url?.scheme?.lowercaseString
return lower == http || lower == https
  }
 }
 Sadly I'm getting and error in the return line that I can't interprete:
 Cannot invoke == with argument list of type `($T4, $T8)`
 
 What I'm doing wrong?

You didn't specify the return type of the function.
lower is an optional and may be nul.
Why is it a class function?

Try it this way using a global function

func isValidUrl(url: NSURL?) - Bool {
if let lower = url?.scheme?.lowercaseString {
return lower == http || lower == https
}
return false
}

let foo = NSURL(string: some/string)
let bar = NSURL(string: http://some/string;)
isValidUrl(foo) // false
isValidUrl(bar) // true


I'd also rename the the function to hasHTTPScheme or 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: Convert CGFloat to NSNumber

2015-02-24 Thread Marco S Hyman

 On Feb 24, 2015, at 10:16 AM, Quincey Morris 
 quinceymor...@rivergatesoftware.com wrote:
 
 The following work, too (Xcode 6.1.1):
 
   let f1: NSNumber = font.pointSize
   let f2 = font.pointSize as NSNumber
 
 ...
 
 (Things may have changed in Swift 1.2, though.)
 


Works fine in 1.2, too.

$ swift
Welcome to Swift version 1.2. Type :help for assistance.
  1 import Foundation
  2 let f0: CGFloat = 42.0
f0: CGFloat = 42
  3 let f1: NSNumber = f0 
f1: NSNumber = Double(42)
  4 let f2 = f0 as NSNumber
f2: NSNumber = Double(42)


Marc


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: … the actual OpenSSL

2015-01-11 Thread Marco S Hyman
 My question is in two parts:

See https://github.com/libressl-portable/portable

The resulting library and 'openssl' utility is largely API-compatible with
OpenSSL 1.0.1. However, it is not ABI compatible - you will need to relink your
programs to LibreSSL in order to use it, just as in moving from OpenSSL 0.9.8
to 1.0.1.

No comment regarding part (b) of your question.
___

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 Array with Struct Members (Compiler Bug?)

2014-12-11 Thread Marco S Hyman
On Dec 11, 2014, at 3:24 PM, Daniel Blakemore dblakem...@pixio.com wrote:
 
 If I do this, however, it breaks:
 var arr2 = [Array](count:6, repeatedValue:[Color](count:8, repeatedValue:
 Color()))

[Array] is syntactic sugar for ArrayArray.  It is not a complete type.
It is an array of arrays of 

Let the type inference work for you.  Try it this way and see if it generates
what you desire.

var arr2 = Array(count:6, repeatedValue:Array(count:8, repeatedValue:Color()))

Marc


___

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 Array with Struct Members (Compiler Bug?)

2014-12-11 Thread Marco S Hyman

 Why did it compile if it's an incomplete type?  Shouldn't that be something 
 that you catch at compile time in a type-safe language?

Don't know.  It failed on my machine.   I copied/pasted your code to a
playground and got a red exclamation point due to a fault. Then I looked
closer at the code and saw the [Array] which was wrong.

If you don't want to trust type inference you can fully specify the type.

ArrayArrayColor(...)or
[ArrayColor](...) or
[[Color]](...)

which are all different ways of coding the same thing.  I find Array(...)
less to type :)
___

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 without ambiguity

2014-11-01 Thread Marco S Hyman
On Nov 1, 2014, at 9:17 AM, Gerriet M. Denkmann gerr...@mdenkmann.de wrote:
 
 TextField  (this should be ≥ something, otherwise fitting to content)
 ...
 variable distance (≥ some minimum)

Are they the same priorities?

Marc
___

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: Return values of NSAlert

2014-10-21 Thread Marco S Hyman
 
 The suggested alternative is NSAlertFirstButtonReturn, etc., which have 
 values, which very much unlike the actual returned values.

Those values worked for me found by trial an error because the documentation
and headers made no sense at all.   I was working in swift and found
this code to work.

var alert = NSAlert()
alert.addButtonWithTitle(NSLocalizedString(SAVE, comment: Save))
alert.addButtonWithTitle(NSLocalizedString(CANCEL, comment: Cancel))
alert.addButtonWithTitle(NSLocalizedString(DONT_SAVE, comment: Don't 
Save))
alert.messageText = NSLocalizedString(UNSAVED_TITLE, comment: Unsaved 
Changes)
alert.informativeText = NSLocalizedString(UNSAVED_DESC, comment: Unsaved 
Changes)
alert.beginSheetModalForWindow(window) {
(response: NSModalResponse) - Void in
switch response {
case NSAlertFirstButtonReturn:  // Save
self.save(nil)
case NSAlertSecondButtonReturn: // Cancel
// Close/terminate cancelled
return
default:
// Don't bother saving
break
}
window.documentEdited = false
window.close()
}

NSAlertFirstButtonReturn was the value returned when the first button
added to the NSAlert was pressed, etc.

I don't understand it.  I accept that it works (for now, anyway)


___

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 does the Swift Darwin module work?

2014-10-18 Thread Marco S Hyman
 So you get to go wrap fcntl() in something else it seems. 
 
 So, how would I do that, exactly? I suppose I have to pass Objective-C 
 collection types to a method (which could be a straight C function) from a 
 Swift call? That is, can a Swift variadic call translate into a C function 
 call that accepts Obj-C collections?

I don't think you need collections.  fcntl's third argument varies
according to the command.  It is not always needed.  Write a c file containing
wrappers that can be called from swift for the various commands you need. I'm
thinking something like this (untested).

int
fcntl_dupfd(int fildes, int arg)
{
return fcntl(fildes, F_DUPFD, arg);
}

int
fcntl_getlk(int fildes, struct flock *arg)
{
return fcntl(fildes, F_GETLK, arg)
}

etc. Will that work?


___

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: NSUserDefaults not sticking

2014-09-10 Thread Marco S Hyman
On Sep 10, 2014, at 8:19 PM, Charles Srstka cocoa...@charlessoft.com wrote:

 
 Where did you get the idea that NSUserDefaults doesn't work for sandboxed 
 apps? It certainly does.
 
 #import Foundation/Foundation.h
 
 int main(int argc, const char * argv[]) {
@autoreleasepool {
NSUserDefaults *def = [NSUserDefaults standardUserDefaults];
NSDictionary *domain = [def 
 persistentDomainForName:@com.apple.TextEdit];
 
NSLog(@%@, domain);
}
return 0;
 }

Ahh, you want to read defaults for some other app.   Nope.  Can't
do that.   Says so right in the doc:

Sandbox Considerations
A sandboxed app cannot access or modify the preferences for any other app. (For 
example, if you add another app's domain using theaddSuiteNamed: method, you do 
not gain access to that app's preferences.)

Attempting to access or modify another app's preferences does not result in an 
error, but when you do, OS X actually reads and writes files located within 
your app's container, rather than the actual preference files for the other 
application.




___

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: memmove in Swift

2014-08-20 Thread Marco S Hyman
On Aug 20, 2014, at 8:32 PM, Gerriet M. Denkmann gerr...@mdenkmann.de wrote:

 But I thought that maybe memmove might be more efficient:

Optimizing already?

 
 let dest : UnsafeMutablePointerVoid =  arr + lowerIndex + 1

arr + lowerIndex + 1 is meaningless to Swift.  An [Int32] is not a
pointer that can be offset by some number of elements. I don't think
C thinking helps when trying to understand this language.



___

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: Class in Swift

2014-08-16 Thread Marco S Hyman
On Aug 16, 2014, at 2:13 PM, Quincey Morris 
quinceymor...@rivergatesoftware.com wrote:

 Er, am I missing something, or is this not a case that generic functions 
 handle quite easily?

That's what I thought, too.

protocol MyProtocol {
init()
// ...
}

func myFunctionT: MyProtocol() {
//  for(...)  {
//  p = ...
//  if ( p is special ) {
let aClass = T()
// do something with aClass
//  }
//  }
}


There is a requirement that an init function must be part of the
protocol.

Marc
___

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: Stuck in Swift

2014-08-14 Thread Marco S Hyman
On Aug 14, 2014, at 1:51 AM, Gerriet M. Denkmann gerr...@mdenkmann.de wrote:

 Well, it should, but it does not. I still get the error: 'String' is not a 
 subtype of 'AppDelegate'

Note the location of the error.  The compiler is complaining that
myStatusHandler is the wrong type in this line:

   let someThing = SomeClass(statusHandler: myStatusHandler)

And it is the wrong type.  myStatusHandler is a method of class
AppDelegate and only has meaning with respect to an instance of that
class.  You may know that AppDelegate is intended to be a singleton,
but the compiler does.  Assuming you really want to do this I think
you need to code it something like...

// because a class var isn't supported, yet.
var statusString : String?

class AppDelegate: NSObject
{

let someThing = SomeClass(statusHandler: AppDelegate.myStatusHandler)

class func myStatusHandler(s: String)
{
statusString = s
}
}

class SomeClass
{
var statusHandler:  (String) - Void

init( statusHandler: String - Void)
{
self.statusHandler = statusHandler
}
}


___

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: diff tool on iOS?

2014-08-13 Thread Marco S Hyman
On Aug 13, 2014, at 7:54 AM, Koen van der Drift koenvanderdr...@gmail.com 
wrote:

 Any tips for where I can find the source code for BSD diff? I found the GNU
 diffutils already here: http://www.gnu.org/software/diffutils/.

Try one of the bsd source repositories.  An example that I'm
familiar with is the OpenBSD tree.  Diff source is at

http://openbsd.cs.toronto.edu/cgi-bin/cvsweb/src/usr.bin/diff/

Marc
___

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: Resolve alternative TLD

2014-07-03 Thread Marco S Hyman
On Jul 3, 2014, at 10:31 AM, Alex Zavatone z...@mac.com wrote:

 Firefox doesn't resolve start.rental either.
 Neither does Chrome.

Yup. It is not a valid TLD in that .rental is not known to any of
the root servers.  Domain lookups for uncached entries start at one
of the root servers.   If those servers don't know how to get to the
.rental domain then for all practical purposes it doesn't exist.

On the other hand .rentals  (note the trailing s) is a valid
TLD.  See http://www.iana.org/domains/root/db/rentals.html
However, the .rentals server knows nothing about the start.rentals
domain.

$ whois -h whois.donuts.co start.rentals
Domain not found.

...

Marc

___

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: get set firewall status

2014-05-19 Thread Marco S Hyman

On May 19, 2014, at 12:02 PM, Jens Alfke j...@mooseyard.com wrote:

 It’s ipfw under the hood; a web-search for that might turn up some info. 
 Also, I suggest asking on the darwin-userlevel list, which is a more 
 appropriate forum for this question since it isn’t about Cocoa.

ipfw is deprecated.  pf -- see pfctl(8) -- is taking its place.
That may complicate things.


___

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: get set firewall status

2014-05-19 Thread Marco S Hyman

On May 19, 2014, at 1:03 PM, Alex Zavatone z...@mac.com wrote:

 Out of curiosity, in which version of the OS is pf taking over for ipfw?

The switch started in Lion.   I don't know if ipfw has been completely
replaced. I seem to remember that some things were still being
done in ipfw.  Or maybe I'm thinking of the Application Layer
Firewall. 

Marc
___

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: Help with Help

2014-05-07 Thread Marco S Hyman
 The HTML in the app and on the website is slightly different, I use PHP to 
 generate the HTML.
 
 A more modern approach would probably be to use a static site generator like 
 Jekyll, which would allow you to use templates, write in Markdown, etc.

You can use Markdown with PHP: https://github.com/michelf/php-markdown
and possibly others to generate your static pages, too.

Marc
___

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: Preferences caching?

2013-11-27 Thread Marco S Hyman
 What on earth is going on with your app(s) that requires preferences to be 
 deleted? If, after all these years of your being a very accomplished 
 developer, your apps aren’t robust enough to deal with unusable or 
 inconsistent values in prefs — or, more to the point, put the prefs into such 
 a state to begin with — then I humbly suggest you treat that as a major bug, 
 and fix it.

Ha! Tell that to Apple. There is more than one Apple support note where one of 
the troubleshooting steps is to trash your preferences. An example off the top 
of my head:

http://support.apple.com/kb/TS3893?viewlocale=en_USlocale=en_US

In this case it is such a common thing to do that there is a third party 
application to save, trash, and restore those specific preferences for you.
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Custom Delegate - Using _delegate works but not delegate or [self delegate]

2013-03-26 Thread Marco S Hyman
 3) The TKOutlineView then later attempts to send the TKOutlineViewDelegate 
 message from #1 above to its delegate.

The code noted earlier used introspection to ensure the delegate responded
to the selector before the message was sent.  A non TKOutlineViewDelegate
conforming object won't respond to the selector.  The message won't be
sent.  No exception will be raised.

Or did I miss something?

Marc
___

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 readonly property

2012-12-07 Thread Marco S Hyman
On Dec 7, 2012, at 8:18 PM, Steve Sisak sgs-li...@codewell.com wrote:

 I'm interested if there are an any issued I'm missing in the Obj-C, 
 @synchronized(self), instance variable case.


Your pattern can fail if this line
_someDictionary = temp;
isn't atomic.



___

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: Does anyone find Restore Snapshot kind of weak?

2012-11-28 Thread Marco S Hyman
On Nov 28, 2012, at 3:08 PM, Quincey Morris 
quinceymor...@rivergatesoftware.com wrote:

 Mostly an easy automated crutch for people who find git and svn a bit too 
 technical.
 
 Oh, come on! If you're prepared to commit your changes before *every* global 
 search/replace and *every* refactor then snapshot is similar to a commit. Do 
 you commit before every replace and every refactor? I thought not.

Written by someone who doe not appreciate the benefits of git staging and the 
index.  I will stage changes in a tree (git add) that may not be quite ready 
for a commit before doing something that I may not like and want to undo.  If I 
like the results of my large change I can re-stage.  If I don't like the result 
I can revert to the staged versions of the files with a simple check-out.

This has nothing to do with cocoa... perhaps it should be moved to the xcode 
list?

Marc




___

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: nssound question

2012-11-21 Thread Marco S Hyman
On Nov 21, 2012, at 6:04 PM, Keary Suska cocoa-...@esoteritech.com wrote:

 Are you sure this is the case? All sounds (including system beeps) on my 
 Macs always play through external speakers when connected, and I don't seem 
 to have any way to tell it otherwise…

Sound preference pane, Sound Effects tab.  It lets you select the device for 
sound effects.  I've mine to Internal Speakers.  Another choice is Selected 
sound output device.

Marc
___

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: [SOLVED] Re: What does this mean?

2012-11-07 Thread Marco S Hyman

On Nov 7, 2012, at 7:23 PM, Graham Cox graham@bigpond.com wrote:

 Never mind, Time Machine saved my ass. I must have touched the file somehow 
 (why are these writable?).

Bet it's another case of autosave doing unintended harm.  Checking the Ask to 
keep changes when closing documents option in General System Preferences helps 
mitigate the issue.

Marc
___

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: Blocks with return type

2012-09-29 Thread Marco S Hyman
On Sep 29, 2012, at 9:11 PM, Quincey Morris 
quinceymor...@rivergatesoftware.com wrote:
 I believe it's official syntax. It's not (quite) documented in the developer 
 documentation, but I assume it's in the clang docs somewhere.

http://clang.llvm.org/docs/BlockLanguageSpec.txt


___

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: Autosave in place - common use case that makes me hate it

2012-09-20 Thread Marco S Hyman
On Sep 20, 2012, at 9:19 PM, Graham Cox graham@bigpond.com wrote:

 Honestly, this really stinks. I'm finding it hard to believe that Apple in 
 their wisdom feel this is actually easier to use than the old way of doing 
 things. I'd be interested to hear others' thoughts on this, surely it's not 
 just me?

It's not just you.  Checking Ask to keep changes when closing documents
in General System Preferences of Mountain Lion helps.  Autosave has
kicked in, but you've got a chance to Revert Changes when closing
the doc to get it back to your desired state.

Marc


___

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: autosavesInPlace and sandbox

2012-09-07 Thread Marco S Hyman
 Basically, there is no case in which the old save paradigm makes sense
 and the new autosave paradigm does not.

Autosave does not make sense for those users who create new
documents by editing an existing doc then doing a save-as.
OK, it works if they remember to do the save-as before making
any changes... all that needs to be changed is many years of
user habit.  Until those habits change there are going to be
frustrated users.

Marc
___

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: Network and DarkWake

2012-08-31 Thread Marco S Hyman
On Aug 31, 2012, at 6:04 AM, Gerriet M. Denkmann gerr...@mdenkmann.de wrote:

 But often (not always) my app (while in DarkWake) gets:
 Error getaddrinfo(time.apple.com, ntp) - nodename nor servname provided, or 
 not known

I believe its a race condition.  NTP is trying to access the network
before it is fully re-initialized.  I'll see this (or similar network
races) when waking my iMac up.  I don't believe it has anything to
do with DarkWake, specifically.

Marc
___

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: Apple Aperture-like look feel

2012-08-17 Thread Marco S Hyman
On Aug 17, 2012, at 4:31 PM, Nick eveningn...@gmail.com wrote:

 Here are some of the other screenshots.. I wonder what would it take
 to create something like that..
 They even customized the menus (it has black background and a custom fount)..
 
 
 http://itc.ua/files/pics/2(713).jpg

I think that is Adobe Lightroom, not Aperture.

Marc
___

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: CGXDisableUpdate?

2012-08-17 Thread Marco S Hyman
On Aug 17, 2012, at 5:44 PM, John MacMullin john.macmul...@cox.net wrote:

 It appears that my program hangs after the following console log events:
 
 8/17/12 3:15:11.555 PM WindowServer[104]: CGXDisableUpdate: UI updates were 
 forcibly disabled by application X for over 1.00 seconds. Server 
 has re-enabled them.
 8/17/12 3:15:25.556 PM WindowServer[104]: disable_update_likely_unbalanced: 
 UI updates still disabled by application X after 15.00 seconds 
 (server forcibly re-enabled them after 1.00 seconds). Likely an unbalanced 
 disableUpdate call.
 
 I am not directly calling CGXDisableUpdate anywhere in my code.
 
 Any ideas what causes this?

Are you processing images?  I'll get it by dropping a large
raw image into an image well on my oldish iMac.   I see it when
Aperture is processing images, too.

Marc
___

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


Speed up image display for large raw images?

2012-08-15 Thread Marco S Hyman
Hi All,

I'm looking for some suggestions in speeding up image display.
This bit of code is called when a table view selection changes.
It can take 2-4 seconds for the image to be displayed in a
related NSImageView.

- (void) showImageForIndex: (NSInteger) ix
{
NSImage *image = nil;
if (ix != -1) {
image = [[self imageAtIndex: ix] image];
...
}
[imageWell setImage: image];
}

imageWell is defined as

IBOutlet NSImageView *imageWell;

The images are typically 25 MB Canon 7D raw image files that have
been pre-alloc'ed and initWithContentsOfFile: 
The NSImageView is about 600x400 pixels.

Instruments says the time is being spent by raw image processing.
It looks like the delay is in [imageWell setImage: image];
This is logged during the delay...

Aug 14 11:50:35 dumbcat.snafu.org WindowServer[121]: CGXDisableUpdate: UI 
updates were forcibly disabled by application test for over 1.00 seconds. 
Server has re-enabled them.
Aug 14 11:50:37 dumbcat.snafu.org WindowServer[121]: 
reenable_update_for_connection: UI updates were finally reenabled by 
application test after 2.31 seconds (server forcibly re-enabled them after 
1.00 seconds)

The logs show that Apple's Aperture also has long delays preparing
7D raw images for viewing. Perhaps I am just asking too much from a
2007 model iMac.

Marc
___

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: Speed up image display for large raw images?

2012-08-15 Thread Marco S Hyman
On Aug 15, 2012, at 8:24 PM, Jens Alfke j...@mooseyard.com wrote:

 The images are typically 25 MB Canon 7D raw image files that have
 been pre-alloc'ed and initWithContentsOfFile: 
 
 NSImage doesn't actually load the image pixels until it needs to. Merely 
 initializing an instance won't do it.

That matches what I'm seeing. The code didn't originally
alloc and init the image until just prior to dropping it in
the image well.  I tried a pre alloc/init on the off chance it
would make things faster.  Nope.

 That said, NSImage has changed a lot over time (especially its caching) and 
 I'm not sure what the best way is to preload an image these days.

For this application the camera preview jpg inside of the raw image
would be of good enough quality.  I'm looking at what it would take
to extract that.

Marc
___

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: NSSavePanel: Another sandbox issue

2012-05-31 Thread Marco S Hyman
On May 31, 2012, at 2:46 PM, Kyle Sluder wrote:

 On May 31, 2012, at 2:43 PM, Alex Zavatone wrote:
 
 
 So, before I start waving my hands in the air, running around the office and 
 panicking, does this mean that the user can not save files where ever he/she 
 wants to on the HD in future versions of the Mac OS?
 
 No, it's completely and totally incorrect. It's obvious Marco either didn't 
 read or didn't understand the Sandboxing Guide.

Read... but forgot.  And Kyle is also correct that I don't fully
understand the Sandboxing Guide.  It doesn't help that every time I
read it there is a new version.

The problem I was replying to was an attempt to save something
*inside* the sandbox container and had nothing to do with the Documents
folder.  I mis-thought and mis-wrote as a result.  I'll shut up now.

Marc
___

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: Sandboxing. WTF?

2012-05-27 Thread Marco S Hyman
On May 27, 2012, at 9:55 PM, Graham Cox wrote:

 Currently though, my implementation falls at the first hurdle, which is here:
 
 CFArrayRef recentLibraries = 
 CFPreferencesCopyAppValue((CFStringRef)@iPhotoRecentDatabases,(CFStringRef)@com.apple.iApps);
 
 
 This returns nil in the sandboxed version, even though I have added 
 /Library/Preferences/com.apple.iApps.plist to my temporary exception 
 entitlements (user relative, read only). Oddly, I do not get a sandboxd deny 
 logged, which is why I was assuming it wasn't working at first. It must be 
 something else, but it works just fine in the non-sandboxed app. Anyone else 
 run into this?

AppSandboxDesignGuide.pdf says:
==
Accessing Preferences of Other Apps

Because App Sandbox directs path-finding APIs to the container for your app, 
reading or writing to the user’s preferences takes place within the container. 
Preferences for other sandboxed apps are inaccessible. Preferences for apps 
that are not sandboxed are placed in the ~/Library/Preferences directory, which 
is also inaccessible to your sandboxed app.

If your app requires access to another app’s preferences in order to 
function—for example, if it requires access to the playlists that a user has 
defined for iTunes—let Apple know about your needs using the Apple bug re- 
porting system. In addition, be sure to follow the guidance regarding 
entitlements provided on the iTunes Connect website.

With these provisos in mind, you can use a path-based temporary exception 
entitlement to gain programmatic access to the user’s ~/Library/Preferences 
folder. Use a read-only entitlement to avoid opening the user’s preferences to 
malicious exploitation. A POSIX function, such as getpwuid, can provide the 
file system path you need. For details on entitlements, see Entitlement Key 
Reference .


I think that is your issue.
___

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 app launching speed

2012-05-15 Thread Marco S Hyman
On May 15, 2012, at 2:50 PM, Jens Alfke wrote:

 Async NSURLRequest, as already mentioned. It’s a little bit clunky to use by 
 modern standards — I wish they’d add some nice block-based callbacks to it 
 instead of making me implement yet another delegate class — but it works 
 well, and it’s quite well documented by Apple and others.

I'd disagree regarding the quite well documented by Apple part.
Don't know about documentation by others.

Apple's doc has this bit of example code.


NSURLConnection *theConnection=[[NSURLConnection alloc] 
initWithRequest:theRequest delegate:self];
if (theConnection) {
// Create the NSMutableData to hold the received data.
// receivedData is an instance variable declared elsewhere.
receivedData = [[NSMutableData data] retain];
} else {
// Inform the user that the connection failed.
}


Is it possible for one of the delegate methods to be called before
receiveData is initialized?  The doc for initWithRequest:delegate: states

  This is equivalent to calling initWithRequest:delegate:startImmediately:
  and passing YES for startImmediately.

Sure looks like a possible race to me.  That disqualifies it as good
documentation.

Marc
___

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 app launching speed

2012-05-15 Thread Marco S Hyman
On May 15, 2012, at 5:13 PM, Jens Alfke wrote:

 On May 15, 2012, at 3:33 PM, Marco S Hyman wrote:
 
 I'd disagree regarding the quite well documented by Apple part.
 
 Have you read the URL Loading System guide, not just the class API docs?

The URL Loading System Guide contained the code I quoted.  Nowhere in that
doc does the term thread appear.   Yes, you are correct that I missed
the comment in the related class doc that stated delegate methods will be
called on the thread that started the async load operation.

In hindsight I should have expected that.

 So it’s bad documentation because it shows a race condition you thought up, 
 even though the race condition doesn’t actually exist? O_o

No, the URL Loading System Guide is bad documentation because it leaves 
important
details to the imagination of this reader. :)

Marc
___

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 warns about missing protocol definition, even though @protocol is used

2012-05-03 Thread Marco S Hyman
 I just tried this, and it gives me a warning:

That is what he's complaining about... the warning.

To the OP: there is no way a compiler can tell if a class conforms
to a protocol when the only thing it knows is the name of the
protocol.  Thus the warning.  Maybe it will compile and run...
maybe not.

Marc
___

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: Bookmark alias files v. Finder alias files

2012-04-15 Thread Marco S Hyman
On Apr 15, 2012, at 7:51 AM, Alex Zavatone wrote:

 Space savings definitely used to be one of the benefits.

Perhaps you are confusing alias with symbolic link?  They are
not the same thing even though the finder displays them using
the same icon.

Marc
___

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


  1   2   >