Re: iOS 8.4: Converting a URL into a PHAsset

2015-07-29 Thread Carl Hoefs


 On Jul 28, 2015, at 11:59 PM, Ben Kennedy b...@zygoat.ca wrote:
 
 On 28 Jul 2015, at 7:17 pm, Carl Hoefs newsli...@autonomy.caltech.edu wrote:
 
 I'm trying to get an NSURL into PHAsset form, but I keep coming up with 
 null. PHAsset fetchAssetsWithALAssetURLs: takes an NSArray of NSURLs: An 
 array of NSURL objects, each an asset URL previously retrieved from an 
 ALAsset object. Apparently, this is not a simple array of NSURL objects. 
 
 Well, more specifically, it sounds like an array of “asset URLs previously 
 retrieved from an ALAsset object.”
 
 2015-07-28 19:04:36.221 hsvst[577:76956] assetURLs (
   
 file:///var/mobile/Containers/Data/Application/9C51BEE6-80A7-15A4-72DA-19E447A75E25/Documents/hsvst_0005.mov
 )
 
 Indeed, that looks like a file:// URL representing a path to regular disk 
 file on the filesystem, not an asset URL from an ALAsset object.
 
 Have you looked at +[PHAssetChangeRequest 
 creationRequestForAssetFromVideoAtFileURL:] ?  For example:
 
 PHAssetChangeRequest *assetRequest = [PHAssetChangeRequest 
 creationRequestForAssetFromVideoAtFileURL: self.sourcePlayListItem.url];
 PHObjectPlaceholder *assetPlaceholder = 
 assetRequest.placeholderForCreatedAsset;
 /* treat assetPlaceholder as a PHAsset and do something with it */ ;
 
 What are you ultimately trying to do?
 
Ultimately, I'm simply trying to delete the asset:
  [PHAssetChangeRequest deleteAssets:@[asset]];

You're right, of course, that I've overlooked the fine print: it wants an array 
of “asset URLs previously retrieved from an ALAsset object.” I'm not quite 
certain what that means, exactly.

I'm able to delete the asset by using:
  [[NSFileManager defaultManager] removeItemAtURL: self.sourcePlayListItem.url 
error:error];
but I think the new 'photo asset' way is preferred in iOS8+, so I thought I'd 
try to be compliant.
-Carl



___

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

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

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

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

How to zoom with auto layout?

2015-07-29 Thread Gerriet M. Denkmann
10.10.4

I want to zoom (width only) my NSView and want the mid-point of the view to be 
still in the mid after zooming.
The following code works - but only if zooming slowly.
How can one avoid the performSelector:afterDelay ?

Is there some notification like NSLayoutHasBeenDoneNotification ?
I tried NSViewFrameDidChangeNotification, but this is called much too often.

-(void)setZoomValue: (double)new
{
_zoomValue = new;
self.requiredWidth = …
double position = …
[ self invalidateIntrinsicContentSize ];
[ self performSelector: @selector(scrollPosition:) withObject: 
@(position) afterDelay: 0.1 ];   //  0.0 no good
}

- (NSSize)intrinsicContentSize
{
return NSMakeSize( self.requiredWidth, NSViewNoInstrinsicMetric );
}

- (void) scrollPosition: (NSNumber *)n
{
[ self scrollPoint: NSMakePoint(n.doubleValue,0) ];
}

Gerriet.


___

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

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

Help/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 8.4: Converting a URL into a PHAsset

2015-07-29 Thread Carl Hoefs

 On Jul 28, 2015, at 11:59 PM, Ben Kennedy b...@zygoat.ca wrote:
 
 PHAssetChangeRequest *assetRequest = [PHAssetChangeRequest 
 creationRequestForAssetFromVideoAtFileURL: self.sourcePlayListItem.url];
 PHObjectPlaceholder *assetPlaceholder = 
 assetRequest.placeholderForCreatedAsset;
 /* treat assetPlaceholder as a PHAsset and do something with it */ ;
 

This results in:

'Invalid object PHObjectPlaceholder: 0x155b93d0 
0506A376-11F4-438D-A847-CEE5E5E4B077/L0/001 passed to deleteAssets:, objects 
must be of type PHAsset'

So the basic problem remains to obtain a PHAsset from an NSURL.
-Carl


___

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

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

Help/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 have KVC-compliant enum property in Swift 2?

2015-07-29 Thread Rick Mann

 On Jul 28, 2015, at 19:38 , Quincey Morris 
 quinceymor...@rivergatesoftware.com wrote:
 
 I suspect that downloadState will never need to be set via KVC**, or from 
 Obj-C code, in which case there’s a slightly simpler solution than Charles’ 
 suggestion. You can have 2 properties, one of which is an enum, and other is 
 an immutable Int that’s observable, whose value is maintained via a simple 
 didSet accessor on the enum property.

Thanks, Quincey, that's pretty much what I want. My view observes these 
properties to know when to update.

Thanks to Charles, too.

-- 
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: iOS 8.4: Converting a URL into a PHAsset

2015-07-29 Thread Ben Kennedy
On 29 Jul 2015, at 8:47 am, Carl Hoefs newsli...@autonomy.caltech.edu wrote:

 Ultimately, I'm simply trying to delete the asset:
  [PHAssetChangeRequest deleteAssets:@[asset]];

But you don't yet HAVE an asset; you seem to only have a regular file on disk, 
in an application's Documents directory.  Do you want to do more than simply 
delete the file?  If not, what compels you to turn it into a PHAsset first?

 You're right, of course, that I've overlooked the fine print: it wants an 
 array of “asset URLs previously retrieved from an ALAsset object.” I'm not 
 quite certain what that means, exactly.

No doubt something you would retrieve by -[asset valueForProperty: 
ALAssetPropertyURLs] (if you had an ALAsset * called asset.)  But I imagine 
that's a red herring here.

 I'm able to delete the asset by using:
  [[NSFileManager defaultManager] removeItemAtURL: self.sourcePlayListItem.url 
 error:error];
 but I think the new 'photo asset' way is preferred in iOS8+, so I thought I'd 
 try to be compliant.

What inspires that statement?

If you have a PHAsset representing something in a PHAssetLibrary, then sure, 
you would use such an approach to delete the asset.  But what you've shown us 
so far seems to imply that you just have a plain old .MOV file, perhaps created 
by the user, sitting in the app's sandbox.

In your original example, where does self.sourcePlayListItem.url come from?  
What does the URL represent?

b


___

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

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

Help/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 8.4: Converting a URL into a PHAsset

2015-07-29 Thread Carl Hoefs

 On Jul 29, 2015, at 10:26 AM, Ben Kennedy b...@zygoat.ca wrote:
 
 On 29 Jul 2015, at 8:47 am, Carl Hoefs newsli...@autonomy.caltech.edu wrote:
 
 Ultimately, I'm simply trying to delete the asset:
 [PHAssetChangeRequest deleteAssets:@[asset]];
 
 But you don't yet HAVE an asset; you seem to only have a regular file on 
 disk, in an application's Documents directory.  Do you want to do more than 
 simply delete the file?  If not, what compels you to turn it into a PHAsset 
 first?
 
 You're right, of course, that I've overlooked the fine print: it wants an 
 array of “asset URLs previously retrieved from an ALAsset object.” I'm not 
 quite certain what that means, exactly.
 
 No doubt something you would retrieve by -[asset valueForProperty: 
 ALAssetPropertyURLs] (if you had an ALAsset * called asset.)  But I imagine 
 that's a red herring here.
 
 I'm able to delete the asset by using:
 [[NSFileManager defaultManager] removeItemAtURL: self.sourcePlayListItem.url 
 error:error];
 but I think the new 'photo asset' way is preferred in iOS8+, so I thought 
 I'd try to be compliant.
 
 What inspires that statement?
 
 If you have a PHAsset representing something in a PHAssetLibrary, then sure, 
 you would use such an approach to delete the asset.  But what you've shown us 
 so far seems to imply that you just have a plain old .MOV file, perhaps 
 created by the user, sitting in the app's sandbox.
 
 In your original example, where does self.sourcePlayListItem.url come from?  
 What does the URL represent?

Yes, you're quite right. Until the file gets moved from the app's sandbox to 
the photo library, it's just a file, and -removeItemAtURL: is the way to delete 
it. 

Thanks for setting me straight on this. I need much stronger coffee.
-Carl




___

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

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

Help/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 8: Can any of you guys think of why an async creation of a UIAlert would generate an exception on a show?

2015-07-29 Thread Alex Zavatone
Who's awesome?

Carl's awesome.

We had some other intermittent crashes around that area, related to a use the 
first answer on SO approach, so I didn't think this would be that simple to 
isolate.

Oddly this is the only place where a UIAlertView crashes and our app is riddled 
with them since we have to support iOS 7 and 8.

The joy now is going through our app and making sure that we have a nice 
wrapper class to handle these UIAlertView/UIAlertController cases.

Thanks, man!

On Jul 29, 2015, at 3:01 PM, Carl Hoefs wrote:

 Could this issue be due to whatever reason Apple deprecated UIAlertView in 
 iOS 8?
 
 Important: UIAlertView is deprecated in iOS 8. (Note that 
 UIAlertViewDelegate is also deprecated.) To create and manage alerts in iOS 8 
 and later, instead use UIAlertController with a preferredStyle of 
 UIAlertControllerStyleAlert.
 
 -Carl
 
 On Jul 29, 2015, at 11:40 AM, Alex Zavatone z...@mac.com wrote:
 
 Huh.  Within the @try block, we can see that the 
 navigationControllerSupportedInterfaceOrientations: is being sent to the 
 UIAlertController.  
 
 2015-07-29 14:15:56.967[719:244869] -[SignInViewController 
 displayErrorMessage:] [Line 289] - ***
 2015-07-29 14:15:56.985 [719:244869] -[UIAlertController 
 navigationControllerSupportedInterfaceOrientations:]: unrecognized selector 
 sent to instance 0x156e29f0
 
 0x156e29f0 is _alertController inside the instance of alert.  
 
 Yes, the view controller class this is happening in is conforming to 
 UINavigationControllerDelegate and I have set the 
 self.navigationController.delegate to self.   
 
 What I can't wrap my head around is why or how it is possible for something 
 like this to happen.
 
 
 
 On Jul 29, 2015, at 2:08 PM, Alex Zavatone wrote:
 
 I've got a completion block in an NSURLSessionDataTask that checks if the 
 NSURLResponse statusCode is not 200 and in that case, it places a cell to a 
 method to display a generic error message like so:
 
  // If no error occurs, check the HTTP status code.
  NSInteger HTTPStatusCode = [(NSHTTPURLResponse *)response statusCode];
 
  // If it's other than 200, then show it on the console.
  if (HTTPStatusCode != 200) {
  DLog(@HTTP status code = %ld, (long)HTTPStatusCode);
  NSString *errorMessage = [NSHTTPURLResponse 
 localizedStringForStatusCode:HTTPStatusCode];
  DLog(@HTTP error message is: %@, errorMessage);
 
  // display error message; 
  [self displayErrorMessage:errorMessage];
  return;
  }
 
 
 And in displayErrorMessage is will asks GDC to dispatch an async call to 
 display the message on the main thread.
 
 // Error messages
 - (void)displayErrorMessage:(NSString *)errorMessage {
  DLog(@- ***);
  // handle on the main thread
  dispatch_async(dispatch_get_main_queue(), ^{
  NSString *internalErrorMessage = @An error occurred.  Please try 
 again.;
 
  UIAlertView *alert = [[UIAlertView alloc]
initWithTitle: nil
message: internalErrorMessage
delegate: nil
cancelButtonTitle: @OK
otherButtonTitles: nil, nil];
 
  if (alert) {
  [alert show];
  } else {
  DLog(@For some reason, the alert instance isn't ready for a 
 show.);
  }
  });
 }
 
 What's happening intermittently when I'm causing the server call to time 
 out is that I'll get a bad access on the [alert show].  
 
 I've spent all morning trying to narrow this down, to find out where the 
 bad access is and why this is occurring.  Sometimes in the stack trace, 
 I'll see 3 or 4 calls to display the alert in different threads.  
 Sometimes, I see that the [alert show] exception is being caused by 
 navigationControllersupportedInderfaceOrientations: being sent to alert and 
 the instruction pointer is on the [alert show line].
 
 I've included a screenshot of thread 1 to see if any of this makes any 
 sense to anyone else.
 
 Thanks in advance if you're able to spend some time to help me out on this 
 one.
 
 Adding an @try block around the [alert show] and retesting now.
 
 Stack trace screenshot below:
 http://i.imgur.com/KfILPLE.png
 
 - Alex Zavaotne
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 https://lists.apple.com/mailman/options/cocoa-dev/zav%40mac.com
 
 This email sent to z...@mac.com
 
 
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 

iOS 8: Can any of you guys think of why an async creation of a UIAlert would generate an exception on a show?

2015-07-29 Thread Alex Zavatone
I've got a completion block in an NSURLSessionDataTask that checks if the 
NSURLResponse statusCode is not 200 and in that case, it places a cell to a 
method to display a generic error message like so:

// If no error occurs, check the HTTP status code.
NSInteger HTTPStatusCode = [(NSHTTPURLResponse *)response statusCode];

// If it's other than 200, then show it on the console.
if (HTTPStatusCode != 200) {
DLog(@HTTP status code = %ld, (long)HTTPStatusCode);
NSString *errorMessage = [NSHTTPURLResponse 
localizedStringForStatusCode:HTTPStatusCode];
DLog(@HTTP error message is: %@, errorMessage);

// display error message; 
[self displayErrorMessage:errorMessage];
return;
}


And in displayErrorMessage is will asks GDC to dispatch an async call to 
display the message on the main thread.

// Error messages
- (void)displayErrorMessage:(NSString *)errorMessage {
DLog(@- ***);
// handle on the main thread
dispatch_async(dispatch_get_main_queue(), ^{
NSString *internalErrorMessage = @An error occurred.  Please try 
again.;

UIAlertView *alert = [[UIAlertView alloc]
  initWithTitle: nil
  message: internalErrorMessage
  delegate: nil
  cancelButtonTitle: @OK
  otherButtonTitles: nil, nil];

if (alert) {
[alert show];
} else {
DLog(@For some reason, the alert instance isn't ready for a 
show.);
}
});
}

What's happening intermittently when I'm causing the server call to time out is 
that I'll get a bad access on the [alert show].  

I've spent all morning trying to narrow this down, to find out where the bad 
access is and why this is occurring.  Sometimes in the stack trace, I'll see 3 
or 4 calls to display the alert in different threads.  Sometimes, I see that 
the [alert show] exception is being caused by 
navigationControllersupportedInderfaceOrientations: being sent to alert and the 
instruction pointer is on the [alert show line].

I've included a screenshot of thread 1 to see if any of this makes any sense to 
anyone else.

Thanks in advance if you're able to spend some time to help me out on this one.

Adding an @try block around the [alert show] and retesting now.

Stack trace screenshot below:
http://i.imgur.com/KfILPLE.png

- Alex Zavaotne
___

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

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

Help/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 8: Can any of you guys think of why an async creation of a UIAlert would generate an exception on a show?

2015-07-29 Thread Alex Zavatone
Well, it's worth a shot.  

What I'm seeing indicates some calls to internals that certainly looks like 
UIAlertController related classes.  I was hoping we could continue to get away 
with UIAlertView because we still have to support iOS 7.

I'll switch this method over and see how it fares.  Thanks Carl. 


On Jul 29, 2015, at 3:01 PM, Carl Hoefs wrote:

 Could this issue be due to whatever reason Apple deprecated UIAlertView in 
 iOS 8?
 
 Important: UIAlertView is deprecated in iOS 8. (Note that 
 UIAlertViewDelegate is also deprecated.) To create and manage alerts in iOS 8 
 and later, instead use UIAlertController with a preferredStyle of 
 UIAlertControllerStyleAlert.
 
 -Carl
 
 On Jul 29, 2015, at 11:40 AM, Alex Zavatone z...@mac.com wrote:
 
 Huh.  Within the @try block, we can see that the 
 navigationControllerSupportedInterfaceOrientations: is being sent to the 
 UIAlertController.  
 
 2015-07-29 14:15:56.967[719:244869] -[SignInViewController 
 displayErrorMessage:] [Line 289] - ***
 2015-07-29 14:15:56.985 [719:244869] -[UIAlertController 
 navigationControllerSupportedInterfaceOrientations:]: unrecognized selector 
 sent to instance 0x156e29f0
 
 0x156e29f0 is _alertController inside the instance of alert.  
 
 Yes, the view controller class this is happening in is conforming to 
 UINavigationControllerDelegate and I have set the 
 self.navigationController.delegate to self.   
 
 What I can't wrap my head around is why or how it is possible for something 
 like this to happen.
 
 
 
 On Jul 29, 2015, at 2:08 PM, Alex Zavatone wrote:
 
 I've got a completion block in an NSURLSessionDataTask that checks if the 
 NSURLResponse statusCode is not 200 and in that case, it places a cell to a 
 method to display a generic error message like so:
 
  // If no error occurs, check the HTTP status code.
  NSInteger HTTPStatusCode = [(NSHTTPURLResponse *)response statusCode];
 
  // If it's other than 200, then show it on the console.
  if (HTTPStatusCode != 200) {
  DLog(@HTTP status code = %ld, (long)HTTPStatusCode);
  NSString *errorMessage = [NSHTTPURLResponse 
 localizedStringForStatusCode:HTTPStatusCode];
  DLog(@HTTP error message is: %@, errorMessage);
 
  // display error message; 
  [self displayErrorMessage:errorMessage];
  return;
  }
 
 
 And in displayErrorMessage is will asks GDC to dispatch an async call to 
 display the message on the main thread.
 
 // Error messages
 - (void)displayErrorMessage:(NSString *)errorMessage {
  DLog(@- ***);
  // handle on the main thread
  dispatch_async(dispatch_get_main_queue(), ^{
  NSString *internalErrorMessage = @An error occurred.  Please try 
 again.;
 
  UIAlertView *alert = [[UIAlertView alloc]
initWithTitle: nil
message: internalErrorMessage
delegate: nil
cancelButtonTitle: @OK
otherButtonTitles: nil, nil];
 
  if (alert) {
  [alert show];
  } else {
  DLog(@For some reason, the alert instance isn't ready for a 
 show.);
  }
  });
 }
 
 What's happening intermittently when I'm causing the server call to time 
 out is that I'll get a bad access on the [alert show].  
 
 I've spent all morning trying to narrow this down, to find out where the 
 bad access is and why this is occurring.  Sometimes in the stack trace, 
 I'll see 3 or 4 calls to display the alert in different threads.  
 Sometimes, I see that the [alert show] exception is being caused by 
 navigationControllersupportedInderfaceOrientations: being sent to alert and 
 the instruction pointer is on the [alert show line].
 
 I've included a screenshot of thread 1 to see if any of this makes any 
 sense to anyone else.
 
 Thanks in advance if you're able to spend some time to help me out on this 
 one.
 
 Adding an @try block around the [alert show] and retesting now.
 
 Stack trace screenshot below:
 http://i.imgur.com/KfILPLE.png
 
 - Alex Zavaotne
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 https://lists.apple.com/mailman/options/cocoa-dev/zav%40mac.com
 
 This email sent to z...@mac.com
 
 
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 https://lists.apple.com/mailman/options/cocoa-dev/newslists%40autonomy.caltech.edu
 
 This email sent to newsli...@autonomy.caltech.edu
 


___

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


Re: iOS 8: Can any of you guys think of why an async creation of a UIAlert would generate an exception on a show?

2015-07-29 Thread Alex Zavatone
Huh.  Within the @try block, we can see that the 
navigationControllerSupportedInterfaceOrientations: is being sent to the 
UIAlertController.  

2015-07-29 14:15:56.967[719:244869] -[SignInViewController 
displayErrorMessage:] [Line 289] - ***
2015-07-29 14:15:56.985 [719:244869] -[UIAlertController 
navigationControllerSupportedInterfaceOrientations:]: unrecognized selector 
sent to instance 0x156e29f0

0x156e29f0 is _alertController inside the instance of alert.  

Yes, the view controller class this is happening in is conforming to 
UINavigationControllerDelegate and I have set the 
self.navigationController.delegate to self.   

What I can't wrap my head around is why or how it is possible for something 
like this to happen.



On Jul 29, 2015, at 2:08 PM, Alex Zavatone wrote:

 I've got a completion block in an NSURLSessionDataTask that checks if the 
 NSURLResponse statusCode is not 200 and in that case, it places a cell to a 
 method to display a generic error message like so:
 
// If no error occurs, check the HTTP status code.
NSInteger HTTPStatusCode = [(NSHTTPURLResponse *)response statusCode];
 
// If it's other than 200, then show it on the console.
if (HTTPStatusCode != 200) {
DLog(@HTTP status code = %ld, (long)HTTPStatusCode);
NSString *errorMessage = [NSHTTPURLResponse 
 localizedStringForStatusCode:HTTPStatusCode];
DLog(@HTTP error message is: %@, errorMessage);
 
// display error message; 
[self displayErrorMessage:errorMessage];
return;
}
 
 
 And in displayErrorMessage is will asks GDC to dispatch an async call to 
 display the message on the main thread.
 
 // Error messages
 - (void)displayErrorMessage:(NSString *)errorMessage {
DLog(@- ***);
// handle on the main thread
dispatch_async(dispatch_get_main_queue(), ^{
NSString *internalErrorMessage = @An error occurred.  Please try 
 again.;
 
UIAlertView *alert = [[UIAlertView alloc]
  initWithTitle: nil
  message: internalErrorMessage
  delegate: nil
  cancelButtonTitle: @OK
  otherButtonTitles: nil, nil];
 
if (alert) {
[alert show];
} else {
DLog(@For some reason, the alert instance isn't ready for a 
 show.);
}
});
 }
 
 What's happening intermittently when I'm causing the server call to time out 
 is that I'll get a bad access on the [alert show].  
 
 I've spent all morning trying to narrow this down, to find out where the bad 
 access is and why this is occurring.  Sometimes in the stack trace, I'll see 
 3 or 4 calls to display the alert in different threads.  Sometimes, I see 
 that the [alert show] exception is being caused by 
 navigationControllersupportedInderfaceOrientations: being sent to alert and 
 the instruction pointer is on the [alert show line].
 
 I've included a screenshot of thread 1 to see if any of this makes any sense 
 to anyone else.
 
 Thanks in advance if you're able to spend some time to help me out on this 
 one.
 
 Adding an @try block around the [alert show] and retesting now.
 
 Stack trace screenshot below:
 http://i.imgur.com/KfILPLE.png
 
 - Alex Zavaotne
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 https://lists.apple.com/mailman/options/cocoa-dev/zav%40mac.com
 
 This email sent to z...@mac.com


___

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

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

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

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

Regarding these Olivia messages. Can we do something about the list security?

2015-07-29 Thread Alex Zavatone
I guess this is more of a list admin request, but it's rather shocking to get 
these emails from Olivia coming from replying to an Apple listserve thread.

Is there anything we can do about the harvesting of our PII (Personally 
Identifiable Information) from the list so that we don't have the joy of 
dealing with getting emails with nude photos of random girls who want our 
credit card numbers in the middle of our work day?

I'd prefer to save those tender moments for when I'm not in the office.  

But honestly, the listserv is open and query-able and it looks like the 
spammers have found that out.

Any ideas?

Thanks,
Alex Zavatone
___

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

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

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

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

Re: Regarding these Olivia messages. Can we do something about the list security?

2015-07-29 Thread Eric E. Dolecki
Gotta agree. I was shocked when that came in.

On Wed, Jul 29, 2015 at 3:18 PM Alex Zavatone z...@mac.com wrote:

 I guess this is more of a list admin request, but it's rather shocking to
 get these emails from Olivia coming from replying to an Apple listserve
 thread.

 Is there anything we can do about the harvesting of our PII (Personally
 Identifiable Information) from the list so that we don't have the joy of
 dealing with getting emails with nude photos of random girls who want our
 credit card numbers in the middle of our work day?

 I'd prefer to save those tender moments for when I'm not in the office.

 But honestly, the listserv is open and query-able and it looks like the
 spammers have found that out.

 Any ideas?

 Thanks,
 Alex Zavatone
 ___

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

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

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

 This email sent to edole...@gmail.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: Regarding these Olivia messages. Can we do something about the list security?

