Post

Replies

Boosts

Views

Activity

multiprocessing.Queue() python method sandbox problem
multiprocessing.Queue() method of python getting "PermissionError: [Errno 1] Operation not permitted" error if it is sandboxed: CODE: import multiprocessing tensorflow_coordinates_queue = multiprocessing.Queue() ERROR: ./test_temp9 Traceback (most recent call last): File "/Applications/test_temp9.app/Contents/MacOS/test_temp9.py", line 4, in <module> File "/Applications/test_temp9.app/Contents/MacOS/multiprocessing/context.py", line 103, in Queue File "/Applications/test_temp9.app/Contents/MacOS/multiprocessing/queues.py", line 43, in __init__ File "/Applications/test_temp9.app/Contents/MacOS/multiprocessing/context.py", line 68, in Lock File "/Applications/test_temp9.app/Contents/MacOS/multiprocessing/synchronize.py", line 162, in __init__ File "/Applications/test_temp9.app/Contents/MacOS/multiprocessing/synchronize.py", line 57, in __init__ PermissionError: [Errno 1] Operation not permitted BUNDELED WITH NUITKA: echo *** | sudo -S python3.9 -m nuitka --run --standalone --macos-disable-console --macos-create-app-bundle --macos-app-mode=ui-element --enable-plugin=pyside6 --macos-app-icon=icons/app_icon.png --include-data-dir=icons=icons test_temp9.py SIGNED WITH FOLLOWING SH: sign.txt sign2.txt ENTITLEMENTS: app.entitlements.txt
2
0
431
Aug ’24
python "import foundation" crushes if the app is codesigned
Hi, python "import foundation" crushes without error message (but with a macos crush report) if the app is codesigned with Developer ID Application Certificate.(Without codesign, it works fine.) 1-test_simple_foundation.py(already attached): import socket import Foundation print("hallo") 2-Install Nuitka: pip install Nuitka 3-Generate App File via Nuitka: echo *** | sudo -S python3.9 -m nuitka --run --standalone --macos-create-app-bundle --macos-app-mode=ui-element --macos-app-icon=icons/app_icon.png --include-data-dir=icons=icons test_simple_foundation.py 4-Copy app file under /applications 5-Execute test_simple_foundation.app file from terminal ./Applications/test_simple_foundation.app/Contents/MacOS/test_simple_foundation and observer that "hallo" is printed out 6-Codesign with following sh file(already attached): 7-Execute test_simple_foundation.app file from terminal ./Applications/test_simple_foundation.app/Contents/MacOS/test_simple_foundation and observer that code freezes with a macos crush report(already attached), after import Foundation nothing printed out. MacOS_crush_report.txt build-app_no_sand-sh.txt test_simple_foundation-py.txt pip list freeze.txt app.entitlements.txt Requirement: python3.9 -m nuitka --version 1.9rc5 Commercial: None Python: 3.9.12 (v3.9.12:b28265d7e6, Mar 23 2022, 18:22:40) Flavor: CPython Official Executable: /Library/Frameworks/Python.framework/Versions/3.9/bin/python3.9 OS: Darwin Arch: x86_64 Version C compiler: /usr/bin/clang (clang). MacOS: Sonoma 14.2.1 1,6 GHz Dual-Core Intel Core i5 8 GB 2133 MHz LPDDR3
2
0
579
Jul ’24
xcrun notarytool store-credentials -> HTTP status code: 401. Invalid credentials error
Hi, I am getting following error from following command, although I am 100% sure that I am entering the right credentials: Command: xcrun notarytool store-credentials "MY_PROFILE" --apple-id “***” --team-id "yyy" --password "zzz" Error: Error: HTTP status code: 401. Invalid credentials. Username or password is incorrect. Use the app-specific password generated at appleid.apple.com. Ensure that all authentication arguments are correct. ***->https://appleid.apple.com/account/manage/email and phone number -> apple id email (email address used for developer account) yyy->https://developer.apple.com/account#MembershipDetailsCard/Team ID -> 10 digit nummer zzz->https://appleid.apple.com/account/manage/App-Specific Passwords created and used I just copy pasted every single item from the defined locations above. I would appreciate for an answer. Best Regards
2
0
771
Jul ’24
Developer ID certificate missing private key
Hi, I created a developer id certification from my apple developer account a couple of year ago and downloaded it as .cer file into my Laptop. Now I want to use this certificate to sign my application, but unfortunately Xcode shows an error message like 'Missing Private Key" and I can also see that there is no private key under my developer id certificate(there is no grey arrow to expand to see private cer) in keychain access. Moreover my developer account is expired and I do not want to extend it yet so unfortunately no solutions with apple developer account will work like creating a new certification etc. Do you have any other solutions like using Keychain Access or Xcode to link my private key again into my developer id certificate? Note: 1-.cer file was created on my laptop by me, which I am using now. So I would expected that the related private key should already exist in my Keychain Access(if I did not delete it mistakenly.) but I do not know which private key is the relevant one, I have several of them. 2-I have also a CertificateSigningRequest.certSigningRequest file which was copied near my .cer file. Maybe it could be useful for a solution? 3-No! unfortunately I do not have any .p12 file. 4-I had already installed current AppleWWDRCAG3 file before I import my .cer file into my Keychain Access Tool. 5-Get Info shows that my cer file is still valid till sep 2025. 6- I have already restarted my Xcode and laptop. 7-I tried all solutions here: https://stackoverflow.com/questions/12867878/missing-private-key-in-the-distribution-certificate-on-keychain 8-https://developer.apple.com/account/resources/ shows me no certificate with the reason that my membership expired 9-I removed and re-added my apple account into Xcode. the same error occurred. XCODE:Version 15.3 (15E204a) OSX:macOS Sonoma 14.2.1 Thanks a lot in advance.
1
0
1.5k
Mar ’24
launchctl fails with "Bootstrap failed: 5: Input/output error", if the app is signed with sandbox
I am implementing parental control app via python 3.9 for macOS. Therefore I want to use launch agent to keep my application always alive (app reopened automatically after reboot pc and protected against to be closed via activity monitor.) I want to give keep alive enabling and disabling option to parents that they can deactivate or activate it in the app GUI. I achieved to keep alive my app standalone signed app without sandboxing(or via Terminal command) but if I sign it with sandbox then I get following error for "launchctl load" and "launchctl bootstrap" commands which are executed in the application "Load failed: 5: Input/output error" My steps without Sandbox which works fine: 1- Create a com.test_gui.macos.plist file under /Library/LaunchAgents with following content: `<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>KeepAlive</key> <true/> <key>Label</key> <string>test_gui</string> <key>ProgramArguments</key> <array> <string>open</string> <string>-g</string> <string>-a</string> <string>/Applications/test_gui.app</string> </array> </dict> </plist>` 2- create a python file for launch agent activation (I know either launchctl load or bootstrap should be used but I used both of them to test both.): import subprocess cmd = "launchctl enable gui/501/test_gui" response = subprocess.call(cmd, shell=True) time.sleep(2) cmd = "launchctl load -w /Library/LaunchAgents/com.test_gui.macos.plist" response = subprocess.call(cmd, shell=True) time.sleep(2) cmd = "launchctl bootstrap system /Library/LaunchAgents/com.test_gui.macos.plist" response = subprocess.call(cmd, shell=True) time.sleep(50) 3- Create standalone app via nutika: python3.9 -m nuitka --run --standalone --macos-disable-console --macos-create-app-bundle \--macos-app-mode=ui-element --enable-plugin=pyside6 --macos-app-icon=/Users/emre/Documents/MrProtect/icons/app_icon.png \--include-data-dir=icons=icons test_gui.py 4-Create a .sh file to sign app without sandboxing: #!/bin/sh APP_PATH="/Users/emre/Documents/tests/Deployment/test_gui.app" SIGNING_IDENTITY_APP="Apple Development: Emre Guenay (***)" PASSWORD="***" codesign -s "$SIGNING_IDENTITY_APP" -f \ "$APP_PATH/Contents/MacOS/Python" codesign -s "$SIGNING_IDENTITY_APP" -f \ "$APP_PATH/Contents/MacOS/test_gui" exit 0 5-execute sh file and see following output: /Users/emre/Documents/MrProtect/tests/Deployment/test_gui.app/Contents/MacOS/Python: replacing existing signature /Users/emre/Documents/MrProtect/tests/Deployment/test_gui.app/Contents/MacOS/test_gui: replacing existing signature 6-copy paste signed standalone app(without sandbox) file under /Applications/ 7-execute app and try to close app via activity monitor and observe that the app is reopened automatically. so the launch agent works fine Failed Steps(Sign the same app with sandbox and observe that both launchctl load and bootstrap returns "Load failed: 5: Input/output error") 8- create an app.entitlements file with following content: \<?xml version="1.0" encoding="UTF-8"?\> \<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"\> \<plist version="1.0"\> \<dict\> \<key\>com.apple.security.app-sandbox\</key\> \<true/\> \</dict\> \</plist\> 9-Create a .sh file to sign app with sandboxing: #!/bin/sh # APP_PATH="/Users/emre/Documents/tests/Deployment/test_gui.app" SIGNING_IDENTITY_APP="Apple Development: Emre Guenay (***)" PASSWORD="***" codesign -s "$SIGNING_IDENTITY_APP" -f \ \--entitlements app.entitlements \ "$APP_PATH/Contents/MacOS/Python" codesign -s "$SIGNING_IDENTITY_APP" -f \ \--entitlements app.entitlements \ "$APP_PATH/Contents/MacOS/test_gui" exit 0 10-execute sh file and see following output: /Users/emre/Documents/MrProtect/tests/Deployment/test_gui.app/Contents/MacOS/Python: replacing existing signature /Users/emre/Documents/MrProtect/tests/Deployment/test_gui.app/Contents/MacOS/test_gui: replacing existing signature 11-execute app and try to close app via activity monitor and observe that the app is closed although app started the launch agent. 12-you can re-execute app under /Applications/test_gui.app/Contents/MacOS folder with "./test_gui" or even with sudo "sudo ./test_gui" commands you would see following error message for both launchctl load and bootstrap returns: "Load failed: 5: Input/output error". So if you close the app, it will not be re-opened Moreover console tool launchd.log output shows also (1: Operation not permitted) error for launchctl load and bootstrap commands My questions: 1-Is there any other method different than launch agent for keep alive? I researched it in internet but I could not find any other method unfortunately. Moreover launch agent is not user friendly anyway, with the reason that sandboxed apps cannot copy paste any files under LaunchAgents folder automatically. I am planning to provide my plist file to users that they can copy paste the file themself into launch agent folder out of sandbox. 2-How can i get rid of "Load failed: 5: Input/output error", thereby I can proceed at least with lanuchctl? What I have tried additionally: 1-I have also tried to use these linux commands, before executing my sandboxed standalone app file: sudo -S chown 600 /Library/LaunchAgents/com.test_gui.macos.plist sudo -S chown root:wheel /Library/LaunchAgents/com.test_gui.macos.plist 2-I have already given security fulldisk access to my test_gui app, but it also did not work My Requirements: Nuitka: 1.9rc5 Commercial: None Python: 3.9.12 (v3.9.12:b28265d7e6, Mar 23 2022, 18:22:40) Flavor: CPython Official Executable: /Library/Frameworks/Python.framework/Versions/3.9/bin/python3.9 OS: Darwin Arch: x86_64 Version C compiler: /usr/bin/clang (clang). macOS Sonoma: 14.2.1
1
0
2.5k
Mar ’24
How to close MacOS camera per command line(macOS Monterey)?
Hi, I cannot close Mac default camera with this command: "sudo -S killall VDCAssistant" via terminal anymore in macOS Monterey, although it was working properly with macOS Big Sur. VDCAssistant still exists in Activity monitor, but I cannot close it via command line. Even command line does not give any response(Also no error message appears), when I send my command. Additionally when I close it via Activity Monitor, It is opened again automatically. I guess the new camera responsible process became UVCAssitant, but it can also not be closed via command line, and when I close it via Activity assistant, the camera connection is lost permanently, so I have to reboot my PC to be able make it work again, and this is not what I try to achieve. Do you have any other idea to close my camera via command line? Thanks a lot in advance. Best Regards
1
0
2.8k
Jan ’22
Is it possible to open another 3 party application within the my application?
I want to implement an app which detects objects of an open application in iOS in runtime. I was planing to capture whole iPhone screen and make object detection on background but I recognised that I am not allowed to execute background tasks more than 3 minutes(which is not enough for me. I want to do it forever.) So my question is if it is possible to open another third-party applications(like YouTube, Facebook, Safari, FaceTime etc.) within the my application so I can detect object in the foreground as soon as the user let me do it? I am planing a design like this: Thanks a lot in advance.
0
0
439
Jan ’22
Method cannot be called from ViewController file into a swift file(DELEGATE)
I am totally new in swift, so if I am asking a stupid question I apologise in advance :) I want to call my "didOutput" method from ViewController in my SampleHandler swift file. Please see the attachments below for swift files,( I just kept the related code parts in the attachments) : SampleHandler.txt ViewController.txt When I am debugging, my code comes till delegate?.didOutput(pixelBuffer: imagePixelBuffer) line in SampleHandler.swift file but it does not pass to didOutput method in ViewContoller.swift file. Am I doing something wrong when I am implementing or declaring delegate classes and methods? Thanks a lot in advance. Best Regards PS: This is my folder structure, I tried to add as screenshot but it did not work. So my files are under different folders: ReplayKitExample ->project ReplayKitExample ->folder ViewController.swift BroadcastExtension->folder SampleHandler.swift
4
0
880
Jan ’22
How to get IOS device camera status(if it is on or off)
Hi, I am implementing a SwiftUI application for IOS devices and I require the IOS device camera status(if it is on or off) for my development. The only relevant info I found is, the green dot on the right corner of the screen but it is also not applicable with the reason that I can not get green dot status from my code. Could you please support me about getting camera status(On or Off) info via SwiftUI? Thanks a lot in advance. Best Regards Emre Günaydin
3
0
1.4k
Dec ’21
How to get iOS screen record data in runtime before broadcasting?
Hi, I want to use Apple Broadcast API as client but before I broadcast my iOS screen record, I want to make object detection on video data. I read ReplayKit design docs, the only relevant Instance Property is "serviceinfo:Information updated by the service during a broadcast." in  RPBroadcastController, But it does not also sound like it will provide me the required video data.  So do you have any Idea if it is possible to reach iOS screen record data in run time before broadcasting? Thanks a lot in advance. Best Regards Emre
0
0
803
Dec ’21
How to check if Apple MacBook webcam is used by any application(check if camera is on or off)
I have been searching for a bash or python (or something else)command to use in my python project, for checking if Apple MacBook webcam is used(check if camera is on or off) by any application or not. (Even I do not need the exact process id or name which use the camera) Till now I have found 2 possible options, but both of them did not work properly: 1-lsof | grep "AppleCamera", lsof | grep "iSight" or lsof | grep "VDC" commands: These commands show the process ids and names which use the camera. But the problem is that these commands show also many processes which are not exactly using the camera too. For example, in same cases even if Facetime is minimized to dock(it means that the camera is not on, in idle mode.) these commands show Facetime application as an application which is occupying the camera (although it is not). Or in same cases some applications are shown as processes which use the camera, although the camera connection of application was already closed before. 2-oversight tool: Unfortunately it does not support any command line commands, so it is not possible to use in my python project. Do you have any other recommendations to detect Apple MacBook camera status? I would be grateful for your responses. Thanks a lot in advance.
2
0
2.8k
Sep ’20
is my activity monitor energy impact and %cpu value too high?
I have been working for 5 months on a private project, which will be implemented with python for MacOS. (And also for IOS in the future) My problem is,  i have recognised that my application consumes too much energy. Activity monitor energy impact and  %cpu value move between 150-300. Even laptop fan noice increases when the application is running. My questions are: 1-If this is too harmful for laptop fans or batteries to consume so much energy. My aim is to submit my application next year in Apple Store so I do not want to damage any user’s laptops.  2-Do you know what is the average activity monitor energy impact and cpu value for computer games or applications which require also too much energy. Is it comparable with my values (150-300)? 3-would you recommend that i stop the project, with the reason of high the cpu and battery consumption?(Although I believe that there is a big market, which could be interested in my application) Note:  1-My application will be running at the background. 2-2 Options will be given to users: Either it will always be running at the background as long as the laptop is on, or it will be running in some other specific cases almost between 30 min or 1 hour per day. Thanks a lot in advance.
1
0
587
Oct ’20
Sandbox activated macOS application crashes immediately after execution
I want to submit my python based application to apple store, but whenever I activate sandboxing for my application(no matter the content of code, even just “hello world” printing crashes), It crashes in a couple of sec. with following console error after execution, Although it works fine without sandbox activation : “Sandbox: test(8409) deny(1) forbidden-sandbox-reinit” 1-Requirments: macOS Catalina 10.15.4 Python 3.6 PyInstaller 4.0 Certification:Developer ID Application Manual(without Xcode): build, signing, notarizing and sandboxing Implementing Simple Code Ex(test.py):(No matter which code content is used, all crash) test.py - https://developer.apple.com/forums/content/attachment/2dde8ab6-b76d-41a3-bf1b-baaaec7d5de9 from AppKit import NSOpenPanel from objc import YES, NO panel = NSOpenPanel.openPanel() panel.setTitle("open file") panel.setAllowsMultipleSelection(NO) panel.setCanChooseDirectories_(YES) panel.runModal() Creating test.spec: test.spec - https://developer.apple.com/forums/content/attachment/7ce93e95-5c9f-4936-b125-7507bb32d72e blockcipher = None a = Analysis(['test.py'],              pathex=['/Users/Emre/Documents/Work/models/research/objectdetection'],              binaries=[],              datas=[],              hiddenimports=[],              hookspath=[],              runtimehooks=[],              excludes=[],              winnopreferredirects=False,              winprivateassemblies=False,              cipher=blockcipher) pyz = PYZ(a.pure, a.zippeddata,              cipher=blockcipher) exe = EXE(pyz,           a.scripts,           a.binaries,           a.zipfiles,           a.datas,           name='test',           debug=False,           strip=False,           upx=True,           runtimetmpdir=None,           console=False ) app = BUNDLE(exe,              name='test.app',              icon=None,              bundle_identifier=None) Creating .App File: python3.6 -m PyInstaller -F test.spec Creating Entitlements(Entitlements.plist): Entitlements.plist - https://developer.apple.com/forums/content/attachment/d67465ae-1fd2-4ce1-a227-761446b9f232 <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-url(not allowed to be added in developer forum)"> <plist version="1.0"> <dict>     <key>com.apple.security.app-sandbox</key>     <true/> </dict> </plist> Codesiging Manually:  codesign --force --options=runtime  --sign "Developer ID Application: Emre (xxxx)” test.app --entitlements Entitlements.plist Generate dmg file via disk utility for Notarizing from test.py: Notarizing the application: xcrun altool --notarize-app --primary-bundle-id "com.emre" --username "emre@gmail.com" --password "@keychain:AppSpecPass" --file /Users/Emre/Documents/Work/models/research/objectdetection/dist/test.dmg Verification Of Certificate and sandboxing: spctl -a -t exec -vv test.app test.app: accepted source=Notarized Developer ID origin=Developer ID Application: Emre Guenaydin (93DS7PC26P) codesign --verify --deep --strict --verbose=2 test.app test.app: valid on disk test.app: satisfies its Designated Requirement codesign -dvvv --entitlements :- test.app Executable=/Users/Emre/Documents/Work/models/research/objectdetection/dist/untitled folder/test.app/Contents/MacOS/test Identifier=test Format=app bundle with Mach-O thin (x86_64) CodeDirectory v=20500 size=73712 flags=0x10000(runtime) hashes=2295+5 location=embedded Hash type=sha256 size=32 CandidateCDHash sha1=e3716fc5262107748b2658e4cbbcee97670268c1 CandidateCDHashFull sha1=e3716fc5262107748b2658e4cbbcee97670268c1 CandidateCDHash sha256=6fe01092e170231a9fdc855871ce3161b71b8af5 CandidateCDHashFull sha256=6fe01092e170231a9fdc855871ce3161b71b8af597cd78410dcea3b80092e5c0 Hash choices=sha1,sha256 CMSDigest=cf0a13051e77eba16609e67ca580b24d2698becad591a45fac911d44ddbef0b6 CMSDigestType=2 CDHash=6fe01092e170231a9fdc855871ce3161b71b8af5 Signature size=9058 Authority=Developer ID Application: Emre (***) Authority=Developer ID Certification Authority Authority=Apple Root CA Timestamp=20. Sep 2020 at 23:40:39 Info.plist entries=8 TeamIdentifier=*** Runtime Version=10.11.0 Sealed Resources version=2 rules=13 files=1 Internal requirements count=1 size=164 <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-url(not allowed to be commented in developer forum)"> <plist version="1.0"> <dict>     <key>com.apple.security.app-sandbox</key>     <true/> </dict> </plist> 10.Execute .app file: Crashes with following console report follow: default 23:45:08.671813+0200 secinitd test[8055]: AppSandbox request successful default 23:45:09.275405+0200 secinitd test[8056]: AppSandbox request successful error 23:45:09.504553+0200 sandboxd Failed to produce a full report for: test[8056]. error 23:45:09.504643+0200 sandboxd Sandbox: test(8056) deny(1) forbidden-sandbox-reinit
6
0
3.7k
Sep ’20