javaScriptCore threads?

2013-08-12 Thread Rick Mann
I just noticed a couple of javaScriptCore threads in my iOS 6.1 iPad app. Any 
idea what's creating those? I don't use them directly, don't even use UIWebView.

-- 
Rick




___

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

Please do not post admin requests or moderator comments to the list.
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: javaScriptCore threads?

2013-08-12 Thread Kyle Sluder
On Aug 12, 2013, at 12:49 AM, Rick Mann rm...@latencyzero.com wrote:

 I just noticed a couple of javaScriptCore threads in my iOS 6.1 iPad app. Any 
 idea what's creating those? I don't use them directly, don't even use 
 UIWebView.

Doesn't mean something in the frameworks doesn't use it.

UILabel, for example, has historically used a WebView to render its text.

--Kyle Sluder
___

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

Please do not post admin requests or moderator comments to the list.
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

Unmounting/ejecting volumes in sandboxed mode

2013-08-12 Thread Oleg Krupnov
I've run across an unexpected and undocumented problem, and couldn't
google anything on it.

It seems that if an app is sandboxed, it is not permitted to eject
disks or unmount volumes.

I tried -[NSWorkspace unmountAndEjectDeviceAtPath:],
FSUnmountVolumeAsync / FSEjectVolumeAsync, DADiskUnmount / DADiskEject
but all I get is failure with a message like Error
Domain=NSOSStatusErrorDomain Code=-47 The operation couldn’t be
completed. (OSStatus error -47.) (fBsyErr: File is busy (delete))

and in Console I see com.apple.SecurityServer[16]: Sandbox denied
authorizing right 'system.volume.internal.unmount' by client …

The system.volume.internal.unmount entitlement is not documented,
and when I tried to add it to the list of entitlements, the app fails
to start at all, saying not enough permissions.

What's going on? Is there a way to eject/unmount disks in sandboxed mode?

___

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

Please do not post admin requests or moderator comments to the list.
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: Unmounting/ejecting volumes in sandboxed mode

2013-08-12 Thread Kyle Sluder
On Mon, Aug 12, 2013, at 08:28 AM, Oleg Krupnov wrote:

 The system.volume.internal.unmount entitlement is not documented,

This is an authorization right, not a sandbox entitlement.

 and when I tried to add it to the list of entitlements, the app fails
 to start at all, saying not enough permissions.
 
 What's going on? Is there a way to eject/unmount disks in sandboxed mode?

Probably not. That seems like a pretty serious operation; I would not
expect it to be available to sandboxed applications.

--Kyle Sluder
___

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

Please do not post admin requests or moderator comments to the list.
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

index beyond bounds when using a queue for a for-loop

2013-08-12 Thread Koen van der Drift
Hi,

I'm trying to use a queue for a calculation intensive for-loop to make my iOS 
app more responsive.  The original for-loop works without errors:

for (NSUInteger i = 0; i  count; i++)
{
myArray[i] = [self doCalculation: i];
}


When count gets too large, there is a delay when the results are shown on the 
screen.  So after reading through Apple's docs on concurrency, I implemented 
the following replacement:

dispatch_queue_t queue = 
dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0);

dispatch_apply(count, queue, ^(size_t i)
{
myArray[i] = [self doCalculation: i];
});


But after a few iterations, my app crashes because of:

*** Terminating app due to uncaught exception 'NSRangeException', reason: '*** 
-[__NSArrayM setObject:atIndex:]: index 5 beyond bounds [0 .. 1]'
*** Terminating app due to uncaught exception 'NSRangeException', reason: '*** 
-[__NSArrayM setObject:atIndex:]: index 3 beyond bounds [0 .. 0]'
*** Terminating app due to uncaught exception 'NSRangeException', reason: '*** 
-[__NSArrayM setObject:atIndex:]: index 2 beyond bounds for empty array'


Any thoughts why this happens, and how to fix it?

Thanks,

- Koen.







