Posts

Post marked as solved
14 Replies
John,Thanks for your response.Webview works easily with interface builder, just a single line of code assigning the view to the webview, in iOS or macOS.Our app features context sensitive help so that the appropriate HTML displays in the view the user is in. There are over 80 HTML files so asking the user to exit the app and open another window, etc. Not a soultion. (It works great in our iOS apps.)The issue and solution is a Entitlement called: com.apple.security.network.client, that must be set to YES. Why this is needed to access files in the app bundle is a mystery...Sorry I posted this on the wrong thread, doesn't seem like there's much Mac expertise out there!
Post not yet marked as solved
2 Replies
Hi Tony, We submitted a TSI and they punted to filing a Bug Report..In our experience, often a black hole.Here is the message:Thank you for contacting Apple Developer Technical Support (DTS). We have reviewed your request and believe this issue would be best handled by the relevant engineering team directly, as it may require changes to the OS, tools, or the frameworks you are using.Please submit a complete bug report regarding this issue using ....We MUST get this working so we can port our business apps which import the Contracts into the app.Perhaps if you file a similar Bug Report it will help get some action?Thanks!JohnBelow is what we filed. Recent Similar Reports:None Resolution:Open Basic Information Please provide a descriptive title for your feedback:CNContact Access on macOS - “Directory services are not configured” - message in xCodeWhich area are you seeing an issue with?ContactsWhat type of issue are you reporting?Application Crash Details What kind of contacts account is having the problem?Something else not on this listWhat kind of account?Testing with Contacts on MacWhich app are you using when you encounter the issue?Something else not on this listWhich App are you using?We are developing our macOS app.What time was it when this last occurred? (Example: 12:00 pm EST 02/14/2018)6:00 am on 8/15/2019 Description Please describe the issue and what steps we can take to reproduce it:Hello, Please note from DTS: We have reviewed your request and believe this issue would be best handled by the relevant engineering team directly, as it may require changes to the OS, tools, or the frameworks you are using.Issue: When building and running the code below the following message is displayed in the Xcode log: 2019-08-14 12:26:20.858611-0600 JZMac[10866:26357377] [directory-services] checking if directory services are configured 2019-08-14 12:26:20.860954-0600 JZMac[10866:26357377] [directory-services] directory services are not configured. Here is the code:- (void) loadContactList { CNAuthorizationStatus status = [CNContactStore authorizationStatusForEntityType:CNEntityTypeContacts];if( status == CNAuthorizationStatusDenied || status == CNAuthorizationStatusRestricted) {NSLog(@"access denied");} else {//Create repository objects contactsCNContactStore *contactStore = [[CNContactStore alloc] init];NSArray *keys = [[NSArray alloc]initWithObjects:CNContactIdentifierKey, CNContactEmailAddressesKey, CNContactBirthdayKey, CNContactImageDataKey, CNContactPhoneNumbersKey, CNContactViewController.descriptorForRequiredKeys, nil]; CNContactFetchRequest *request = [[CNContactFetchRequest alloc] initWithKeysToFetch:keys];request.predicate = nil; [contactStore enumerateContactsWithFetchRequest:request error:nil usingBlock:^(CNContact* __nonnull contact, BOOL* __nonnull stop) { NSString *phoneNumber = @"";if( contact.phoneNumbers) phoneNumber = [[[contact.phoneNumbers firstObject] value] stringValue];[self->cnArr addObject:contact]; }]; }NSLog (@"ConImp...LoadContacts...ContArr: %lu", (unsigned long)cnArr.count);}
Post not yet marked as solved
2 Replies
Thanks for the reply. Here is the code. Although we have been doing this for seven years and have 17 iOS apps we pretty much operate in the Xcode/Objective C and occasionally the Swift world.Here is the link to the actual project: https://developer.apple.com/library/archive/samplecode/SBSendEmail/Introduction/Intro.html#//apple_ref/doc/uid/DTS10004645Here is the one method in the project that does what we need. Adds a message to the outgoing messages.- (IBAction)sendEmailMessage:(id)sender { /* create a Scripting Bridge object for talking to the Mail application */ MailApplication *mail = [SBApplication applicationWithBundleIdentifier:@"com.apple.Mail"]; /* set ourself as the delegate to receive any errors */ mail.delegate = self; /* create a new outgoing message object */ MailOutgoingMessage *emailMessage = [[[mail classForScriptingClass:@"outgoing message"] alloc] initWithProperties: [NSDictionary dictionaryWithObjectsAndKeys: [self.subjectField stringValue], @"subject", [[self.messageContent textStorage] string], @"content", nil]]; /* add the object to the mail app */ [[mail outgoingMessages] addObject: emailMessage]; /* set the sender, show the message */ emailMessage.sender = [self.fromField stringValue]; emailMessage.visible = YES; /* Test for errors */ if ( [mail lastError] != nil ) return; /* create a new recipient and add it to the recipients list */ MailToRecipient *theRecipient = [[[mail classForScriptingClass:@"to recipient"] alloc] initWithProperties: [NSDictionary dictionaryWithObjectsAndKeys: [self.toField stringValue], @"address", nil]]; [emailMessage.toRecipients addObject: theRecipient]; [theRecipient release]; /* Test for errors */ if ( [mail lastError] != nil ) return; } /* send the message */ [emailMessage send]; }
Post marked as solved
14 Replies
Hi John,Noted that you were working with WkWebView on macOS. We are just trying to get it working on macOS. So easy on iOS, Mac, not so much. We are simply trying to show some of our HTML documention files. We are porting from iOS to macOS and there really isn't much here or Stack on macOS so any help would be appreciated.Here are two code samples that result in White Screen, no errors or other messages. It is finding the files in the bundle.Thanks for any help, suggestions or solutions.@IBOutlet weak var webOutlet: WKWebView! override func viewDidLoad() { print ("WebHelp") super.viewDidLoad() let webView = WKWebView() let htmlPath = Bundle.main.path(forResource: "Admin", ofType: "html") let folderPath = Bundle.main.bundlePath let baseUrl = URL(fileURLWithPath: folderPath, isDirectory: true) do { let htmlString = try NSString(contentsOfFile: htmlPath!, encoding: String.Encoding.utf8.rawValue) webView.loadHTMLString(htmlString as String, baseURL: baseUrl) } catch { // catch error } webView.navigationDelegate = self webOutlet = webView } }OR @property (weak) IBOutlet WKWebView *webView; NSURLRequest *urlRequest = [NSURLRequest requestWithURL:[NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"Admin" ofType:@"html"]]]; [webView loadRequest:urlRequest]; [webView.navigationDelegate self];