2015-07-29 Thread Charles Srstka
 On Jul 29, 2015, at 2:16 PM, Alex Zavatone z...@mac.com wrote:
 
 But honestly, the listserv is open and query-able and it looks like the 
 spammers have found that out.

I actually suspect it’s that a spammer has become registered for the list and 
is receiving the e-mails (and then sending an auto-reply), given that I’ve been 
getting one Olivia e-mail per message I send to the list, and not long after I 
send it.

Charles

___

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

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

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

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

Re: Regarding these Olivia messages. Can we do something about the list security?

2015-07-29 Thread Graham Cox

 On 30 Jul 2015, at 9:24 am, Charles Srstka cocoa...@charlessoft.com wrote:
 
 On Jul 29, 2015, at 2:16 PM, Alex Zavatone z...@mac.com wrote:
 
 But honestly, the listserv is open and query-able and it looks like the 
 spammers have found that out.
 
 I actually suspect it’s that a spammer has become registered for the list and 
 is receiving the e-mails (and then sending an auto-reply), given that I’ve 
 been getting one Olivia e-mail per message I send to the list, and not long 
 after I send it.


Same here. I reported the problem to the list moderator listed at the bottom of 
every message, but that in itself triggered a bounce. I’m not sure if there is 
actually any way to contact the moderators unless they happen to take a look at 
the list themselves (i.e they apparently only poll, they do not register for 
notifications).

—Graham



___

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

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

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

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

Re: Regarding these Olivia messages. Can we do something about the list security?

2015-07-29 Thread Charles Srstka
 On Jul 29, 2015, at 6:52 PM, Jens Alfke j...@mooseyard.com wrote:
 
 I don’t think there’s any way to figure out which subscriber it is. The 
 spammer would almost certainly have subscribed under an anonymous Gmail or 
 Yahoo address, not something easily detectable like 
 “scum_fee...@spamsalot.biz”.
 
 —Jens

Would it help track this person down if we posted some of the Received: headers 
from the e-mails we’ve been getting?

Charles


___

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

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

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

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

Seeking advice for a stream merge type application

2015-07-29 Thread jspayne2

___

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

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

Help/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: Regarding these Olivia messages. Can we do something about the list security?

2015-07-29 Thread Jens Alfke

 On Jul 29, 2015, at 4:32 PM, Roland King r...@rols.org wrote:
 
 That's what I think to and the filth spread to the xcode list, or spread from 
 the xcode list. I wrote to the admins on both lists and asked them to remove 
 this scum feeder from all apple lists.

I don’t think there’s any way to figure out which subscriber it is. The spammer 
would almost certainly have subscribed under an anonymous Gmail or Yahoo 
address, not something easily detectable like “scum_fee...@spamsalot.biz 
mailto:scum_fee...@spamsalot.biz”.

—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: Techniques for limiting concurrent downloads via NSURLSession

2015-07-29 Thread Jens Alfke

 On Jul 29, 2015, at 4:46 PM, Rick Mann rm...@latencyzero.com wrote:
 
 In my application I have to download hundreds to maybe a thousand files for 
 each thing that gets downloaded. I tried just kicking off a bunch of 
 download tasks in a loop, but eventually I either get Too many open files 
 errors, or I crash (this is on an iPad).

I’m not experienced with NSURLSession, but NSURLConnection limits the number of 
open sockets (to about 4 on iOS, maybe 8 on Mac OS). If you issue more 
simultaneous requests than that, they queue up waiting for an available socket.

I would think that NSURLSession has the same behavior. Are you perhaps creating 
a separate NSURLSession for each download? I suspect that the sockets are 
managed by each instance of NSURLSession, not globally as with NSURLConnection, 
so if you create a ton of NSURLSessions you’re consuming unlimited sockets. If 
so, the solution would be to create only one NSURLSession and issue all your 
requests through it.

—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: Regarding these Olivia messages. Can we do something about the list security?

2015-07-29 Thread Roland King

 On 30 Jul 2015, at 6:24 am, Charles Srstka cocoa...@charlessoft.com wrote:
 
 On Jul 29, 2015, at 2:16 PM, Alex Zavatone z...@mac.com wrote:
 
 But honestly, the listserv is open and query-able and it looks like the 
 spammers have found that out.
 
 I actually suspect it’s that a spammer has become registered for the list and 
 is receiving the e-mails (and then sending an auto-reply), given that I’ve 
 been getting one Olivia e-mail per message I send to the list, and not long 
 after I send it.
 
 Charles
 

That's what I think to and the filth spread to the xcode list, or spread from 
the xcode list. I wrote to the admins on both lists and asked them to remove 
this scum feeder from all apple lists. Haven't heard back yet, guess it's long 
since not been Scott moderating as this cr*p would have lasted 2 minutes. 


___

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

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

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

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

Gatekeeper bug? [was Re: Codesigning issues]

2015-07-29 Thread Graham Cox
I appear to have solved this problem, but it’s disturbing me because it seems 
little more than voodoo.

I changed the embedded frameworks to use @loader_path instead of 
@executable_path, and the problem has gone.

I verified all of the binaries with otool and the internal dylib loading links 
were all correct, including @executable_path. These binaries launch and run 
correctly on my own systems, and for most users. Some users had the exception 
below thrown from XprotectFramework which is part of Gatekeeper. Disabling 
Gatekeeper allowed these users to launch and run the app normally. Changing the 
internal framework links to @loader_path apparently avoids the 
XprotectFramework exception.

As far as I’m aware @executable_path is not deprecated, and though the problem 
seemed more prevalent on 10.10, we also had a report from a 10.9 user.

The evidence seems to be that XprotectFramework has a bug that sometimes causes 
it not to recognise the internal linkage path when it’s set to @executable_path 
(it would not surprise me that the bug was the code contained a typo, since 
whoever wrote that code does not know how to spell ‘executable’). However the 
actuall dylib loader doesn’t have a problem with any of it, it’s just the 
preflight check performed by Gatekeeper that fails.

Does this seem reasonable to anyone else who may be a lot more familiar with 
the dylib loading mechanism than I am?

