Hi Pythonistaers!
I have a problem with a discrepancy between the xCode template and Pythonista 1.6 betaversions of an app, resulting in different code paths depending on if it's run from within the Pythonista app or it's own app /in an xCode simulator. (xCode simulator and self-contained app have the same results. Pythonista scripts don’t, but they behave as expected.)
~~the specific piece of code where the divergence takes place is in the try-except fork below. Pythonista-launched app succeeds the try clause. xCode/self-contained-app fails and excepts.
Based on the piece of code where this divergence happens, and error logs, I believe this has to do with the way location services work.~~
ourActualLocation = []
print "..."
location.start_updates()
print "...."
thisLoc = location.get_location()
print thisLoc
print "....."
try:
#works w/pythonista launched app
thisLon = thisLoc["longitude"]
thisLat = thisLoc["latitude"]
except:
#excepts with simulator and app bundle
print "gps module offline...using napa coordinates fallback..."
thisLon = -125.3353
thisLat = 39.3101
print "......"
ourActualLocation = [thisLat,thisLon]
print "......."
location.stop_updates()
#addressStart = #[39.2960,-125.2830]
addressEnd = [39.3101,-125.3353]#getCoor
Here is part of an error log:
Oct 29 21:26:24 syht8387235u locationd[3928]: ERROR: com.mycompany.PythonistaFiveStars is depending on legacy on-demand authorization, which is not supported for new apps
Oct 29 21:26:54 --- last message repeated 1 time ---
Oct 29 21:26:54 syht8387235u assertiond[3929]: assertion failed: 15B42 13B134: assertiond + 13207 [F9316174-60A2-3CA9-A8AD-49680DCA196D]: 0x1
Oct 29 21:27:26 syht8387235u assertiond[3929]: assertion failed: 15B42 13B134: assertiond + 13207 [F9316174-60A2-3CA9-A8AD-49680DCA196D]: 0x1
Oct 29 21:27:52 --- last message repeated 7 times ---
Oct 29 21:27:52 syht8387235u PythonistaFiveStars[3976]: -canOpenURL: failed for URL: "launch://" - error: "This app is not allowed to query for scheme launch"
Oct 29 21:30:58 syht8387235u routined[3913]: CoreLocation: Error occurred while trying to retrieve motion state update: CMErrorDomain Code:104
~~Also, another error: The template/app bundle can’t load piano sounds included in the sound module.~~ [SOLVED - see below]
Error Log:
2015-10-30 02:16:00.923 PythonistaFiveStars[2373:100188] OAL Error: -[OALSimpleAudio internalPreloadEffect:reduceToMono:]: Could not load effect Piano_C.caf
2015-10-30 02:16:01.227 PythonistaFiveStars[2373:100188] OAL Error: -[OALSimpleAudio internalPreloadEffect:reduceToMono:]: Could not load effect Piano_3.caf
Message from debugger: Terminated due to signal 15
So, in summary, the issues with the Template seem to be:
~~1.) location updates are different, something about "legacy" permissions?~~ [SOLVED]
A: Create NSLocationWhenInUseUsageDescription or NSLocationAlwaysUsageDescription
item in your info.plist, and choose the text description to show people in settings location pane.
surprisingly, correct me if I'm wrong, a dialogue only seems to pop up with NSLocationAlwaysUsageDescription
~~2.) access to sounds in the sound module~~ [SOLVED]
A: never mind - personal code bug.
~~3.) While the script is running from within pythonista, it's able to remain in the background at least for a while. The self-contained app version does not stay open in the background AT ALL.~~ [SOLVED]
A: change "application does not run in the background" to NO in plist file.
4.) Out bound Webbrowser:// links to other apps don't seem to work.
I should probably include:
iPhone 6S plus / xCode-Beta.app v7.1 / iOS 9.1 / Pythonista 1.6 latest Beta (160035) / latest Pythonista template that I'm aware of.
I'm going to use this thread as an ongoing exploration of issues with using the whole of the Pythonista development environment.