-[NSWorkspace openURLs:::::] Method Fails if invoked repeatedly
| Originator: | jerrykrinock | ||
| Number: | rdar://19642555 | Date Originated: | 2015-Jan-28 |
| Status: | Open | Resolved: | |
| Product: | OS X SDK | Product Version: | 10.10.1 |
| Classification: | Other Bug | Reproducible: | Always |
Summary:
If you invoke -[NSWorkspace
openURLs:withAppBundleIdentifier:options:additionalEventParamDescriptor:launchIdentifiers:] in a loop, each time giving it an array containing a single URL, it will fail after the first several
Steps to Reproduce:
1. Build and run the attached project, which is a command-line tool with this code:
#import <Cocoa/Cocoa.h>
int main(int argc, const char * argv[]) {
@autoreleasepool {
NSArray* urls = @[
@"http://www.aboutspice.com/index.php",
@"http://www.allaboutcircuits.com/",
@"http://home.sandiego.edu/",
@"http://bscit.berkeley.edu/dlp.html",
@"http://www.ecircuitcenter.com/",
@"http://www.engineeringtoolbox.com/",
@"http://donklipstein.com/",
@"http://churchlawtodaystore.com/",
@"http://www.swarthmore.edu/",
@"http://aol.com",
@"http://www.rfdude.com/",
@"http://www.cablestogo.com/",
@"http://scu.edu"
] ;
for (NSString* string in urls) {
NSURL* url = [NSURL URLWithString:string] ;
NSArray* oneUrls = @[url] ;
BOOL ok = [[NSWorkspace sharedWorkspace] openURLs:oneUrls
withAppBundleIdentifier:@"com.apple.Safari"
options:0
additionalEventParamDescriptor:nil
launchIdentifiers:NULL] ;
printf("%s : %s\n", ok ? "PASS" : "FAIL", [string UTF8String]) ;
}
}
return 0 ;
}
Expected Results:
13 web pages should open in Safari, and the console log should indicate 13 results PASS. I understand that it may take several tens of seconds for 13 web pages to open, but they should eventually open.
Actual Results:
4-6 web pages open in Safari. The console log indicates that the first 4-6 results PASS and then all the remainder FAIL.
Version:
OS X 10.10.1, or 10.10.2 (14C99d)
Notes:
I am told that the same thing happens if you enter a different browser into the Bundle Identifier. Therefore, the problem seems to be in NSWorkspace, not in Safari.
Configuration:
Attachments:
'NSWorkspaceOpenUrlBug.zip' was successfully uploaded.
Comments
Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!