—Graham







 On 29 Jul 2015, at 10:09 am, Graham Cox graham@bigpond.com wrote:
 
 ’m not 100% sure if it’s related, but one user sent this to me which appeared 
 to coincide with the launch failure:
 
 
 7/28/15 4:41:01.467 PM CoreServicesUIAgent[8607]: Error -60005 creating 
 authorization
 7/28/15 4:41:11.624 PM CoreServicesUIAgent[8607]: An uncaught exception was 
 raised
 7/28/15 4:41:11.624 PM CoreServicesUIAgent[8607]: *** -[NSFileManager 
 fileSystemRepresentationWithPath:]: nil or empty path argument
 7/28/15 4:41:11.624 PM CoreServicesUIAgent[8607]: (
   0   CoreFoundation  0x7fff928e303c 
 __exceptionPreprocess + 172
   1   libobjc.A.dylib 0x7fff966e576e 
 objc_exception_throw + 43
   2   CoreFoundation  0x7fff928e2eed 
 +[NSException raise:format:] + 205
   3   Foundation  0x7fff901cf29b 
 -[NSFileManager fileSystemRepresentationWithPath:] + 122
   4   XprotectFramework   0x7fff8d673fbf 
 -[XProtectDylibCheck parseExececutableAndLoaderPaths:] + 329
   5   XprotectFramework   0x7fff8d673cec 
 -[XProtectDylibCheck parseLoadCommands] + 898
   6   XprotectFramework   0x7fff8d67440d 
 -[XProtectDylibCheck parseMacho] + 1050
   7   XprotectFramework   0x7fff8d67763d 
 +[WorkerThreadClass performDylibBundleCheck:] + 602
   8   XprotectFramework   0x7fff8d678b53 
 +[WorkerThreadClass threadEntry:] + 4910
   9   Foundation  0x7fff90202dc2 
 __NSThread__main__ + 1345
   10  libsystem_pthread.dylib 0x7fff8e6a9268 
 _pthread_body + 131
   11  libsystem_pthread.dylib 0x7fff8e6a91e5 
 _pthread_body + 0
   12  libsystem_pthread.dylib 0x7fff8e6a741d thread_start 
 + 13
 )
 7/28/15 4:41:11.624 PM CoreServicesUIAgent[8607]: *** Terminating app due to 
 uncaught exception 'NSInvalidArgumentException', reason: '*** -[NSFileManager 
 fileSystemRepresentationWithPath:]: nil or empty path argument'
 


___

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

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

Help/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: Techniques for limiting concurrent downloads via NSURLSession

2015-07-29 Thread Rick Mann

 On Jul 29, 2015, at 16:55 , Jens Alfke j...@mooseyard.com wrote:
 
 
 On Jul 29, 2015, at 4:46 PM, Rick Mann rm...@latencyzero.com wrote:
 
 In my application I have to download hundreds to maybe a thousand files for 
 each thing that gets downloaded. I tried just kicking off a bunch of 
 download tasks in a loop, but eventually I either get Too many open files 
 errors, or I crash (this is on an iPad).
 
 I’m not experienced with NSURLSession, but NSURLConnection limits the number 
 of open sockets (to about 4 on iOS, maybe 8 on Mac OS). If you issue more 
 simultaneous requests than that, they queue up waiting for an available 
 socket.
 
 I would think that NSURLSession has the same behavior. Are you perhaps 
 creating a separate NSURLSession for each download? I suspect that the 
 sockets are managed by each instance of NSURLSession, not globally as with 
 NSURLConnection, so if you create a ton of NSURLSessions you’re consuming 
 unlimited sockets. If so, the solution would be to create only one 
 NSURLSession and issue all your requests through it.

Yep, I was doing exactly that (discovered that right after posting the 
question). So, we'll see if it does the right thing when sharing a connection. 
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: iOS 8.4: Converting a URL into a PHAsset

2015-07-29 Thread Ben Kennedy
On 28 Jul 2015, at 7:17 pm, Carl Hoefs newsli...@autonomy.caltech.edu wrote:
 
 I'm trying to get an NSURL into PHAsset form, but I keep coming up with null. 
 PHAsset fetchAssetsWithALAssetURLs: takes an NSArray of NSURLs: An array of 
 NSURL objects, each an asset URL previously retrieved from an ALAsset 
 object. Apparently, this is not a simple array of NSURL objects. 

Well, more specifically, it sounds like an array of “asset URLs previously 
retrieved from an ALAsset object.”

 2015-07-28 19:04:36.221 hsvst[577:76956] assetURLs (

 file:///var/mobile/Containers/Data/Application/9C51BEE6-80A7-15A4-72DA-19E447A75E25/Documents/hsvst_0005.mov
 )

Indeed, that looks like a file:// URL representing a path to regular disk file 
on the filesystem, not an asset URL from an ALAsset object.

Have you looked at +[PHAssetChangeRequest 
creationRequestForAssetFromVideoAtFileURL:] ?  For example:

 PHAssetChangeRequest *assetRequest = [PHAssetChangeRequest 
 creationRequestForAssetFromVideoAtFileURL: self.sourcePlayListItem.url];
 PHObjectPlaceholder *assetPlaceholder = 
 assetRequest.placeholderForCreatedAsset;
 /* treat assetPlaceholder as a PHAsset and do something with it */ ;

What are you ultimately trying to do?

cheers,

-ben


___

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

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

Help/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: Unique ID for a Window?

2015-07-29 Thread Jean-Daniel Dupas

 Le 29 juil. 2015 à 12:25, Dave d...@looktowindward.com a écrit :
 
 Hi,
 
 For reasons that are too complex to go in to, I need to somehow create a 
 Unique ID that is valid for the life of a Window. The Window I am trying to 
 identify is not owned by my App (think Screen Dump, like “Grab”). 
 
 I ran this code:
 
 CFArrayRef windowList = 
 CGWindowListCopyWindowInfo(kCGWindowListOptionOnScreenOnly, kCGNullWindowID);
 for (NSMutableDictionary* entry in (NSArray*)windowList) 
 {
NSString* ownerName = [entry objectForKey:(id)kCGWindowOwnerName];
NSInteger ownerPID = [[entry objectForKey:(id)kCGWindowOwnerPID] 
 integerValue];
NSLog(@%@:%ld, ownerName, (long)ownerPID);
 }
 CFRelease(windowList);  
 
 This is the dictionary returned for this Email message:
 
 {
kCGWindowAlpha = 1;
kCGWindowBounds = {
Height = 858;
Width = 1003;
X = 874;
Y = 342;
};
kCGWindowIsOnscreen = 1;
kCGWindowLayer = 0;
kCGWindowMemoryUsage = 3462288;
kCGWindowName = New Message;
kCGWindowNumber = 2895;
kCGWindowOwnerName = Mail;
kCGWindowOwnerPID = 507;
kCGWindowSharingState = 1;
kCGWindowStoreType = 2;
 },
 
 Are one or more of these values guaranteed to be Unique (within the Window 
 List) and not to change during the life-time of the Window? 
 
 Thanks a lot.
 
 All the Best
 Dave

