• coltonboyd

    @cvp it’s all good. Your code gave me a good starting place and led me to the code I got so thank you!

    posted in Pythonista read more
  • coltonboyd

    For anybody following this thread I figured how to present SFSafariViewController from an already presented view:

    #######################################################################
    
    # Necessary imports. 
    from objc_util import *
    
    #######################################################################
    
    class WebView():
      @on_main_thread
      def __init__(self,url,uiview,bar_tint_color,control_tint_color):
        self.safari_view_controller = ObjCClass("SFSafariViewController").alloc().initWithURL_(nsurl(url))
        self.safari_view_controller.preferredBarTintColor = bar_tint_color
        self.safari_view_controller.preferredControlTintColor = control_tint_color
        self.view_controller = ObjCClass('UIViewController').viewControllerForView_(ObjCInstance(uiview))
    
      @on_main_thread  
      def present(self):
        self.view_controller.presentViewController_animated_completion_(self.safari_view_controller,True,None)

    posted in Pythonista read more
  • coltonboyd

    Also to add, I added the code above to a blank main.py file in a blank Xcode project and it worked just fine. I think it has something to do with the App ui.View that I am presenting.

    posted in Pythonista read more
  • coltonboyd

    @cvp to clarify I am attempting to run this is the most current Xcode Template. Your code is good starting place but when I tried it was just a blank white screen. The code I am trying to incorporate is:

    from objc_util import *
    
    SFSafariViewController = ObjCClass('SFSafariViewController')
    
    @on_main_thread
    def open_in_safari_vc(url, tint_color=None):
        vc = SFSafariViewController.alloc().initWithURL_(nsurl(url))
        if tint_color is not None:
            vc.view().tintColor = tint_color
        app = UIApplication.sharedApplication()
        root_vc = app.keyWindow().rootViewController()
        root_vc.presentViewController_animated_completion_(vc, True, None)
        vc.release()
    
    open_in_safari_vc('http://apple.com', UIColor.orangeColor())
    

    Basically I have an ui.View called App that is presented from the point of where the iOS app starts. When clicking on a button view on this App class I want it to open a SFSafariViewController with the designated url given to the open_in_safari_vc function.

    When I attempt this in the Xcode Template I get this error:

    [Presentation] Attempt to present <SFSafariViewController: 0x7fbfa7a98000> on <PYAViewController: 0x7fbfa4408e80> (from <PYAViewController: 0x7fbfa4408e80>) whose view is not in the window hierarchy.

    I hope this clarifies what I'm trying to do.

    posted in Pythonista read more
  • coltonboyd

    I was wondering if any of you that are good with objc_util could help me out.

    I would like to present a SFSafariViewController as a ui.View from a ui.View that is already presented.

    Or be able to add SFSafariViewController as a subview for the already presented view.

    Thx in advance.

    posted in Pythonista read more
  • coltonboyd

    Sooo update on this issue. I moved all my external code for google sheet & Twilio messaging into the script file thinking that would solve the issue.

    And it didn’t, same error with the same naming convention. All the modules that I need have a lot of init.py files so I wonder if Apple doesn’t allow files with that name specifically or what.

    So as a test I took out those files and just tried to upload my Pythonista code and it worked flawlessly. At least I pinpointed exactly what files are causing this error, but it’s sad because those modules are important for the functionality of my app.

    posted in Pythonista read more
  • coltonboyd

    @JonB this might be some of my own doing. I wanted to add google sheet api and Twilio messaging support in my app.
    I added those files into the site packages and performed the ‘import Pythonista’ trick to all files so that no singing issues would occur.

    Since these files were apart of the original template, these files my need to exist in the Script folder of the template.

    I’m pretty sure when I make this switch everything should be fine.

    posted in Pythonista read more
  • coltonboyd

    Hello all,
    A few months ago I got a Pythonista 3 App Template to work and uploaded my game to the App Store successfully. Since then I've tried to post another app to the App Store. I get past the validation stage and upload stage just fine but then a few minutes later apple hits me with this error:

    ITMS-90048: This bundle is invalid - Your archive contains paths that are not allowed: ('init.py')

    Has anybody that has downloaded my app template had this problem? Any help would awesome. Thx

    posted in Pythonista read more

Internal error.

Oops! Looks like something went wrong!