Re: What generates NSURLErrorUnsupportedURL?

2017-02-08 Thread Steve Christensen
Thanks Greg (and Jens). The URLs are coming from a server that the app uses. I 
haven't seen these errors in the past so somebody was probably doing some 
tinkering and messed something up.


> On Feb 8, 2017, at 7:16 PM, Greg Parker  wrote:
> 
>> On Feb 8, 2017, at 2:44 PM, Jens Alfke  wrote:
>> 
>>> On Feb 8, 2017, at 10:38 AM, Steve Christensen  wrote:
>>> 
>>> The time between when the request is made and when it completes with an 
>>> error might be a minute or so, so the framework is immediately bailing on 
>>> the request. I'm wondering what part of the process generates the error. 
>>> Does the server return a non-200 status code or what?
>> 
>> The server is probably returning a redirect (301, 302 or 303) to a bogus URL.
> 
> NSURLErrorUnsupportedURL in a background session is specifically a complaint 
> that the URL is neither http nor https. Perhaps the server redirected to 
> something else?
> 
> 
>> There’s a delegate method you can implement to see the redirected URL, which 
>> could help you troubleshoot this. But it sounds like it’s the server’s fault.
> 
> The bad URL is also recorded in the NSError's userInfo dictionary as 
> NSURLErrorFailingURLStringErrorKey.
> 
> -- 
> Greg Parker gpar...@apple.com Runtime Wrangler


___

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

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

Help/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 generates NSURLErrorUnsupportedURL?

2017-02-08 Thread Greg Parker

> On Feb 8, 2017, at 2:44 PM, Jens Alfke  wrote:
> 
>> On Feb 8, 2017, at 10:38 AM, Steve Christensen  wrote:
>> 
>> The time between when the request is made and when it completes with an 
>> error might be a minute or so, so the framework is immediately bailing on 
>> the request. I'm wondering what part of the process generates the error. 
>> Does the server return a non-200 status code or what?
> 
> The server is probably returning a redirect (301, 302 or 303) to a bogus URL.

NSURLErrorUnsupportedURL in a background session is specifically a complaint 
that the URL is neither http nor https. Perhaps the server redirected to 
something else?


> There’s a delegate method you can implement to see the redirected URL, which 
> could help you troubleshoot this. But it sounds like it’s the server’s fault.

The bad URL is also recorded in the NSError's userInfo dictionary as 
NSURLErrorFailingURLStringErrorKey.


-- 
Greg Parker gpar...@apple.com Runtime Wrangler



___

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

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

Help/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: Argh never-ending troubles with bindings

2017-02-08 Thread Rick Mann

