omz:forum

    • Register
    • Login
    • Search
    • Recent
    • Popular

    Welcome!

    This is the community forum for my apps Pythonista and Editorial.

    For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.


    New Xcode Template on GitHub

    Pythonista
    14
    38
    30963
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • mrcoxall
      mrcoxall last edited by

      Even works with the new Scene module.
      Thanks so much.

      1 Reply Last reply Reply Quote 1
      • bortels126
        bortels126 last edited by

        Hey. I just wanted to stop by and say thank you for this. I consider it above and beyond, and the thorough instructions in the readme are very much appreciated. Time to go play with it.

        1 Reply Last reply Reply Quote 1
        • Tizzy
          Tizzy last edited by

          @omz I'm adding my sincere thanks here as well. I've been making extensive use of the old one and chiming in about a desire for this here and there. This is seriously empowering stuff.

          By the way, I listen to "Accidental Tech Podcast" (atp.fm) live, and there's a "tipster" from Apple that answers questions in their irc chat after the live shows - I mentioned pythonista and the fact that you can make iOS apps from iOS with it and asked if people were generally aware of it and how people inside apple felt about it. He said they were very aware, and highly impressed.

          1 Reply Last reply Reply Quote 0
          • Tizzy
            Tizzy last edited by Tizzy

            One question - is there a way to programmatically access the version number / build number from within python?

            UPDATE: @omz thanks!!

            1 Reply Last reply Reply Quote 0
            • omz
              omz last edited by

              @Tizzy

              from objc_util import NSBundle
              
              info = NSBundle.mainBundle().infoDictionary()
              version = str(info['CFBundleVersion'])
              short_version = str(info['CFBundleShortVersionString'])
              
              1 Reply Last reply Reply Quote 1
              • Tizzy
                Tizzy last edited by Tizzy

                Another question:

                In the previous template I figured out that I could change the name of my main python file by searching for "main.py" and then changing it to whatever script I want to run.
                in PAAppDelegate.m

                NSString *mainScriptFile = [writableScriptDirectory stringByAppendingPathComponent:@"main.py"];
                
                

                Is there any reason this would cause any problems or is not advisable?

                UPDATE: thanks @omz

                1 Reply Last reply Reply Quote 1
                • omz
                  omz last edited by

                  @Tizzy You can change that if you like.

                  1 Reply Last reply Reply Quote 1
                  • Doglike-spike
                    Doglike-spike last edited by

                    Just tested it out and it almost works flawlessly, there were a few issues with indents, but nothing large. Being new to the world of programming, I was just wondering how exactly this work. Does the XcodeTemplate translate the Python language into Objective C, or does the Iphone actually support Python?

                    Webmaster4o 1 Reply Last reply Reply Quote 0
                    • Webmaster4o
                      Webmaster4o @Doglike-spike last edited by

                      @Doglike-spike I think he basically rewrote parts of the Python language, in order for it to work on iOS. I'm not sure though.

                      1 Reply Last reply Reply Quote 1
                      • dgelessus
                        dgelessus last edited by

                        Python (at least the main implementation, CPython) is written in C, and Objective-C is a superset of C, which means that C code should compile as Objective-C without modification. The iOS/Pythonista-specific modules like console, ui, location, etc. are custom extension modules written by omz, they are not available outside Pythonista.

                        1 Reply Last reply Reply Quote 1
                        • Tizzy
                          Tizzy last edited by

                          @omz is it a shared codebase such that we can expect the template to always be up to date with the latest release version of pythonista?

                          1 Reply Last reply Reply Quote 0
                          • omz
                            omz last edited by

                            @Tizzy Yes, the template is basically a subset of the main app. It would actually be possible to take the PythonistaKit framework out of the App Store version, and build your own template with it (I think @stroughtonsmith has actually done that).

                            1 Reply Last reply Reply Quote 0
                            • tomkirn
                              tomkirn last edited by

                              Is there a way to access the 'normal' documents folder of the app from within (for accessing via iTunes file share after allowing in info.plist)? The 'normal' documents folder of Pythonista seems to be in an appgroup now.

                              os.path.expanduser('~/Documents') now results in '/private/var/mobile/Containers/Shared/AppGroup/E57F167E-F2F0-488A-A406-C6523F6F01DB/Documents' which is not accessable via iTunes fileshare.

                              1 Reply Last reply Reply Quote 0
                              • dgelessus
                                dgelessus last edited by

                                No idea about iTunes, but what I use is a program called iExplorer. It allows you to read some files from a connected iOS device, but more importantly you can browse local backups, which also include the AppGroup folder.

                                Webmaster4o 1 Reply Last reply Reply Quote 1
                                • Webmaster4o
                                  Webmaster4o @dgelessus last edited by Webmaster4o

                                  @dgelessus IOS 8.3 (maybe 8.4, can't remember) made this a lot less useful. Now the app sandbox is not accessible through apps like iExplorer and iFunBox without jailbreak. This means no more going through apps and changing files, nor transferring files that represent game progress between devices.

                                  1 Reply Last reply Reply Quote 1
                                  • chriswilson
                                    chriswilson last edited by

                                    @omz
                                    I'm clearly a bit behind, but I got the template to work - thanks!

                                    One thing - I used pickle to store config data in a .dat file. This seems to work while the app is running, but if the app is closed and restarted completely, the config data is reset rather than storing the previous state. Is there a way around this?

                                    1 Reply Last reply Reply Quote 0
                                    • Tizzy
                                      Tizzy last edited by

                                      @chriswilson if you're talking about "running the app" and you mean running it in the Xcode simulator, there won't necessarily be persistent data between sessions because it creates a "virtual" directory where any file modifications in your code are executed, so when you close the simulator's virtual environment, your original files remain intact.

                                      If that's not what you meant, ignore and wait for @omz or someone else to respond,

                                      1 Reply Last reply Reply Quote 0
                                      • chriswilson
                                        chriswilson last edited by

                                        Thanks for your reply @Tizzy
                                        I'm running it on my own phone rather than in the simulator, but as it's in development the same principle might apply I guess.

                                        Tizzy 1 Reply Last reply Reply Quote 0
                                        • Tizzy
                                          Tizzy @chriswilson last edited by

                                          @chriswilson in that case, the data should stay persistent between runs of the same build, if you build and install it again, that's not the case. As far as I know you can't count on the data to persist between builds. For example -> build, create file, build, check if file has been created (returns FALSE - it won't exist).

                                          1 Reply Last reply Reply Quote 1
                                          • chriswilson
                                            chriswilson last edited by

                                            @Tizzy
                                            Unfortunately it's not saving and recalling the info even between runs of the same build.

                                            1 Reply Last reply Reply Quote 0
                                            • First post
                                              Last post
                                            Powered by NodeBB Forums | Contributors