From the Window Services Reference:

kCGWindowNumber
The value for this key is a CFNumberRef 
https://developer.apple.com/library/mac/documentation/CoreFoundation/Reference/CFNumberRef/index.html#//apple_ref/c/tdef/CFNumberRef
 type (encoded as kCGWindowIDCFNumberType 
https://developer.apple.com/library/mac/documentation/Carbon/Reference/CGWindow_Reference/Constants/Constants.html#//apple_ref/c/macro/kCGWindowIDCFNumberType)
 that contains the window ID. The window ID is unique within the current user 
session. 




___

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

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

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

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

Unique ID for a Window?

2015-07-29 Thread Dave
Hi,

For reasons that are too complex to go in to, I need to somehow create a Unique 
ID that is valid for the life of a Window. The Window I am trying to identify 
is not owned by my App (think Screen Dump, like “Grab”). 

I ran this code:

CFArrayRef windowList = 
CGWindowListCopyWindowInfo(kCGWindowListOptionOnScreenOnly, kCGNullWindowID);
for (NSMutableDictionary* entry in (NSArray*)windowList) 
{
NSString* ownerName = [entry objectForKey:(id)kCGWindowOwnerName];
NSInteger ownerPID = [[entry objectForKey:(id)kCGWindowOwnerPID] 
integerValue];
NSLog(@%@:%ld, ownerName, (long)ownerPID);
}
CFRelease(windowList);  

This is the dictionary returned for this Email message:

{
kCGWindowAlpha = 1;
kCGWindowBounds = {
Height = 858;
Width = 1003;
X = 874;
Y = 342;
};
kCGWindowIsOnscreen = 1;
kCGWindowLayer = 0;
kCGWindowMemoryUsage = 3462288;
kCGWindowName = New Message;
kCGWindowNumber = 2895;
kCGWindowOwnerName = Mail;
kCGWindowOwnerPID = 507;
kCGWindowSharingState = 1;
kCGWindowStoreType = 2;
},

Are one or more of these values guaranteed to be Unique (within the Window 
List) and not to change during the life-time of the Window? 

Thanks a lot.

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: Unique ID for a Window?

2015-07-29 Thread Dave
 
 From the Window Services Reference:
 
 kCGWindowNumber
 The value for this key is a CFNumberRef 
 https://developer.apple.com/library/mac/documentation/CoreFoundation/Reference/CFNumberRef/index.html#//apple_ref/c/tdef/CFNumberRef
  type (encoded as kCGWindowIDCFNumberType 
 https://developer.apple.com/library/mac/documentation/Carbon/Reference/CGWindow_Reference/Constants/Constants.html#//apple_ref/c/macro/kCGWindowIDCFNumberType)
  that contains the window ID. The window ID is unique within the current user 
 session. 

Yes I saw this, I wasn’t sure what “Current User Session” meant in this case. 
Also if there could be a window owned by one App with the same CGWindowNumber 
as another App, IOW, if there could be more than one Window in the Window Array 
that has the same number? e.g. I need more than once piece of info to ensure it 
is unique.

Cheers
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

Change window's rootViewController at runtime

2015-07-29 Thread Diederik Meijer
Did my message below get posted yesterday? I see no replies and did get a weird 
spam response.



Dear list,

I am working on an iOS app that uses a UISplitViewController.

As per the client’s requirements, a UIViewController should be loaded before 
the UISplitViewController loads.

This “preceding” UIViewController - let’s call it the Home Screen - allows the 
user to select from a small number of content packages, the selection is used 
to populate the UISplitViewControllers’s view controllers.

Obviously, the Home Screen must be loaded before or at the same time the 
splitview becomes visible, the splitview must not be visible before the Home 
Screen becomes visible.

In a previous project I worked around this by calling presentViewController in 
the UISplitViewController’s viewController that populates the splitview’s 
detail section, setting animated to NO.

However, this triggers warnings that indicate that the presenting 
viewController tries to present a viewController while a presentation is in 
progress. This indicates the system wants to be done with loading the splitView 
and laying out is subviews, before one of its subviews can call 
presentViewController to load the Home Screen.

In a current project I am taking a different approach, as follows:

At application launch both the UISplitViewController and the “preceding” 
UIViewController are both instantiated as properties of the AppDelegate and the 
“preceding” UIViewController is initially set as the app delegate window’s 
rootViewController. The app now launches immediately into the Home Screen, not 
being called from any other ViewController.

After user selection, a method is called in the app delegate that replaces the 
window’s rootViewController, setting it to the UISplitViewController. At the 
same time, the UISplitViewController’s ViewControllers in master and detail get 
the information needed to get the data they need to populate their views.

This works fine and I get no warnings or errors.

However, since it is the first time I am taking this approach I would like to 
double check if I am overlooking any issues. In short, is this approach 
acceptable? Or are there any risks to it?


Many thanks,




Diederik
___

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

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

Help/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: Unique ID for a Window?

2015-07-29 Thread Dave

 On 29 Jul 2015, at 13:12, Uli Kusterer witness.of.teacht...@gmx.net wrote:
 

  Note that I'm saying at a time. There is no guarantee that an application 
 might not close the window whose number you have, then open a new one, and 
 get a new window with the same number. It's unlikely to happen, but I don't 
 think it's stated anywhere that that is impossible. OTOH, also keep in mind 
 that an application might close a window and re-open it instead of just 
 hiding and showing it, which might change its window number.

That’s ok, because I track Window Close/Open and will just create a new ID when 
a window is opened.

Thanks for the clarification.

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: Regarding these Olivia messages. Can we do something about the list security?

2015-07-29 Thread Carl Hoefs

 On Jul 29, 2015, at 10:30 PM, Joar Wingfors j...@joar.com wrote:
 
 On 29 Jul 2015, at 16:52, Jens Alfke j...@mooseyard.com wrote:
 
 On Jul 29, 2015, at 4:32 PM, Roland King r...@rols.org wrote:
 
 That's what I think to and the filth spread to the xcode list, or spread 
 from the xcode list. I wrote to the admins on both lists and asked them to 
 remove this scum feeder from all apple lists.
 
 I don’t think there’s any way to figure out which subscriber it is. The 
 spammer would almost certainly have subscribed under an anonymous Gmail or 
 Yahoo address, not something easily detectable like 
 “scum_fee...@spamsalot.biz mailto:scum_fee...@spamsalot.biz”.
 
 Right. If someone can come up with a concrete approach for how to address 
 this issue I can make sure that it gets looked at. At the moment I’m just not 
 clear on how that would be accomplished. 

An additional clue to this puzzle is that not everyone who is subscribed to the 
list received such messages. I, for one, did not.
-Carl


___

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

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

Help/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: Regarding these Olivia messages. Can we do something about the list security?

2015-07-29 Thread Joar Wingfors

 On 29 Jul 2015, at 16:52, Jens Alfke j...@mooseyard.com wrote:
 
 
 On Jul 29, 2015, at 4:32 PM, Roland King r...@rols.org wrote:
 
 That's what I think to and the filth spread to the xcode list, or spread 
 from the xcode list. I wrote to the admins on both lists and asked them to 
 remove this scum feeder from all apple lists.
 
 I don’t think there’s any way to figure out which subscriber it is. The 
 spammer would almost certainly have subscribed under an anonymous Gmail or 
 Yahoo address, not something easily detectable like 
 “scum_fee...@spamsalot.biz mailto:scum_fee...@spamsalot.biz”.


Right. If someone can come up with a concrete approach for how to address this 
issue I can make sure that it gets looked at. At the moment I’m just not clear 
on how that would be accomplished. 

Joar



___

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

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

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

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

Techniques for limiting concurrent downloads via NSURLSession

2015-07-29 Thread Rick Mann
In my application I have to download hundreds to maybe a thousand files for 
each thing that gets downloaded. I tried just kicking off a bunch of download 
tasks in a loop, but eventually I either get Too many open files errors, or I 
crash (this is on an iPad).

I can think of at least one way to limit this: issue the first N downloads, 
then as each completes, issue another. This requires a bit more bookkeeping, 
but can be doable.

The drawback comes when you want to make them background download sessions to 
be conducted when the app isn't running. It would be nice to set them all up, 
and just let the OS take care of limiting the actual downloads. Not sure this 
is feasible with this many files.

What other techniques do you guys use for this situation?

TIA,

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

Timeouts in NSURLSession

2015-07-29 Thread Rick Mann
I'm starting hundreds of download tasks on a single NSURLSession. The session 
nicely limits the number of concurrent downloads, and everything seems to 
behave, until I some time has elapsed equal to the default value of 
timeoutIntervalForRequest, 60 seconds (I don't currently adjust this).

Others have experienced this, as evidenced by this post 
(http://stackoverflow.com/questions/2041/set-number-of-concurrent-downloads-with-nsurlsessiondownloadtask).
 The problem is that the timer for the request is started when the task is 
resumed, and not when its request is actually first issued. This means that if 
you have more tasks than the HTTPMaximumConnectionsPerHost, and those tasks 
take longer than timeoutIntervalForRequest, the next task will time out, even 
though it hasn't yet begun.

I think this is a bug, and I'm filing it as such, but I wanted to get other 
opinions. It seems the only workaround is to make the timeoutIntervalForRequest 
very long, too, which is gross, as a single request may legitimately time out 
in a short amount of time, but the large set of tasks could take much longer to 
run through.


-- 
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: NSPrivateQueueConcurrencyType working outside of performBlock

2015-07-29 Thread Trygve Inda
 
 “Setter methods on queue-based managed object contexts are thread-safe. You
 can invoke these methods directly on any thread”
 
 https://developer.apple.com/library/mac/documentation/Cocoa/Reference/CoreData
 Framework/Classes/NSManagedObjectContext_Class/index.html
 


In Apple's example, they use two different contexts, each with their own
NSPersistentStoreCoordinator. But the NSPersistentStoreCoordinators each
point to the same store file URL.

Where is it documented that this works?

If the NSPersistentStoreCoordinator instances are separate, how does it
actually work when they are both writing to the same store (potentially at
the same time)?

All Apple's notes say is:

To ensure that the application can remain responsive during this operation,
the view controller employs a second coordinator to manage interaction with
the persistent store. It configures the coordinator to use the same managed
object model and persistent store as the main coordinator vended by the
stack controller. 


Trygve




___

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

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

Help/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: Unique ID for a Window?

2015-07-29 Thread Uli Kusterer
On 29 Jul 2015, at 13:25, Dave d...@looktowindward.com wrote:
 Yes I saw this, I wasn’t sure what “Current User Session” meant in this case. 
 Also if there could be a window owned by one App with the same CGWindowNumber 
 as another App, IOW, if there could be more than one Window in the Window 
 Array that has the same number? e.g. I need more than once piece of info to 
 ensure it is unique.


 AFAIK it's the number the window server uses to identify a window. So unless 
you have multiple user sessions (i.e. you have a second user logged in using 
Fast User Switching), there is only one window with that ID at a time. It is 
unique across all the applications running under the same user's account. Which 
usually is all windows your application can see (unless your app is running as 
root, but really, nobody except maybe login screen plugin developers would do 
that).

 Note that I'm saying at a time. There is no guarantee that an application 
might not close the window whose number you have, then open a new one, and get 
a new window with the same number. It's unlikely to happen, but I don't think 
it's stated anywhere that that is impossible. OTOH, also keep in mind that an 
application might close a window and re-open it instead of just hiding and 
showing it, which might change its window number.

Cheers,
-- Uli Kusterer
The Witnesses of TeachtText are everywhere...



___

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

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

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

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