Post

Replies

Boosts

Views

Activity

Safari App Extension: JavaScript script is responding to phantom messages
My Safari App Extension is having trouble with one website. This is typical for some other websites as well. Navigating to that website results in 6 “Load” events. For each such event I send a “safari.extension.dispatchMessage” to my objC code. For the first of these Load messages, my objC code sends a ‘sendMeIcons” message to “safari.self.addEventListener('message', function(event)”. The other 5 Load events are ignored by my objC code and do not send this message. safari.self.addEventListener('message', function(event) receives sendMeIcons JUST once. Yet, the event handler for this message) is invoked 4 times. The first invocation is correct. The other 3 are spurious. I have no idea why this is happening. Here is my objC code safari.self.addEventListener('message', function(event) { if (event.name === "Load My URL") { console.log('In event listener Load My URL'); ... return; } if (event.name === "sendMeIcons") { ... if (hrefs.length <1) //THIS IS ALWAYS TRUE FOR THIS TEST CASE. { safari.extension.dispatchMessage("js Found No Icons"); return; } else { ... safari.extension.dispatchMessage("IconsReturned",{"urls": arrayOfUrls}); return; } } I don't have a clue how to proceed. Any suggestions.
1
0
357
Mar ’24
How does NSStackView effect NSTableView.bounds rowAtPoint and NSEvent.locationInWindow
I'm trying to get the row index of a NSTableRowView that has experienced a mouseEnter event. It should be easy with rowAtPoint using NSEvent.locationInWindow. I can't get it to work. The NSTableView lies inside a NSStackView. Of course the NSStackView adjusts the visual size of the NSTableView etc. Is NSStackView interfering? If so, how should I adjust my call to rowAtPoint?
0
0
630
Apr ’23
How to add a tableview to a safari app extension's popover window
I'm building a safari app extension with objective c. I'm using the default Xcode project. I've successfully added a NSView to the popover window. When I drag a NSTableView into the popover window, it appears in the XIB, but I can't find how to connect it to the SafariExtensionViewController. I tried adding a custom ViewController to the XIB and making the tableview its view which seems to be ok. How should I proceed from here, or is their another approach?
0
0
646
Apr ’23
How to communicate between SafariExtensionHandler and SafariExtensionViewController.xib?
I'm writing a safari app extension using the default Xcode project and objective c. I want to add interface items to the popover(as Xcode has defined it with the SafariExtensionViewController.xib) and use the SafariExtensionHandler to control and respond to these interface items. I find that I can add interface items to the SafariExtensionViewController.xib. I also can connect those items to SafariExtensionViewController.h. However, SafariExtensionHandler.popoverViewController is a member of the SFSafariExtensionViewController class, the superClass of SafariExtensionViewController so I can not use this popover controller to access the outlets that I add to the SafariExtensionViewController. How can I access these interface items from the SafariExtensionHandler? ChatGPT suggest I use [SFSafariApplication sharedApplication] as an intermediary. There is no such thing. Sign!
0
0
439
Mar ’23
The default Safari App Extension created by Xcode does nothing.
I just installed the default safari app extension (the one created by Xcode) on my mac. Its icon is visible in Safari, but when I run the extension, nothing happens. Then when using the Safari/Developer/Web Inspector/ and choosing Sources, an Extension Script folder does not appear at the lower left. Do you have any suggestions to resolve this problem?
2
1
951
Mar ’23
Making a stand-along Safari extension
Just a simple question here: As far as I can tell, I must install my Safari extension with an app that I built in Xcode. OK. What is not clear is what happens when the user quits my installing app. Does the extension remain available through Safari, or is it deleted? Is it available the next time my user runs Safari, or does he/she have to run my installer app again?
1
0
503
Feb ’23
Documentation on resuming app after shut down
When I shut down the mac while my app is still running, my app relaunches the next time I launch the mac. The problem is the data I had just entered into my app before shutdown is not saved as it is when I Quit the app. I'm trying to better understand this automatic relaunch of open apps so I can address this issue. Where is the documentation? What are the key words?
0
0
565
Jan ’23
App Store Connect says my screenshots are not in the RGB color space, but they are
I am trying to add a new screenshot in either the png or jpg format to a product page of an existing app. When I try to reorder the screenshots, App Store Connect says the new screenshot is not in the RGB color space. Preview, which created them, and Finder both say they are in the RGB color space. What should I do?
1
0
688
Feb ’22