Comments (4)
import objc_util
from plistlib import dumps, loads
bundle_id = objc_util.ObjCClass('NSBundle').mainBundle().bundleIdentifier()
main_bundle = objc_util.ObjCClass('NSBundle').bundleWithIdentifier_(bundle_id)
info_plist_path = str(main_bundle.pathForResource_ofType_('Info', 'plist'))
with open(info_plist_path, 'rb') as f:
info_plist_data = f.read()
info_plist = loads(info_plist_data)
-->
import plistlib
import sys
from pathlib import Path
info_plist = plistlib.loads((Path(sys.executable).parent / "Info.plist").read_bytes())
from pythonista-issues.
The actual error message is:
The operation couldn’t be completed. (NSNetServicesErrorDomain error -72008.)
It looks like since iOS 14 there has been a new security requirement where multipeer (Bonjour) network usage must be declared in plist as follows:
<key>NSBonjourServices</key>
--
<array>
<string>_multipeertest._tcp</string>
</array>
… where multipeertest
should match the service key provided to the multipeer framework.
This is a problem for Pythonista, since it is only one app from Apple’s point of view, with a singular plist.
In theory, there could be a known value set in plist, which would then be used for all multipeer Pythonista scripts. To ensure that you only connect peers expected by your script, you would need to add some additional validation to filter peers by initial data.
from pythonista-issues.
Thanks for the info. With the 'help' of Chat GTP-3 I got understanding about what is required. Is the service key, that same as the server_type string in your MultipeerConnectivity class? (If so should the same restrictions eg 1-15 chars.. apply). Should a request for adding the key to the plist be made? Chat GTP-3 (with quite a bit of prompting) suggested code below to modify the plist but for me to discover that overwriting it is not permitted.
Cheers, Bill
import objc_util
from plistlib import dumps, loads
bundle_id = objc_util.ObjCClass('NSBundle').mainBundle().bundleIdentifier()
main_bundle = objc_util.ObjCClass('NSBundle').bundleWithIdentifier_(bundle_id)
info_plist_path = str(main_bundle.pathForResource_ofType_('Info', 'plist'))
with open(info_plist_path, 'rb') as f:
info_plist_data = f.read()
info_plist = loads(info_plist_data)
info_plist['NSBonjourServices'] = 'mptest-tcp'
modified_info_plist_data = dumps(info_plist)
with open(info_plist_path, 'wb') as f:
f.write(modified_info_plist_data) ## fails
from pythonista-issues.
Yes. Apple's iOS security will not allow the modification of any application's permissions except when digitally signed by the application's original author prior to Apple's review for submission into the App Store.
from pythonista-issues.
Related Issues (20)
- Japanese characters changed on paste in Editor
- Displaying modal Scene from Scene that has no children gives `max() arg is an empty sequence` error HOT 2
- Console dialogs does not appear and freeze script HOT 7
- Feature: Widget Interaction
- Please add a GitHub Discussion HOT 1
- Making apps
- See Hidden Files HOT 2
- Pythonista hangs on opening Photo Library HOT 9
- Keyboard - Haptic Feedback
- Access to OpenAI’s GPT4 not working HOT 11
- Using sound.recorder causes volume of speech.say to become very low HOT 2
- py_ssize_t_clean macro must be defined for '#' formats | Module CB HOT 1
- Folders with subfolders and submodules named the same cause import problem
- Adding folder in SD card to EXTERNAL FILES section will fail and show error
- contacts.phone not filled
- will_close() and wait_modal() not working on presented view
- Ui.get_screen_size() gets wrong resolution HOT 1
- Pythonista - graphic performance HOT 1
- Apple Family Sharing
- Pandas import HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pythonista-issues.