___

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

Please do not post admin requests or moderator comments to the list.
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: index beyond bounds when using a queue for a for-loop

2013-08-12 Thread Jens Alfke

On Aug 12, 2013, at 10:36 AM, Koen van der Drift koenvanderdr...@gmail.com 
wrote:

 dispatch_apply(count, queue, ^(size_t i)
 {
   myArray[i] = [self doCalculation: i];
 });

NSMutableArray isn’t thread-safe. You’ll need to synchronize/serialize the 
assignments somehow. You could do something like

{
id value = [self doCalculation: i];
@synchronized(myArray) {
myArray[i] = value;
}
}

although there is probably some nicer GCD API to do the same thing.

—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: index beyond bounds when using a queue for a for-loop

2013-08-12 Thread Koen van der Drift

On Aug 12, 2013, at 2:05 PM, Jens Alfke j...@mooseyard.com wrote:

 NSMutableArray isn’t thread-safe. You’ll need to synchronize/serialize the 
 assignments somehow. You could do something like
 
 {
   id value = [self doCalculation: i];
   @synchronized(myArray) {
   myArray[i] = value;
   }
 }
 

Unfortunately, I'm still getting the same error.


 although there is probably some nicer GCD API to do the same thing.
 

Are you referring to NSOperationQueue?


Thanks,

- Koen.


___

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

Please do not post admin requests or moderator comments to the list.
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

Core Data returns empty set

2013-08-12 Thread Rui Henriques Pacheco
Hello, 

I am using Core Data to store a hierarchy of objects.

These objects are displayed in an NSOutlineView and their names are used to 
populate a list of strings used in autocomplete.

Once my window loads I can see the hierarchy of objects displayed but if I try 
to access them programmatically, Core Data returns an empty as soon as I get to 
the first one to many relationship.

I have root, single node element, set of object and then each object in the set 
will also have a set of children.

The list of objects is tiny, so far less than 100 and the outline view has no 
problems displaying them, so I wonder why can't I reach them programmatically. 

