Hello,
I am trying to implement a basic (as a starter) notification for iOS with pyobjus. Here follows a part of the code used (direct copy/paste from pyobjus examples):
******************************************************************************************************
from pyobjus import autoclass, objc_str
from pyobjus.dylib_manager import load_framework, INCLUDE
class PXPApp(App):
def build(self):
... some code, defining ttl and msg as strings
print 'trying to make notification:'
print ' - title: ', ttl
print ' - message: ', msg
load_framework(INCLUDE.AppKit)
# get both nsalert and nsstring class
NSAlert = autoclass('NSAlert')
NSString = autoclass('NSString')
ns = lambda x: NSString.alloc().initWithUTF8String_(x)
alert = NSAlert.alloc().init()
alert.setMessageText_(ns('Hello world from python!'))
alert.addButtonWithTitle_(NSString.stringWithUTF8String_("OK"))
alert.addButtonWithTitle_(NSString.stringWithUTF8String_("Cancel"))
alert.runModal()
******************************************************************************************************
I can't have the notification system work on simulator (for example iPhone 5) with the following error:
******************************************************************************************************
2016-10-16 17:05:59.436178 pxpapp[961:14455] bundleid: org.kivy.pxpapp, enable_level: 0, persist_level: 0, propagate_with_activity: 0
2016-10-16 17:05:59.437701 pxpapp[961:14455] subsystem: com.apple.siri, category: Intents, enable_level: 1, persist_level: 1, default_ttl: 0, info_ttl: 0, debug_ttl: 0, generate_symptoms: 0, enable_oversize: 0, privacy_setting: 0, enable_private_data: 0
2016-10-16 17:05:59.461328 pxpapp[961:14565] subsystem: com.apple.UIKit, category: HIDEventFiltered, enable_level: 0, persist_level: 0, default_ttl: 0, info_ttl: 0, debug_ttl: 0, generate_symptoms: 0, enable_oversize: 1, privacy_setting: 2, enable_private_data: 0
2016-10-16 17:05:59.461937 pxpapp[961:14565] subsystem: com.apple.UIKit, category: HIDEventIncoming, enable_level: 0, persist_level: 0, default_ttl: 0, info_ttl: 0, debug_ttl: 0, generate_symptoms: 0, enable_oversize: 1, privacy_setting: 2, enable_private_data: 0
2016-10-16 17:05:59.476821 pxpapp[961:14562] subsystem: com.apple.BaseBoard, category: MachPort, enable_level: 1, persist_level: 0, default_ttl: 0, info_ttl: 0, debug_ttl: 0, generate_symptoms: 0, enable_oversize: 0, privacy_setting: 0, enable_private_data: 0
2016-10-16 17:05:59.631613 pxpapp[961:14455] subsystem: com.apple.UIKit, category: StatusBar, enable_level: 0, persist_level: 0, default_ttl: 0, info_ttl: 0, debug_ttl: 0, generate_symptoms: 0, enable_oversize: 1, privacy_setting: 2, enable_private_data: 0
2016-10-16 17:05:59.636345 pxpapp[961:14455] subsystem: com.apple.BackBoardServices.fence, category: App, enable_level: 1, persist_level: 0, default_ttl: 0, info_ttl: 0, debug_ttl: 0, generate_symptoms: 0, enable_oversize: 0, privacy_setting: 0, enable_private_data: 0
2016-10-16 17:05:59.741191 pxpapp[961:14455] subsystem: com.apple.BackBoardServices.fence, category: Workspace, enable_level: 1, persist_level: 0, default_ttl: 0, info_ttl: 0, debug_ttl: 0, generate_symptoms: 0, enable_oversize: 0, privacy_setting: 0, enable_private_data: 0
2016-10-16 17:05:59.742 pxpapp[961:14455] Available orientation: KIVY_ORIENTATION=LandscapeLeft LandscapeRight Portrait PortraitUpsideDown
2016-10-16 17:05:59.742 pxpapp[961:14455] PythonHome is: /Users/tjmaxgov/Library/Developer/CoreSimulator/Devices/A7D8BD7F-C487-4842-A57E-82A078CFFEB2/data/Containers/Bundle/Application/3519EE6C-506C-4D97-BBD7-C2295620A511/
pxpapp.app2016-10-16 17:05:59.743 pxpapp[961:14455] Initializing python
2016-10-16 17:05:59.804 pxpapp[961:14455] Running main.pyo: /Users/tjmaxgov/Library/Developer/CoreSimulator/Devices/A7D8BD7F-C487-4842-A57E-82A078CFFEB2/data/Containers/Bundle/Application/3519EE6C-506C-4D97-BBD7-C2295620A511/
pxpapp.app/YourApp/main.pyoGot dlopen error on Foundation2016-10-16 17:06:00.300 pxpapp[961:14455] Error loading /System/Library/Frameworks/AppKit.framework/AppKit: dlopen(/System/Library/Frameworks/AppKit.framework/AppKit, 265): no suitable image found. Did find: /System/Library/Frameworks/AppKit.framework/AppKit: mach-o, but not built for iOS simulator2016-10-16 17:06:00.302 pxpapp[961:14455] Application quit abnormally!
2016-10-16 17:06:00.316 pxpapp[961:14455] Leaving
******************************************************************************************************
Same goes if I try on a real device (iOS 9.3.5 iPhone 4):
******************************************************************************************************
2016-10-16 16:52:55.457 pxpapp[321:25807] Available orientation: KIVY_ORIENTATION=LandscapeLeft LandscapeRight Portrait PortraitUpsideDown
2016-10-16 16:52:55.475 pxpapp[321:25807] PythonHome is: /var/containers/Bundle/Application/C4C93379-B05B-4260-887A-B18F2B6AFAA9/
pxpapp.app2016-10-16 16:52:55.485 pxpapp[321:25807] Initializing python
2016-10-16 16:52:55.983 pxpapp[321:25807] Running main.pyo: /var/containers/Bundle/Application/C4C93379-B05B-4260-887A-B18F2B6AFAA9/
pxpapp.app/YourApp/main.pyo[INFO ] [Kivy ] v1.9.1
[INFO ] [Python ] v2.7.1 (r271:86832, Oct 11 2016, 14:31:22)
[GCC 4.2.1 Compatible Apple LLVM 7.3.0 (clang-703.0.31)]
[INFO ] [Factory ] 179 symbols loaded
[INFO ] [Image ] Providers: img_imageio, img_tex (img_dds, img_sdl2, img_ffpyplayer, img_pil, img_gif ignored)
Got dlopen error on Foundation[INFO ] [Text ] Provider: sdl2
[INFO ] [OSC ] using <thread> for socket
[INFO ] [Window ] Provider: sdl2
[INFO ] [GL ] OpenGL version <OpenGL ES 2.0 IMGSGX543-124.1>
[INFO ] [GL ] OpenGL vendor <Imagination Technologies>
[INFO ] [GL ] OpenGL renderer <PowerVR SGX 543>
[INFO ] [GL ] OpenGL parsed version: 2, 0
[INFO ] [GL ] Shading version <OpenGL ES GLSL ES 1.00>
[INFO ] [GL ] Texture max size <4096>
[INFO ] [GL ] Texture max units <8>
[INFO ] [Window ] auto add sdl2 input provider
[INFO ] [Window ] virtual keyboard not allowed, single mode, not docked
trying to make notification:
- title: title
- message: last notif: 1476615859.02
Traceback (most recent call last):
File "/Users/tjmaxgov/Desktop/kivy-ios/pxpapp-ios/YourApp/main.py", line 851, in <module>
File "/Users/tjmaxgov/Desktop/kivy-ios/build/kivy/i386/kivy-1.9.1/iosbuild/lib/python2.7/site-packages/kivy/app.py", line 802, in run
File "/Users/tjmaxgov/Desktop/kivy-ios/pxpapp-ios/YourApp/main.py", line 822, in build
File "/Users/tjmaxgov/Desktop/kivy-ios/build/pyobjus/i386/pyobjus-master/iosbuild/lib/python2.7/site-packages/pyobjus/dylib_manager.py", line 190, in load_framework
pyobjus.pyobjus.ObjcException: Error while loading /System/Library/Frameworks/AppKit.framework framework2016-10-16 16:52:59.162 pxpapp[321:25807] Application quit abnormally!
2016-10-16 16:52:59.257 pxpapp[321:25807] Leaving
******************************************************************************************************
I found similar topics but they never had an answer. It is highly possible my installation is not well done, here is what I have:
- xcode 8.0 (but the same error came with 7.2) with command line tools
- kivy-ios built with kivy, plyer, pyobjus
I do manage to build the simplest example:
******************************************************************************************************
NSString = autoclass('NSString')
text = NSString.alloc().initWithUTF8String_('Hello world')
print text.UTF8String()
******************************************************************************************************
So I think my setup is alright, but I won't manage to load AppKit..
Any idea ? If you need more information I can bring it (like pip list, or toolchain status...)
Thanks,
Pierre