mshibanami / TranslateWebForSafari

Safari extension that translates the current tab or selected text.
https://itunes.apple.com/app/id1513175329
27 stars 3 forks source link

Extension installed from AppStore doesn't work #1

Closed VadimIpatov closed 4 years ago

VadimIpatov commented 4 years ago

Hello! I've installed the extension v.1.2 from AppStore, but nothing happens when I click on the button. MacOS Mojave 10.14 (18A391) Safari 12.0 (14606.1.36.1.9) Feel free to ask me any additional information if you need smth.

mshibanami commented 4 years ago

Sorry for any inconvenience and thanks for reporting it, @VadimIpatov.

I still haven't detected the cause but I just released the new version (1.3.1) that fixes some bugs. Perhaps it will fix your problem. Could you please have another look with it?

mshibanami commented 4 years ago

Or the feature of this extension might be available only on Safari 13 or later. I'll keep investigating.

VadimIpatov commented 4 years ago

Could you please have another look with it? I've just updated it, but it still doesn't work :(

Or the feature of this extension might be available only on Safari 13 or later. It's possible, yep

Are there any debug methods that I can try?

mshibanami commented 4 years ago

Thanks @VadimIpatov, I appreciate your help.

Generally, you can read the app/extension output on Console.app (basically it's in /System/Applications/Utilities/), like this: Screen Shot 2020-05-27 at 9 42 16 pm However, I didn't explicitly put any debug message. So I made a new build that includes some debug messages so that the debugging on your environment would be easier. Could you please try this?: TranslateWebForSafari.app.zip

For example, for translating the current page, It's supposed to work like this: Screen Recording 2020-05-27 at 10 25 52 pm

The setting of the above was like this: Screen Shot 2020-05-27 at 10 45 04 pm By the way, just in case, please disable all other extensions when trying.

mshibanami commented 4 years ago

FYI: the actual code I made is here: https://github.com/mshibanami/TranslateWebForSafari/commit/8248b12878fa847a33e60f4737c175ed72327c2b

VadimIpatov commented 4 years ago

Thanks! Here are log messages related to the extension (I've made this test with no other extensions enabled):

default 18:01:19.170044 +0300   pkd plugin /Users/vadimipatov/Downloads/TranslateWebForSafari.app/Contents/PlugIns/TranslateWebForSafari Extension.appex is still valid.
default 18:01:19.208281 +0300   secinitd    TranslateWebForSafari Extension[37793]: root path for bundle "<private>" of main executable "<private>"
default 18:01:19.478566 +0300   secinitd    TranslateWebForSafari Extension[37793]: AppSandbox request successful
default 18:01:19.573486 +0300   launchservicesd CHECKIN:0x0-0xac5ac5 37793 io.github.mshibanami.TranslateWebForSafari.Extension
default 18:01:19.620219 +0300   TranslateWebForSafari Extension Current system appearance, (HLTB: 2), (SLS: 1)
default 18:01:19.625066 +0300   TranslateWebForSafari Extension Post-registration system appearance: (HLTB: 2)
default 18:01:19.699425 +0300   tccd    -[TCCDAccessIdentity staticCode]: static code for: identifier io.github.mshibanami.TranslateWebForSafari, type: 0: 0x7f802bf26d50 at /var/folders/j5/9gvvy7j14952ymfjd42yr5_w0000gn/T/AppTranslocation/D496D3DC-5E13-44D3-A78B-761230BD1284/d/TranslateWebForSafari.app
default 18:01:19.710760 +0300   TranslateWebForSafari Extension -[SFSafariPage getContainingTabWithCompletionHandler:]: unrecognized selector sent to instance 0x6000036f7080
default 18:01:19.710765 +0300   TranslateWebForSafari Extension -[SFSafariPage getContainingTabWithCompletionHandler:]: unrecognized selector sent to instance 0x6000036ff9e0
fault   18:01:19.711063 +0300   TranslateWebForSafari Extension Exception caught during decoding of received reply to message 'getPropertiesOfPage:completionHandler:', dropping incoming message and calling failure block.

Exception: -[SFSafariPage getContainingTabWithCompletionHandler:]: unrecognized selector sent to instance 0x6000036ff9e0
fault   18:01:19.711070 +0300   TranslateWebForSafari Extension Exception caught during decoding of received reply to message 'getPropertiesOfPage:completionHandler:', dropping incoming message and calling failure block.

Exception: -[SFSafariPage getContainingTabWithCompletionHandler:]: unrecognized selector sent to instance 0x6000036f7080
error   18:01:19.711118 +0300   TranslateWebForSafari Extension Error connecting back to host app: NSCocoaErrorDomain, code: 4101
error   18:01:19.711122 +0300   TranslateWebForSafari Extension Error connecting back to host app: NSCocoaErrorDomain, code: 4101
error   18:01:19.715207 +0300   tccd    Prompting policy for hardened runtime; service: kTCCServiceAppleEvents requires entitlement com.apple.security.automation.apple-events but it is missing for ACC:{ID: io.github.mshibanami.TranslateWebForSafari.Extension, PID[37793], auid: 501, euid: 501, binary path: '/private/var/folders/j5/9gvvy7j14952ymfjd42yr5_w0000gn/T/AppTranslocation/D496D3DC-5E13-44D3-A78B-761230BD1284/d/TranslateWebForSafari.app/Contents/PlugIns/TranslateWebForSafari Extension.appex/Contents/MacOS/TranslateWebForSafari Extension'}, REQ:{ID: com.apple.appleeventsd, PID[66], auid: 55, euid: 55, binary path: '/System/Library/CoreServices/appleeventsd'}
default 18:01:20.474748 +0300   TranslateWebForSafari Extension 🔵 Toolbar item clicked
error   18:01:20.475478 +0300   TranslateWebForSafari Extension Couldn't read values in CFPrefsPlistSource<0x600001df5c00> (Domain: group.io.github.mshibanami.TranslateWebForSafari, User: kCFPreferencesAnyUser, ByHost: Yes, Container: (null), Contents Need Refresh: Yes): Using kCFPreferencesAnyUser with a container is only allowed for System Containers, detaching from cfprefsd
default 18:01:20.476592 +0300   TranslateWebForSafari Extension 🔵 behavior: translateTextIfSelected
default 18:01:20.476714 +0300   TranslateWebForSafari Extension 🔵 Started page translation
default 18:01:20.476847 +0300   TranslateWebForSafari Extension ✅ Finished page translation
default 18:01:20.478537 +0300   TranslateWebForSafari Extension ✅ openPage(for:), media: page(https://www.latvija.lv/)
default 18:01:20.480420 +0300   TranslateWebForSafari Extension ⚫️ Started getActiveTab
default 18:01:20.480856 +0300   TranslateWebForSafari Extension ✅ Finished getActiveTab: Optional(<SFSafariTab: 0x6000036f2620>)
default 18:01:20.480927 +0300   TranslateWebForSafari Extension ✅ Started navigate(to:)
default 18:01:20.481009 +0300   TranslateWebForSafari Extension -[SFSafariTab navigateToURL:]: unrecognized selector sent to instance 0x6000036f2620
fault   18:01:20.481153 +0300   TranslateWebForSafari Extension Exception caught during decoding of received reply to message 'getActiveTabInWindow:completionHandler:', dropping incoming message and calling failure block.

Exception: -[SFSafariTab navigateToURL:]: unrecognized selector sent to instance 0x6000036f2620
error   18:01:20.481212 +0300   TranslateWebForSafari Extension Error connecting back to host app: NSCocoaErrorDomain, code: 4101
default 18:01:21.091526 +0300   TranslateWebForSafari Extension -[SFSafariPage getContainingTabWithCompletionHandler:]: unrecognized selector sent to instance 0x6000036ffd20
fault   18:01:21.091663 +0300   TranslateWebForSafari Extension Exception caught during decoding of received reply to message 'getPropertiesOfPage:completionHandler:', dropping incoming message and calling failure block.

Exception: -[SFSafariPage getContainingTabWithCompletionHandler:]: unrecognized selector sent to instance 0x6000036ffd20
error   18:01:21.091696 +0300   TranslateWebForSafari Extension Error connecting back to host app: NSCocoaErrorDomain, code: 4101
default 18:01:21.091903 +0300   TranslateWebForSafari Extension -[SFSafariPage getContainingTabWithCompletionHandler:]: unrecognized selector sent to instance 0x6000036f7800
fault   18:01:21.092020 +0300   TranslateWebForSafari Extension Exception caught during decoding of received reply to message 'getPropertiesOfPage:completionHandler:', dropping incoming message and calling failure block.

Exception: -[SFSafariPage getContainingTabWithCompletionHandler:]: unrecognized selector sent to instance 0x6000036f7800
error   18:01:21.092052 +0300   TranslateWebForSafari Extension Error connecting back to host app: NSCocoaErrorDomain, code: 4101
mshibanami commented 4 years ago

Thanks @VadimIpatov, It's really helpful. It seems this is the problem:

Exception: -[SFSafariTab navigateToURL:]: unrecognized selector sent to instance 0x6000036f2620 Exception: -[SFSafariPage getContainingTabWithCompletionHandler:]: unrecognized selector sent to instance 0x6000036ffd20

I'll fix to not use these methods.

BTW, I think the reason I missed this bug is also a problem of macOS SDK. I reported this to Apple like this: https://openradar.appspot.com/radar?id=5049223502364672 (Hi Apple developers, I hope you're reading this comment and will fix soon.)

mshibanami commented 4 years ago

Hi @VadimIpatov, I've addressed this issue. Could you please try this? Thanks. TranslateWebForSafari.app.zip

Note: Code changes are in #2

mshibanami commented 4 years ago

I've just released version 1.5 that doesn't include the above fix.

mshibanami commented 4 years ago

Version 1.6 was released and it includes the fix. Again, thanks so much @VadimIpatov for helping to solve this issue. Please let me know if you have any other problems.

VadimIpatov commented 4 years ago

It seems it works now! Thanks a lot! :)