-- 
Rui Henriques Pacheco
Sent with Sparrow (http://www.sparrowmailapp.com/?sig)

___

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

Please do not post admin requests or moderator comments to the list.
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: index beyond bounds when using a queue for a for-loop

2013-08-12 Thread Conrad Shultz

On Aug 12, 2013, at 11:23 AM, Koen van der Drift koenvanderdr...@gmail.com 
wrote:

 
 On Aug 12, 2013, at 2:05 PM, Jens Alfke j...@mooseyard.com wrote:
 
 NSMutableArray isn’t thread-safe. You’ll need to synchronize/serialize the 
 assignments somehow. You could do something like
 
 {
  id value = [self doCalculation: i];
  @synchronized(myArray) {
  myArray[i] = value;
  }
 }
 
 
 Unfortunately, I'm still getting the same error.

I suspect there’s an additional complication. In your single-threaded case you 
probably assumed that `i` increased uniformly and monotonically, so that 
myArray[i] = foo always appended objects to the array. In a multithreaded 
implementation this is no longer the case: there’s a race between different 
values of `i`, so it’s entirely possible that you will try to, say, set the 
object at index 3 before index 2. This will raise a range exception as you are 
seeing.

There are at least two possible fixes.

First, since you know the array size in advance, you could do something like 
pre-fill myArray with [NSNull null]. This would work around the range exception 
by having your code replace objects rather than append new objects.

Second, you could switch from an array to an order-agnostic collection such as 
a dictionary or set. NSPointerArray may also provide useful behavior.

Exactly which approach you take will depend on specifics about your application 
and the problem you are solving.

-Conrad
___

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

Please do not post admin requests or moderator comments to the list.
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: index beyond bounds when using a queue for a for-loop

2013-08-12 Thread Koen van der Drift
Thanks for all the input.  I solved it by using a straightforward C-array, 
which I think also circumvents the scenario that Conrad describes about the 
crash being caused by index 3 being set before index 2.

As it turns out, the time for the whole loop *decreased* by 5-10 fold by using 
a dispatch_queue_t. So next I will look in the code that updates the GUI to see 
where the bottleneck lies.


- Koen.




On Aug 12, 2013, at 3:07 PM, Conrad Shultz conrad_shu...@apple.com wrote:

 
 On Aug 12, 2013, at 11:23 AM, Koen van der Drift koenvanderdr...@gmail.com 
 wrote:
 
 
 On Aug 12, 2013, at 2:05 PM, Jens Alfke j...@mooseyard.com wrote:
 
 NSMutableArray isn’t thread-safe. You’ll need to synchronize/serialize the 
 assignments somehow. You could do something like
 
 {
 id value = [self doCalculation: i];
 @synchronized(myArray) {
 myArray[i] = value;
 }
 }
 
 
 Unfortunately, I'm still getting the same error.
 
 I suspect there’s an additional complication. In your single-threaded case 
 you probably assumed that `i` increased uniformly and monotonically, so that 
 myArray[i] = foo always appended objects to the array. In a multithreaded 
 implementation this is no longer the case: there’s a race between different 
 values of `i`, so it’s entirely possible that you will try to, say, set the 
 object at index 3 before index 2. This will raise a range exception as you 
 are seeing.
 
 There are at least two possible fixes.
 
 First, since you know the array size in advance, you could do something like 
 pre-fill myArray with [NSNull null]. This would work around the range 
 exception by having your code replace objects rather than append new objects.
 
 Second, you could switch from an array to an order-agnostic collection such 
 as a dictionary or set. NSPointerArray may also provide useful behavior.
 
 Exactly which approach you take will depend on specifics about your 
 application and the problem you are solving.
 
 -Conrad


___

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

Please do not post admin requests or moderator comments to the list.
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

Major Xcode irritation

2013-08-12 Thread Graham Cox
Has anyone else run into this?

You open a system header from the SDK into XCode, and due to muscle-memory, 
absent-mindedness, reflex, lack of context or whatever, you hit cmd-S and save 
it over the old header (even if it hasn't actually been changed). XCode then 
refuses to build because the header file mod date no longer matches what was 
used when the precompiled headers were built.

OK, so let's restore that file - oops, no backup because I don't typically back 
up apps, and the SDK is embedded in the app. OK, download a new SDK from Apple 
- you can't, the SDK is part of the Xcode download which is 1.6 GB, not a swift 
download in most people's books. Rebuild the precompiled headers? Probably a 
fair option, but it's not obvious how one even does that these days, assuming 
it's still possible (help?).

Given that the SDK is embedded in the app, why on earth is it even allowed to 
overwrite a file there? Why do the permissions allow writing? Mysteries, 
mysteries... in the meantime I will have lost half a day's productivity just 
putting this stupid annoyance right.

/Gripe

If anyone could let me have a copy of NSEvent.h from the XCode 4.6.2 10.8 SDK 
with the mod date 10/4/2013 12:53AM that would save my sanity and my few 
remaining hairs - thanks!

--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: Major Xcode irritation

2013-08-12 Thread Greg Parker
On Aug 12, 2013, at 12:31 PM, Graham Cox graham@bigpond.com wrote:
 Given that the SDK is embedded in the app, why on earth is it even allowed to 
 overwrite a file there? Why do the permissions allow writing? Mysteries, 
 mysteries... in the meantime I will have lost half a day's productivity just 
 putting this stupid annoyance right.

Did you file a bug report?


-- 
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: Major Xcode irritation

2013-08-12 Thread Simone Tellini
Il giorno 12/ago/2013, alle ore 21:31, Graham Cox graham@bigpond.com ha 
scritto:

 
 If anyone could let me have a copy of NSEvent.h from the XCode 4.6.2 10.8 SDK 
 with the mod date 10/4/2013 12:53AM that would save my sanity and my few 
 remaining hairs - thanks!
 

if you haven't edited the file content, can't you simply reset the modification 
date to solve your problem? It appears you know which one to set, so you can 
simply use touch in Terminal

-- 
Simone Tellini
http://www.tellini.org


___

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

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

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

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

Re: Major Xcode irritation

2013-08-12 Thread Steve Mills
On Aug 12, 2013, at 14:31:23, Graham Cox graham@bigpond.com wrote:

 You open a system header from the SDK into XCode, and due to muscle-memory, 
 absent-mindedness, reflex, lack of context or whatever, you hit cmd-S and 
 save it over the old header (even if it hasn't actually been changed). XCode 
 then refuses to build because the header file mod date no longer matches what 
 was used when the precompiled headers were built.

Hmm. IIRC, Xcode doesn't let me edit any system headers because I don't have 
permission. I see the padlock icon over at the right, so I would hope a Save 
would fail, even though the Save menu item is enabled (which looks like a bug 
to me). Xcode 4.6.3.

--
Steve Mills
office: 952-818-3871
home: 952-401-6255
cell: 612-803-6157




___

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

Please do not post admin requests or moderator comments to the list.
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: reverse scanner

2013-08-12 Thread Boyd Collier
I've come up with a couple of reasonably straight-forward solutions to my 
problem, but first, thanks to everyone who offered suggestions. Even though I 
didn't choose to use them, your willingness to make them is definitely 
appreciated.

Here are my solutions (note that there are 2, one labelled attack from the 
rear, the other labelled frontal attack).  I won't claim that they have been 
really thoroughly tested, but I have tried a variety of values for testString, 
d, digitsPerAllele and alleles and both methods appear to work.  If anyone sees 
a problem or an improvements, please let me know.  Right now, I favor the 
frontal attack, which occurred to me in the middle of the night -- I seldom 
have reason to use the % operator and so didn't think of it right away.  Of 
course, in actual use, I'll first take steps to separate the string that's 
being processed into substrings, if the original string uses a ; (for 
example) to separate allelic values, e.g. if the string being processed is 
04;756;013.

NSString *testString = @0756013;
NSUInteger d = 3;
NSUInteger digitsPerAllele = d;
NSUInteger alleles = 3;

NSString *subString;
NSRange range;
int theInt;

// attack from the rear
int startOfRange = [testString length];
int length = d;
int i;
for (i = 0; i  alleles; i++ ) {
startOfRange = startOfRange-d;
if (startOfRange  0) {
length = length + startOfRange; // note that startOfRange is 
negative here
if (length = 0)
break;
startOfRange = 0;
d = length;
}
range.location = startOfRange;
range.length = d;
subString = [testString substringWithRange:range];
theInt = [subString intValue];
}

// frontal attack
testString = @04756013;
int remainder = [testString length] % digitsPerAllele;
range.location = 0;
range.length = remainder;
subString = [testString substringWithRange:range];
theInt = [subString intValue];
--alleles;
range.location = remainder;
range.length = digitsPerAllele;
for (i = 0; i  alleles; i++ ) {
subString = [testString substringWithRange:range];
theInt = [subString intValue];
range.location += digitsPerAllele;
}


On Aug 10, 2013, at 10:07 AM, Boyd Collier bcolli...@cox.net wrote:

 I'm dealing with a situation in which I have to scan strings that are 
 separated by tabs, and for each string, I have to extract two numerical 
 values, with these values being separated by a non-numerical character or not 
 being separated by any character at all.  I know the maximum number of 
 characters used to represent each number, but unfortunately, the first 
 character in the group of characters used to represent the first number can, 
 quite arbitrarily, be either a 0 or missing.  For example, with the number of 
 characters used to represent each number known to be 2, the strings 607, 
 0607, 06;07 (note the semicolon between 06 and 07) should all result in 6 and 
 7 being extracted as the two numerical values. Of course, I'd like to do 
 something simple, and were it not for the arbitrary inclusion of a leading 0, 
 it would be quite simple to use an instance of NSScanner.  Or, if there were 
 such a beast as NSReverseScanner, it would also be relatively straight 
 forward, but so far as I'm aware, no such beast exists. I can think of a 
 couple of ways do accomplish this task, but if someone has already come up 
 with a clean way of scanning in reverse, I'd appreciate hearing from them.
 
 Boyd

___

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

Please do not post admin requests or moderator comments to the list.
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: Major Xcode irritation

2013-08-12 Thread Jens Alfke

On Aug 12, 2013, at 12:31 PM, Graham Cox graham@bigpond.com wrote:

 XCode then refuses to build because the header file mod date no longer 
 matches what was used when the precompiled headers were built.

Really?! Precompiled headers are automatically regenerated if any of the 
headers have been touched. There shouldn’t be any error. What’s the exact error?

 Rebuild the precompiled headers? Probably a fair option, but it's not obvious 
 how one even does that these days, assuming it's still possible (help?).

Just clean the target and rebuild.

 Given that the SDK is embedded in the app, why on earth is it even allowed to 
 overwrite a file there? Why do the permissions allow writing? Mysteries, 
 mysteries…

Mysteries you should probably be pondering on the xcode-users mailing list, not 
here.

—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: Major Xcode irritation

2013-08-12 Thread Kyle Sluder
On Mon, Aug 12, 2013, at 12:44 PM, Greg Parker wrote:
 Did you file a bug report?

I have. rdar://problem/13221349, marked as a dupe of
rdar://problem/11969509.

--Kyle Sluder
___

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

Please do not post admin requests or moderator comments to the list.
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: Major Xcode irritation

2013-08-12 Thread Kyle Sluder
On Mon, Aug 12, 2013, at 01:11 PM, Jens Alfke wrote:
 
 On Aug 12, 2013, at 12:31 PM, Graham Cox graham@bigpond.com wrote:
 
  XCode then refuses to build because the header file mod date no longer 
  matches what was used when the precompiled headers were built.
 
 Really?! Precompiled headers are automatically regenerated if any of the
 headers have been touched. There shouldn’t be any error. What’s the exact
 error?

Not in this case, I'm afraid. I've seen the exact issue Graham
describes. The compiler simply fails to build, complaining that the PCH
is older than the headers.

--Kyle Sluder

___

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

Please do not post admin requests or moderator comments to the list.
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: Major Xcode irritation

2013-08-12 Thread Jean-Daniel Dupas

Le 12 août 2013 à 22:22, Kyle Sluder k...@ksluder.com a écrit :

 On Mon, Aug 12, 2013, at 01:11 PM, Jens Alfke wrote:
 
 On Aug 12, 2013, at 12:31 PM, Graham Cox graham@bigpond.com wrote:
 
 XCode then refuses to build because the header file mod date no longer 
 matches what was used when the precompiled headers were built.
 
 Really?! Precompiled headers are automatically regenerated if any of the
 headers have been touched. There shouldn’t be any error. What’s the exact
 error?
 
 Not in this case, I'm afraid. I've seen the exact issue Graham
 describes. The compiler simply fails to build, complaining that the PCH
 is older than the headers.
 
 --Kyle Sluder


I guess that as an optimization, Xcode does not check all SDK (or system) 
headers, and just assume they do not change, so it failed to detect the change, 
and do not recompile the precompiled headers.

I also gut similar issues when I replace clang by a more recent version. Doing 
a clean / build had always solve the issue for me.

-- Jean-Daniel





___

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

Please do not post admin requests or moderator comments to the list.
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

Lack of IBAction in Some Classes

2013-08-12 Thread Gordon Apple
Is there some reason why some classes, such as NSTextView, don¹t declare
IBAction in their actions?  I¹ve taken to re-declaring such in subclasses,
which works, but results in compiler warnings about unimplemented methods.
Without that, you can¹t connect, say, a menu, in IB.  You can use a binding,
but if you want the ³sender² parameter, you are SOL.  Am I missing
something?

___

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

Please do not post admin requests or moderator comments to the list.
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: Lack of IBAction in Some Classes

2013-08-12 Thread Kyle Sluder
On Mon, Aug 12, 2013, at 01:44 PM, Gordon Apple wrote:
 Is there some reason why some classes, such as NSTextView, don¹t declare
 IBAction in their actions?

Possibly because they predate IBAction? IB used to just look for methods
that took an id argument and returned void.

 I¹ve taken to re-declaring such in
 subclasses,
 which works, but results in compiler warnings about unimplemented
 methods.
 Without that, you can¹t connect, say, a menu, in IB.  You can use a
 binding,
 but if you want the ³sender² parameter, you are SOL.  Am I missing
 something?

Does IB really not allow you to connect to such legacy methods?

--Kyle Sluder

___

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

Please do not post admin requests or moderator comments to the list.
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

Dismissing Open dlog before doc actually opens

2013-08-12 Thread Mills, Steve
I haven't been able to find any info about this, but I might be searching for 
the wrong thing. How can we get rid of the Open dlog so it doesn't hang around 
while the document is being read? It's an incredibly annoying design.

Steve via iPad

___

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

Please do not post admin requests or moderator comments to the list.
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: Dismissing Open dlog before doc actually opens

2013-08-12 Thread Bryan Vines
Steve,

Can you run an NSOpenPanel with a completion handler block, and in that block, 
call a method on a background thread to actually perform the file read 
operation?

As a test, I put this together. I called the selectAFile method and chose a 4GB 
text file. The open panel was dismissed after about a second, the file read 
completed after four seconds:

-(void)selectAFile
{
// Get and configure an open panel.
NSOpenPanel * myOpenPanel = [NSOpenPanel openPanel];
[myOpenPanel setCanChooseDirectories:NO];
[myOpenPanel setAllowedFileTypes:[NSArray arrayWithObject:@txt]];

// Run the panel.
[myOpenPanel  beginWithCompletionHandler:^(NSInteger result)
 {
 if (result==NSFileHandlingPanelOKButton)
 {
 // User clicked OK, do the actual file read in a background thread.
 [self performSelectorInBackground:@selector(openAFileURL:) 
withObject:myOpenPanel.URL];
 }
 }];
}

-(void)openAFileURL:(NSURL *)aFileURL
{
// Read the contents of the file at aFileURL into a string.
NSString * fileString = [NSString stringWithContentsOfURL:aFileURL 
encoding:NSUTF8StringEncoding error:nil];

// Log the result.
if (fileString) {
NSLog(@Successfully read file: %@, [aFileURL lastPathComponent]);
} else {
NSLog(@Could not load file: %@, [aFileURL lastPathComponent]);
}
}

--
Bryan Vines

On Aug 12, 2013, at 6:27 PM, Mills, Steve smi...@makemusic.com wrote:

 I haven't been able to find any info about this, but I might be searching for 
 the wrong thing. How can we get rid of the Open dlog so it doesn't hang 
 around while the document is being read? It's an incredibly annoying design.
 
 Steve via iPad
___

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

Please do not post admin requests or moderator comments to the list.
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: Dismissing Open dlog before doc actually opens

2013-08-12 Thread Kyle Sluder
On Aug 12, 2013, at 4:27 PM, Mills, Steve smi...@makemusic.com wrote:

 I haven't been able to find any info about this, but I might be searching for 
 the wrong thing. How can we get rid of the Open dlog so it doesn't hang 
 around while the document is being read? It's an incredibly annoying design.

Are you using NSDocument? If so, return YES from 
+canConcurrentlyReadDocumentsOfType: to let NSDocumentController know it can 
initialize your document in the background. Then it will call 
-makeWindowControllers on the main thread.

If you're running the NSOpenPanel yourself, just fire off your background work 
from its completion handler.

--Kyle Sluder
___

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

Please do not post admin requests or moderator comments to the list.
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: Dismissing Open dlog before doc actually opens

2013-08-12 Thread Steve Mills
On Aug 12, 2013, at 21:42:10, Kyle Sluder k...@ksluder.com
 wrote:

 Are you using NSDocument? If so, return YES from 
 +canConcurrentlyReadDocumentsOfType: to let NSDocumentController know it can 
 initialize your document in the background. Then it will call 
 -makeWindowControllers on the main thread.
 
 If you're running the NSOpenPanel yourself, just fire off your background 
 work from its completion handler.

That didn't make any difference here. Returning YES or NO from that appeared to 
have the same behavior, even if I selected 2 files in the Open dlog. Also, 
thread safety is a major concern. Oh, I think I see why it didn't make a 
difference. I'd forgotten that we are running the open dlog ourself, not using 
Cocoa's. I might look at using a completion handler. Thanks, both of you.

--
Steve Mills
office: 952-818-3871
home: 952-401-6255
cell: 612-803-6157



___

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

Please do not post admin requests or moderator comments to the list.
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

Get file from server with iPad App

2013-08-12 Thread koko

I want to get a file from a server into my iPad App.

If I do http://... it launches Safari.

I just want the file … what is the proper way to do this?

-koko

___

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

Please do not post admin requests or moderator comments to the list.
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 file from server with iPad App

2013-08-12 Thread Kyle Sluder
Have you not come across NSURLConnection in your assuredly exhaustive Google 
search?

--Kyle Sluder
(Sent from the road)

On Aug 12, 2013, at 8:12 PM, koko k...@highrolls.net wrote:

 
 I want to get a file from a server into my iPad App.
 
 If I do http://... it launches Safari.
 
 I just want the file … what is the proper way to do this?
 
 -koko

___

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

Please do not post admin requests or moderator comments to the list.
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 file from server with iPad App

2013-08-12 Thread koko

On Aug 12, 2013, at 9:21 PM, Kyle Sluder k...@ksluder.com wrote:

 Have you not come across NSURLConnection in your assuredly exhaustive Google 
 search?


Yep, right after I posted … !

-koko
___

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

Please do not post admin requests or moderator comments to the list.
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: Unmounting/ejecting volumes in sandboxed mode

2013-08-12 Thread Oleg Krupnov
Further experiments show that some disks can be ejected under sandbox,
while others cannot. For example, CD, USB sticks, DMGs and some
external drives can be ejected/unmounted, while other external drives
and internal partitions cannot. The rule isn't that simple and seems
to have many exceptions. I've found that some other developers have
discovered this to be a bug of sandbox and filed it to Apple which
ostensibly agreed that was a bug but they haven't fixed it so far.

 Probably not. That seems like a pretty serious operation; I would not
 expect it to be available to sandboxed applications.

With all respect, this sounds like again if Apple doesn't allow
something, ergo you don't need it. There are many situations when apps
may have legitimate needs to eject disks. If it requires a curated
entitlement, Apple should have provided one. It is not a kind of case
when an entitlement would be technically difficult or impossible to
provide. So I tend to think it's a bug indeed.

On Mon, Aug 12, 2013 at 8:21 PM, Kyle Sluder k...@ksluder.com wrote:
 On Mon, Aug 12, 2013, at 08:28 AM, Oleg Krupnov wrote:

 The system.volume.internal.unmount entitlement is not documented,

 This is an authorization right, not a sandbox entitlement.

 and when I tried to add it to the list of entitlements, the app fails
 to start at all, saying not enough permissions.

 What's going on? Is there a way to eject/unmount disks in sandboxed mode?

 Probably not. That seems like a pretty serious operation; I would not
 expect it to be available to sandboxed applications.

 --Kyle Sluder
___

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

Please do not post admin requests or moderator comments to the list.
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