> On Feb 8, 2017, at 18:26 , Ken Thomases  wrote:
> 
> On Feb 8, 2017, at 5:44 PM, Rick Mann  wrote:
>> 
>> 2017-02-08 15:39:41.178728 PromotionalChargeManager[51621:17330300] 
>> [General] Cannot perform operation without a managed object context
>> 2017-02-08 15:39:41.181165 PromotionalChargeManager[51621:17330300] 
>> [General] (
>>  0   CoreFoundation  0x7fffc9edd0db 
>> __exceptionPreprocess + 171
>>  1   libobjc.A.dylib 0x7fffdeb6ea2a 
>> objc_exception_throw + 48
>>  2   CoreFoundation  0x7fffc9f5a9c5 
>> +[NSException raise:format:] + 197
>>  3   AppKit  0x7fffc80281bc 
>> -[_NSManagedProxy _managedObjectContext] + 66
>>  4   AppKit  0x7fffc80281dc 
>> -[_NSManagedProxy _persistentStoreCoordinator] + 22
>>  5   AppKit  0x7fffc802824f 
>> -[_NSManagedProxy _entity] + 46
>> ...
> 
> Why not show the rest of the stack trace?

Trying to be concise. Here you go:

ViewController.swift:25Set represented object to: 
Optional()
2017-02-08 18:34:30.957825 PromotionalChargeManager[3440:83555] [General] 
Cannot perform operation without a managed object context
2017-02-08 18:34:30.964380 PromotionalChargeManager[3440:83555] [General] (
0   CoreFoundation  0x7fff8531a0db 
__exceptionPreprocess + 171
1   libobjc.A.dylib 0x7fff99faba2a 
objc_exception_throw + 48
2   CoreFoundation  0x7fff853979c5 
+[NSException raise:format:] + 197
3   AppKit  0x7fff834651bc 
-[_NSManagedProxy _managedObjectContext] + 66
4   AppKit  0x7fff834651dc 
-[_NSManagedProxy _persistentStoreCoordinator] + 22
5   AppKit  0x7fff8346524f 
-[_NSManagedProxy _entity] + 46
6   AppKit  0x7fff83465508 
-[_NSManagedProxy fetchRequestWithSortDescriptors:limit:] + 89
7   AppKit  0x7fff83464d09 
-[NSObjectController(NSManagedController) 
_executeFetch:didCommitSuccessfully:actionSender:] + 75
8   AppKit  0x7fff8317b6a9 
-[NSController _controllerEditor:didCommit:contextInfo:] + 185
9   CoreFoundation  0x7fff8528e6dc 
__invoking___ + 140
10  CoreFoundation  0x7fff8528e561 
-[NSInvocation invoke] + 289
11  CoreFoundation  0x7fff852a7736 
-[NSInvocation invokeWithTarget:] + 54
12  Foundation  0x7fff86d2e628 
__NSFireDelayedPerform + 417
13  CoreFoundation  0x7fff8529a294 
__CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 20
14  CoreFoundation  0x7fff85299f23 
__CFRunLoopDoTimer + 1075
15  CoreFoundation  0x7fff85299a7a 
__CFRunLoopDoTimers + 298
16  CoreFoundation  0x7fff852915d1 
__CFRunLoopRun + 2081
17  CoreFoundation  0x7fff85290b54 
CFRunLoopRunSpecific + 420
18  HIToolbox   0x7fff8481ba5c 
RunCurrentEventLoopInMode + 240
19  HIToolbox   0x7fff8481b799 
ReceiveNextEventCommon + 184
20  HIToolbox   0x7fff8481b6c6 
_BlockUntilNextEventMatchingListInModeWithFilter + 71
21  AppKit  0x7fff82dc15b4 
_DPSNextEvent + 1120
22  AppKit  0x7fff8353bd6b 
-[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] 
+ 2789
23  AppKit  0x7fff82db5f35 
-[NSApplication run] + 926
24  AppKit  0x7fff82d80850 
NSApplicationMain + 1237
25  PromotionalChargeManager0x00014e84 main + 84
26  libdyld.dylib   0x7fff9a88d255 start + 1
)



-- 
Rick Mann
rm...@latencyzero.com



___

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

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

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

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


Re: Argh never-ending troubles with bindings

2017-02-08 Thread Ken Thomases
On Feb 8, 2017, at 5:44 PM, Rick Mann  wrote:
> 
> 2017-02-08 15:39:41.178728 PromotionalChargeManager[51621:17330300] [General] 
> Cannot perform operation without a managed object context
> 2017-02-08 15:39:41.181165 PromotionalChargeManager[51621:17330300] [General] 
> (
>   0   CoreFoundation  0x7fffc9edd0db 
> __exceptionPreprocess + 171
>   1   libobjc.A.dylib 0x7fffdeb6ea2a 
> objc_exception_throw + 48
>   2   CoreFoundation  0x7fffc9f5a9c5 
> +[NSException raise:format:] + 197
>   3   AppKit  0x7fffc80281bc 
> -[_NSManagedProxy _managedObjectContext] + 66
>   4   AppKit  0x7fffc80281dc 
> -[_NSManagedProxy _persistentStoreCoordinator] + 22
>   5   AppKit  0x7fffc802824f 
> -[_NSManagedProxy _entity] + 46
> ...

Why not show the rest of the stack trace?

Regards,
Ken


___

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

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

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

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


Re: Argh never-ending troubles with bindings

2017-02-08 Thread Rick Mann

> On Feb 8, 2017, at 17:41 , Quincey Morris 
>  wrote:
> 
> On Feb 8, 2017, at 17:17 , Rick Mann  wrote:
>> 
>> it's the Managed Object Context that's bound to 
>> "self.representedObject.managedObjectContext".
> 
> “self.” is unnecessary. AFAIK it’s just voodoo arising from attempts to work 
> around some bug or confusion several years ago.
> 
> The other two keys you have control of. You can override the default property 
> getters to “watch” what happens when the binding is resolved/referenced. My 
> guess is that it’s not a bindings problem, exactly, but something 
> misplaced/misconfigured/overlooked, and you need to look in a different place 
> for what’s going on. But I’m just guessing.

I haven't figured out how to override the getter in Swift without also 
providing backing. There's no willGet{} in Swift.

In my other app, that works, I set the representedObject in a subclass of 
NSWindowController when NSWindowController's document is set. I could try this, 
but I feel like that shouldn't be necessary.




-- 
Rick Mann
rm...@latencyzero.com



___

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

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

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

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

Re: Argh never-ending troubles with bindings

2017-02-08 Thread Quincey Morris
On Feb 8, 2017, at 17:17 , Rick Mann  wrote:
> 
> it's the Managed Object Context that's bound to 
> "self.representedObject.managedObjectContext".

“self.” is unnecessary. AFAIK it’s just voodoo arising from attempts to work 
around some bug or confusion several years ago.

The other two keys you have control of. You can override the default property 
getters to “watch” what happens when the binding is resolved/referenced. My 
guess is that it’s not a bindings problem, exactly, but something 
misplaced/misconfigured/overlooked, and you need to look in a different place 
for what’s going on. But I’m just guessing.

___

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

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

Help/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: Argh never-ending troubles with bindings

2017-02-08 Thread Rick Mann

> On Feb 8, 2017, at 17:08 , Quincey Morris 
>  wrote:
> 
> On Feb 8, 2017, at 16:58 , Rick Mann  wrote:
>> 
>>> On Feb 8, 2017, at 16:50 , Quincey Morris 
>>>  wrote:
>>> 
>>> On Feb 8, 2017, at 15:44 , Rick Mann  wrote:
 
 I bind an Array Controller in the View Controller scene to 
 ViewController.self.representedObject.managedObjectContext.
>>> 
>>> Using what binding key?
>> 
>> self.representedObject.managedObjectContext
> 
> I meant, is this the array controller’s “content” binding, or its 
> “managedObjectContext” binding? This is a different thing from the 
> controller/key path that represents the object bound to.

Oh, I'm sorry. In the Array Controller, it's the managedObjectContext binding. 
In the table view, it's the content binding, so I misspoke. I removed all other 
bindings just trying to narrow the problem, so nothing is actually bound to the 
Array Controller.

> You later talked about the content binding, as if you had used that to bind 
> to the MOC. I was trying to verify if you in fact bound the 
> “managedObjectContent” binding to the MOC. 

Yeah, it's the Managed Object Context that's bound to 
"self.representedObject.managedObjectContext".


-- 
Rick Mann
rm...@latencyzero.com



___

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

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

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

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

Re: Argh never-ending troubles with bindings

2017-02-08 Thread Quincey Morris
On Feb 8, 2017, at 16:58 , Rick Mann  wrote:
> 
>> On Feb 8, 2017, at 16:50 , Quincey Morris 
>> > > wrote:
>> 
>> On Feb 8, 2017, at 15:44 , Rick Mann > > wrote:
>>> 
>>> I bind an Array Controller in the View Controller scene to 
>>> ViewController.self.representedObject.managedObjectContext.
>> 
>> Using what binding key?
> 
> self.representedObject.managedObjectContext

I meant, is this the array controller’s “content” binding, or its 
“managedObjectContext” binding? This is a different thing from the 
controller/key path that represents the object bound to.

You later talked about the content binding, as if you had used that to bind to 
the MOC. I was trying to verify if you in fact bound the “managedObjectContent” 
binding to the MOC. 
___

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

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

Help/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: Argh never-ending troubles with bindings

2017-02-08 Thread Rick Mann

> On Feb 8, 2017, at 16:50 , Quincey Morris 
>  wrote:
> 
> On Feb 8, 2017, at 15:44 , Rick Mann  wrote:
>> 
>> I bind an Array Controller in the View Controller scene to 
>> ViewController.self.representedObject.managedObjectContext.
> 
> Using what binding key?

self.representedObject.managedObjectContext

I wrote it as it was above to indicate that I bound to the View Controller's 
key "self.representedObject.managedObjectContext". I didn't mean to imply I 
wrote "ViewController" in the key path field.

> 
>> Note that I've also tried setting the Array Controller's content binding to 
>> gobbledegook
> 
> Instead of the above binding? That’s not the right key for the MOC.
> 
> However, what makes you think this is a bindings problem? It’s not obvious 
> that there’s anything wrong except that the MOC doesn’t exist [yet].
> 

The MOC does exist. I've verified that it exists at the time my Document's 
init() method is called.

-- 
Rick Mann
rm...@latencyzero.com



___

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

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

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

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

Re: Argh never-ending troubles with bindings

2017-02-08 Thread Quincey Morris
On Feb 8, 2017, at 15:44 , Rick Mann  wrote:
> 
> I bind an Array Controller in the View Controller scene to 
> ViewController.self.representedObject.managedObjectContext.

Using what binding key?

> Note that I've also tried setting the Array Controller's content binding to 
> gobbledegook

Instead of the above binding? That’s not the right key for the MOC.

However, what makes you think this is a bindings problem? It’s not obvious that 
there’s anything wrong except that the MOC doesn’t exist [yet].

___

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

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

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

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

Argh never-ending troubles with bindings

2017-02-08 Thread Rick Mann
I have the simplest of Document-based macOS apps created in Xcode 8.2.3. In the 
Document.makeWindowControllers method, I set my ViewController's 
representedObject to the document.

override func makeWindowControllers() {
let storyboard = NSStoryboard(name: "Main", bundle: nil)
let windowController = storyboard.instantiateController(withIdentifier: 
"Document Window Controller") as! NSWindowController

let vc = windowController.contentViewController as! ViewController
vc.representedObject = self

self.addWindowController(windowController)
}


In the Storyboard, I bind an Array Controller in the View Controller scene to 
ViewController.self.representedObject.managedObjectContext.

I don't have anything bound to the Array Controller (yet). But after launching 
and displaying the window, I get this (note the first message is me making sure 
my representedObject is getting set):

ViewController.swift:25Set represented object to: 
Optional()
2017-02-08 15:39:41.178728 PromotionalChargeManager[51621:17330300] [General] 
Cannot perform operation without a managed object context
2017-02-08 15:39:41.181165 PromotionalChargeManager[51621:17330300] [General] (
0   CoreFoundation  0x7fffc9edd0db 
__exceptionPreprocess + 171
1   libobjc.A.dylib 0x7fffdeb6ea2a 
objc_exception_throw + 48
2   CoreFoundation  0x7fffc9f5a9c5 
+[NSException raise:format:] + 197
3   AppKit  0x7fffc80281bc 
-[_NSManagedProxy _managedObjectContext] + 66
4   AppKit  0x7fffc80281dc 
-[_NSManagedProxy _persistentStoreCoordinator] + 22
5   AppKit  0x7fffc802824f 
-[_NSManagedProxy _entity] + 46
...

Now, as far as I can tell, I'm doing EXACTLY what Apple says I should do in

https://developer.apple.com/library/content/qa/qa1871/_index.html

Note that I've also tried setting the Array Controller's content binding to 
gobbledegook, hoping for a complaint about something not being KVO-compliant 
for that nonexistent property. No such luck.

What am I doing wrong?

Thanks!

-- 
Rick Mann
rm...@latencyzero.com



___

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

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

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

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


Re: What generates NSURLErrorUnsupportedURL?

2017-02-08 Thread Jens Alfke

> On Feb 8, 2017, at 10:38 AM, Steve Christensen  wrote:
> 
> The time between when the request is made and when it completes with an error 
> might be a minute or so, so the framework is immediately bailing on the 
> request. I'm wondering what part of the process generates the error. Does the 
> server return a non-200 status code or what?

The server is probably returning a redirect (301, 302 or 303) to a bogus URL.
There’s a delegate method you can implement to see the redirected URL, which 
could help you troubleshoot this. But it sounds like it’s the server’s fault.

—Jens
___

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

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

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

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

What generates NSURLErrorUnsupportedURL?

2017-02-08 Thread Steve Christensen
I am occasionally seeing a NSURLErrorUnsupportedURL (unsupported URL) error 
being returned by download tasks on a background NSURLSession, on iOS. Before 
you ask, the URL (https://…) is properly formed, [NSURL URLWithString:] returns 
a non-nil URL, and as an extra manual check I did an online validation of the 
URL on a couple of different websites to see if I missed something.

The time between when the request is made and when it completes with an error 
might be a minute or so, so the framework is immediately bailing on the 
request. I'm wondering what part of the process generates the error. Does the 
server return a non-200 status code or what? Searching for more detail in the 
docs, etc., hasn't yielded anything except comments from people saying to make 
sure that the scheme is specified.


___

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

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

Help/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: Use WKSessionFile as Data for AVAudioPlayer?

2017-02-08 Thread Eric Dolecki
Ignore that comment. If love to know how to use the actual file though. 

Get Outlook for iOS




On Wed, Feb 8, 2017 at 12:35 PM -0500, "Jens Alfke"  wrote:











On Feb 8, 2017, at 5:48 AM, Eric E. Dolecki  wrote:
                try self.player = AVAudioPlayer(contentsOf: file.fileURL!)
Why are you trying to load it into memory? You want to avoid that if possible 
with media data. Just initialize AVAudioPlayer with the URL itself and let it 
stream the data.
—Jens




___

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

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

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

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

Re: Use WKSessionFile as Data for AVAudioPlayer?

2017-02-08 Thread Jens Alfke

> On Feb 8, 2017, at 5:48 AM, Eric E. Dolecki  wrote:
> 
> try self.player = AVAudioPlayer(contentsOf: file.fileURL!)

Why are you trying to load it into memory? You want to avoid that if possible 
with media data. Just initialize AVAudioPlayer with the URL itself and let it 
stream the data.

—Jens
___

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

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

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

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

Re: Mobile Cross Platform Solutions

2017-02-08 Thread Jens Alfke

> On Feb 8, 2017, at 3:34 AM, Dave  wrote:
> 
> I’ve been asked to look at doing a Mobile App for a museum, basically the App 
> needs to show info (text, pictures and movies) for each exhibit. I’m 
> wondering the best way to make it work for iOS, Android and Windows Phone 
> (maybe). The content can be formatted as HTML and I’m wondering if it would 
> be better to develop 3 separate “shell” apps, one for each platform or or try 
> to use a “Cross Platform” solution. 

PhoneGap is what you want — it’s a cross-platform shell for HTML/JS based apps.

—Jens

___

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

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

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

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

Re: Use WKSessionFile as Data for AVAudioPlayer?

2017-02-08 Thread Eric E. Dolecki
UPDATE. Fixed. I bagged on sendFile and instead I am using sendMessage.
The problem with that is the iOS app needs to be open, but it plays the
message for me.

*Watch:*
let data = NSData(contentsOf: saveURL as! URL)
sendAudioFile(file: data!)

*iOS:*
func session(_ session: WCSession, didReceiveMessageData messageData: Data,
replyHandler: @escaping (Data) -> Void) {
DispatchQueue.main.async {
self.versionLabel.text = "We got an audio file: \(messageData)"
//Show bytes
self.versionLabel.textColor = UIColor.blue

// Try to play from memory buffer (NOT saving the audio)
do {
self.player = try AVAudioPlayer(data: messageData)
guard self.player != nil else { return }
self.player?.prepareToPlay()
self.player?.play()
} catch let error as NSError {
print(error.localizedDescription)
}
}
}

On Wed, Feb 8, 2017 at 8:48 AM Eric E. Dolecki  wrote:

> When I try the following I get a "OSStatus error 2003334207"
>
> func session(_ session: WCSession, didReceive file: WCSessionFile)
> {
> DispatchQueue.main.async
> {
> self.versionLabel.text = "We got a real audio file."
> self.versionLabel.textColor = UIColor.blue
> do {
> try self.player = AVAudioPlayer(contentsOf: file.fileURL!)
> print("It seems that we have a player. \(self.player)")
> self.player?.prepareToPlay()
> self.player?.play()
> } catch let error as NSError {
> *print(error.localizedDescription) // This is firing...*
> }
>
> file.fileURL! reports in the console as:
>
> Documents/Inbox/com.apple.watchconnectivity/711E4215-77E2-422A-80C5-6ECA8621778E/Files/AE2DCCA0-EAA0-4E4C-8E46-D1AC77101760/audioFile.wav
> --
> file:///var/mobile/Containers/Data/Application/5E72A755-D60B-4633-8283-02A0891CA8B8/
>
> file.fileURL!.path reports as:
>
>
> /var/mobile/Containers/Data/Application/26CFE356-7FB1-483B-B918-BC0A2026DE46/Documents/Inbox/com.apple.watchconnectivity/711E4215-77E2-422A-80C5-6ECA8621778E/Files/90D004CE-88F7-4C66-9B9A-5580445A0572/audioFile.wav
>
> So I tried
> try self.player = AVAudioPlayer(contentsOf: file.fileURL!.path)* //
> expecting URL and not a string so I tried:*
>
> let myURL = URL(fileURLWithPath: file.fileURL!.path)
> try self.player = AVAudioPlayer(contentsOf: myURL)
>
> And got: *The operation couldn’t be completed. (OSStatus error
> 2003334207.)*
>
> Seems kind of odd. I would think this might be easy, but for me so far
> it's not.
>
> Any help appreciated!!! I just want to play the .wav file that was sent to
> the phone.
>
>
>
> On Tue, Feb 7, 2017 at 11:25 PM Jens Alfke  wrote:
>
>
> On Feb 7, 2017, at 6:49 PM, Eric E. Dolecki  wrote:
>
> Now, I want to instantiate an AVAudioPlayer and play that sent file. I know
> that it's received (didFinish file transfer fires in the Watch Extension).
> How do I do that? I don't know how to make that file Data.
>
>
> Can’t you just create the AVAudioPlayer from the file's URL? I’m not super
> handy with Swift, but it should be something like
> `AVAudioPlayer(contentsOfURL: fileURL)`.
>
> —Jens
>
>
___

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

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

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

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

Re: Use WKSessionFile as Data for AVAudioPlayer?

2017-02-08 Thread Eric E. Dolecki
When I try the following I get a "OSStatus error 2003334207"

func session(_ session: WCSession, didReceive file: WCSessionFile)
{
DispatchQueue.main.async
{
self.versionLabel.text = "We got a real audio file."
self.versionLabel.textColor = UIColor.blue
do {
try self.player = AVAudioPlayer(contentsOf: file.fileURL!)
print("It seems that we have a player. \(self.player)")
self.player?.prepareToPlay()
self.player?.play()
} catch let error as NSError {
*print(error.localizedDescription) // This is firing...*
}

file.fileURL! reports in the console as:

Documents/Inbox/com.apple.watchconnectivity/711E4215-77E2-422A-80C5-6ECA8621778E/Files/AE2DCCA0-EAA0-4E4C-8E46-D1AC77101760/audioFile.wav
-- 
file:///var/mobile/Containers/Data/Application/5E72A755-D60B-4633-8283-02A0891CA8B8/

file.fileURL!.path reports as:

/var/mobile/Containers/Data/Application/26CFE356-7FB1-483B-B918-BC0A2026DE46/Documents/Inbox/com.apple.watchconnectivity/711E4215-77E2-422A-80C5-6ECA8621778E/Files/90D004CE-88F7-4C66-9B9A-5580445A0572/audioFile.wav

So I tried
try self.player = AVAudioPlayer(contentsOf: file.fileURL!.path)* //
expecting URL and not a string so I tried:*

let myURL = URL(fileURLWithPath: file.fileURL!.path)
try self.player = AVAudioPlayer(contentsOf: myURL)

And got: *The operation couldn’t be completed. (OSStatus error 2003334207.)*

Seems kind of odd. I would think this might be easy, but for me so far it's
not.

Any help appreciated!!! I just want to play the .wav file that was sent to
the phone.



On Tue, Feb 7, 2017 at 11:25 PM Jens Alfke  wrote:

>
> On Feb 7, 2017, at 6:49 PM, Eric E. Dolecki  wrote:
>
> Now, I want to instantiate an AVAudioPlayer and play that sent file. I know
> that it's received (didFinish file transfer fires in the Watch Extension).
> How do I do that? I don't know how to make that file Data.
>
>
> Can’t you just create the AVAudioPlayer from the file's URL? I’m not super
> handy with Swift, but it should be something like
> `AVAudioPlayer(contentsOfURL: fileURL)`.
>
> —Jens
>
___

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

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

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

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

Mobile Cross Platform Solutions

2017-02-08 Thread Dave
Hi,

I’ve been asked to look at doing a Mobile App for a museum, basically the App 
needs to show info (text, pictures and movies) for each exhibit. I’m wondering 
the best way to make it work for iOS, Android and Windows Phone (maybe). The 
content can be formatted as HTML and I’m wondering if it would be better to 
develop 3 separate “shell” apps, one for each platform or or try to use a 
“Cross Platform” solution. The shell would just display HTML pages, e.g. a 
WebView on iOS but I’m not sure how the other platforms would handle it,

Any ideas/suggestions greatly appreciated.

All the Best
Dave


___

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

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

Help/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: ICNS file behaviour on Retina Macs

2017-02-08 Thread Arjan van Leeuwen
Hi,

It will use the non-retina 32x32 for 16x16@2x, etc, so your icons will not
look pixelated if you omit the @2x icons.

If you're worried about the file size of your .icns file exploding, I've
created a small utility that can be used in combination with png utilities
like pngquant to reduce the file size of the images contained in your .icns
file: https://github.com/avl7771/createicns/.

Best regards,

Arjan van Leeuwen

On Tue, Feb 7, 2017 at 3:20 PM, Andreas Falkenhahn 
wrote:

> When using an *.icns file on Retina Macs without providing any explicit
> @2x imagery, will it simply fall back to the non-Retina 32x32 icon for the
> 16x16@2x size, non-Retina 64x64 for the 32x32@2x size, ..., non-Retina
> 512x512 icon for 256x256@2x size or will it upscale the 16x16 icon for
> 16x16@2x instead of using the 32x32 icon and so on?
>
> --
> Best regards,
>  Andreas Falkenhahn  mailto:andr...@falkenhahn.com
>
> ___
>
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/cocoa-dev/arjanl%40opera.com
>
> This email sent to arj...@opera.com
>
___

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

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

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

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