-
Notifications
You must be signed in to change notification settings - Fork 242
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
BUG IN CLIENT OF UIKIT: UIApplication.openURL(_:) deprecated, migrate to UIApplication.open(_:options:completionHandler:) #953
Comments
I tried changing
to
But I still get the same error. |
ChatGPT made a workaround based on the rubicon module. But as far as I can tell, that module does not work with Kivy-ios. 'toolchain pip install rubicon' could not install it, and according to 'toolchain recipes' it has no recipe. Then I asked ChatGPT to rewrite it for pyobjus. This result works:
The only thing I had to correct was:
ChatGPT suggested:
|
NOTE: The code above is an addition to the 'main.py' code from my first message. |
Note also that you have to insert the following keys in the Info.plist file of your Xcode project:
|
My Python-Kivy apps cannot open a webbrowser on iOS. It works on Ubuntu 20.04 and Android 8.1.0.
A few months ago installing (building) Kivy-ios (on my MacOS 15.0.1) with the "toolchain build python3 kivy" command failed, so I made a copy of the newest version of the kivy-ios repository with the following commands in Terminal:
(venv) henrikroseno@MBPtilhdeHenrik ~ % git clone https://github.com/kivy/kivy-ios
(venv) henrikroseno@MBPtilhdeHenrik ~ % cd kivy-ios
(venv) henrikroseno@MBPtilhdeHenrik kivy-ios % pip3 uninstall kivy-ios
(venv) henrikroseno@MBPtilhdeHenrik kivy-ios % pip3 install -e .
(venv) henrikroseno@MBPtilhdeHenrik kivy-ios % cd ..
(venv) henrikroseno@MBPtilhdeHenrik ~ % toolchain build python3 kivy
Then the build worked, although it took several hours.
Before creating the below example Xcode project, I updated kivy-ios with the following commands in Terminal on MacOS:
henrikroseno@MBPtilhdeHenrik ~ % . venv/bin/activate
(venv) henrikroseno@MBPtilhdeHenrik ~ % cd kivy-ios
(venv) henrikroseno@MBPtilhdeHenrik kivy-ios % git pull origin master
remote: Enumerating objects: 6, done.
remote: Counting objects: 100% (6/6), done.
remote: Compressing objects: 100% (5/5), done.
remote: Total 6 (delta 1), reused 5 (delta 1), pack-reused 0 (from 0)
Unpacking objects: 100% (6/6), 2.92 KiB | 272.00 KiB/s, done.
From https://github.com/kivy/kivy-ios
09ec398..1a8d21a master -> origin/master
Updating 09ec398..1a8d21a
Fast-forward
.github/workflows/pypi-release.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(venv) henrikroseno@MBPtilhdeHenrik kivy-ios % pip3 uninstall kivy-ios
(venv) henrikroseno@MBPtilhdeHenrik kivy-ios % pip3 install -e .
(venv) henrikroseno@MBPtilhdeHenrik kivy-ios % cd ..
(venv) henrikroseno@MBPtilhdeHenrik ~ % toolchain build python3 kivy
Now the build finished in seconds, so I am not sure if anything was actually updated(?)
Versions
Describe the bug
I get this error message when the user presses an URL in an RST-document, trying to open a webbrowser to show the webpage, in a Python-Kivy app on an iPhone running iOS 18.1.1:
BUG IN CLIENT OF UIKIT: The caller of UIApplication.openURL(:) needs to migrate to the non-deprecated UIApplication.open(:options:completionHandler:). Force returning false (NO).
To Reproduce
Here is a minimal runnable example 'main.py' that activates the bug when the user presses the URL in the RST-document:
The Xcode project was created with the 'toolchain create' command.
Expected behavior
I expected a webbrowser to open and show the content at the URL. That's what happens on Ubuntu 20.04 and Android 8.1.0.
Logs
Xcode log output from running the RST-URL webbrowser Kivy app error 'main.py' above:
Screenshots
Not relevant.
Additional context
RST-documents need the docutils module, which I installed with:
(venv) henrikroseno@MBPtilhdeHenrik ~ % toolchain pip install docutils
ChatGPT suggests this change to the Kivy-ios project:
(ChatGPT refers to 'ios.pyx', because I had mentioned https://github.com/kivy/kivy-ios/blob/master/kivy_ios/recipes/ios/src/ios.pyx .)
Implement a Custom iOS URL Opener
If the issue persists and the library hasn’t been updated, you can create a custom function in the ios.pyx file or in your app's code to use the modern API. Here’s an example of how you might update the open_url function:
Example Update to ios.pyx
After modifying this file, rebuild the kivy-ios project.
I look forward to hear from you guys.
The text was updated successfully, but these errors were encountered: