This issue is really annoying me. Oddly enough, it works 100% of the time on my iPad. On my iPhone, however, functions using appex from Safari only work ~25% of the time. It doesn't matter whether I try to get the URL or web page data directly.
Is there anything I can do to make this work on the iPhone the way it does on the iPad?
Here's an example of a general script I use to see what comes through the share sheet:
import appex
from bs4 import BeautifulSoup
def main():
if appex.is_running_extension():
print(f'# APPEX DATA #\n{"=" * 15}\n')
methods = [
method for method in dir(appex)
if callable(getattr(appex, method)) and
method.startswith('get') and method != 'get_input'
]
for method in methods:
result = getattr(appex, method)()
name = method.partition("_")[2]
if result:
print(f'{name}\n{"-"*15}')
if name == 'web_page_info':
for k, v in result.items():
if k == 'html':
soup = BeautifulSoup(v, 'html.parser')
v = soup.prettify()
print(f'{k}: {v}')
print('\n')
else:
print(f'{result}\n\n')
else:
raise ReferenceError(
'Requires appex: (must be run from iOS share sheet!)')
if __name__ == '__main__':
main()