Titanium.Platform.canOpenURL doesn't work on IOS 10 - titanium

I am using Ti.Platform.canOpenURL() to open another app which worked fine before iOS 10.
But it doesn't work on iOS 10 and later.
How to solve this?

You use Ti.Platform.canOpenURL('<my-url>') to check for the URL. To open the URL, you need to use Ti.Platform.openURL('<my-url>') instead.

With some of the new security features of iOS9, SDK 5.1.2's canOpenUrl might fail without adding in the proper properties in the info.plist file.
Therefore, you need to add the following key into the tiapp.xml file:
<ios>
<plist>
<dict>
<key>LSApplicationQueriesSchemes</key>
<array>
<string>[Your Project Name]</string>
<string>[Your Second Project Name (if any)]</string>
</array>
</dict>
</plist>
</ios>
Hope this helps.
Cheers.

Related

codesign in Sierra: security set-key-partition-list not working

I followed this thread instructions and managed to solve the codesigning issues we had on Sierra. The thing is that after a while we installed Sierra in a new machine and now it doesn't work anymore.
Our application is a node application that forks a process where the signing happens. The strange thing is that if you launch the forked script from Terminal (in a SSH session) it works fine but if you launch the application that forks the process, it doesn't work and the codesigning fails with "code object is not signed at all".
This same application works fine also from SSH on another machine with Sierra that was updated from El Capitan. I really don't know what might be the difference between both machines for this to happen as both have the same versions of Sierra, XCode, codesign, etc but there must be something that's affecting.
Any idea of anything that could be affecting to this strange behaviour? Anything I could try?
Thank you.
Note:
Executing:
security set-key-partition-list -S apple-tool:,apple: -s -k 'password' 'keychain'
from console and then:
codesign -vfs '$IDENTITY' '${PRODUCT}' --keychain 'keychain'
works fine but when launched from inside the node app, it always fails.
For everyone out there in the same situation I've finally after much debugging and looking research that the issue had to do with the fact that we were using PM2 for the node service managemente. By default PM2 Launch Daemon plist is:
<?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>Label</key>
<string>io.keymetrics.PM2</string>
<key>UserName</key>
<string>myusername</string>
<key>ProgramArguments</key>
<array>
<string>/bin/sh</string>
<string>-c</string>
<string>/usr/local/lib/node_modules/pm2/bin/pm2 resurrect</string>
</array>
<key>RunAtLoad</key>
<true/>
<key>OnDemand</key>
<false/>
<key>LaunchOnlyOnce</key>
<true/>
<key>EnvironmentVariables</key>
<dict>
<key>PATH</key>
<string>/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/Cellar/node#5/5.12.0/bin</string>
<key>PM2_HOME</key>
<string>/Users/myusername/.pm2</string>
</dict>
<key>StandardErrorPath</key>
<string>/tmp/io.keymetrics.PM2.err</string>
<key>StandardOutPath</key>
<string>/tmp/io.keymetrics.PM2.out</string>
</dict>
</plist>
But for the process to be able to access the keychains we need to add a SessionCreate key:
<?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>Label</key>
<string>io.keymetrics.PM2</string>
<key>UserName</key>
<string>myusername</string>
<key>SessionCreate</key>
<key>ProgramArguments</key>
<array>
<string>/bin/sh</string>
<string>-c</string>
<string>/usr/local/lib/node_modules/pm2/bin/pm2 resurrect</string>
</array>
<key>RunAtLoad</key>
<true/>
<key>OnDemand</key>
<false/>
<key>LaunchOnlyOnce</key>
<true/>
<key>EnvironmentVariables</key>
<dict>
<key>PATH</key>
<string>/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/Cellar/node#5/5.12.0/bin</string>
<key>PM2_HOME</key>
<string>/Users/myusername/.pm2</string>
</dict>
<key>StandardErrorPath</key>
<string>/tmp/io.keymetrics.PM2.err</string>
<key>StandardOutPath</key>
<string>/tmp/io.keymetrics.PM2.out</string>
</dict>
</plist>
Just restart the PM2 service and now it works. For some reason that parameter was already added in old machine.
Thanks to this answer and his author joensson for leading me to the solution.

Safari extension automatic update

I'm trying to set up automatic updates on my Safari extension and it doesn't seem to be working. Here is what I have tried so far.
<?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>Extension Updates</key>
<array>
<dict>
<key>CFBundleIdentifier</key>
<string>com.COMPANY_NAME.safari.EXTENSION_NAME</string>
<key>Developer Identifier</key>
<string>MY_IDENTIFIER</string>
<key>CFBundleVersion</key>
<string>4</string>
<key>CFBundleShortVersionString</key>
<string>4</string>
<key>URL</key>
<string>PATH_TO_EXTENSION_DOWNLOAD</string>
</dict>
</array>
</dict>
</plist>
From my understanding whenever someone who has downloaded the extension opens Safari with my extension installed it will ping the "Update Manifest URL" set in the extension builder. If the versions do not match the extension at the download URL then an update will be made.
The .plist file is on my server and the extension is being served from the server with the "Update Manifest URL" set correctly. I can download the extension from my website but when I upload a new extension version and update the plist file I'm not getting prompted to update my extension in Safari > preferences > extensions.
Is there anything potentially missing in what I've been doing?
Try setting the date on your computer a day or to into the future. I think Safari only checks for updates once a day. Or did you already solve this?
I would try hitting your 'Update Manifest' URL directly and ensure that the file it's calling is indeed a greater version than the current extension you have. If that checks out fine then your current version of the extension might not have an update manifest URL set so your update file isn't being called at all!
In this case you need to either figure out what update manifest URL the current version is pointing at and upload your update.plist file there and continuously do that upon every release incase users from v1.0 (with update issues) are coming back when v3.0 is out using the new update url they need a way to break their dependency on that old update manifest url...or require that new users install your updated version directly from the server with the proper update manifest URL field set as well as the update.plist you posted above.
As a test I would install the latest version of the extension from your server, turn off auto update in safari preferences so you'll be notified if there's a new version, then bump the versions to 4.0.1 or something minor and upload the new files to the server. Then restart safari and see if anything triggers inside the safari extension preferences.
I have verified the communication to update server with Wireshark. Seems that Safari would check updates.plist (the one specified in the extension Info.plist as
<key>Update Manifest URL</key>
<string>URL/updates.plist</string>
) anytime you visit Preferences -> Extensions -> Updates. If the server responds with 304 Not Modified, Safari does no further action. If the plist contains a newer version of the extension (and it's the only version in the plist), Safari downloads and updates the extension.

Error ITMS-90135: The executable could not be re-signed for submission to the App Store

OK, guys... So, I need your help.
I've been desperately trying to upload my latest app to the App Store and (after various, unrelated error messages) I'm now getting the following:
Error ITMS-90135: The executable could not be re-signed for submission
to the App Store. The app may have been built or signed with
non-compliant or pre-release tools
Here's what:
My app uses Node.js (with several pre-"installed" Node modules, along with Node itself, all located in the Executables folder of my app bundle).
Now, I have codesigned all of those binaries and libraries (as reported by earlier error messages) with the appropriate(?) entitlements:
<?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/>
<key>com.apple.security.inherit</key>
<true/>
</dict>
</plist>
And this is the command I used:
codesign -f -s "$CERTIFICATE" --entitlements "$ENTITLEMENTS" "${ROOT}$EXEC"
Any idea what might be going on here?

XCode 4.3.2 iOS 5.1.1 app crash at launch time

I've done the edit on the SDKSettings.plist. did the don't code sign thing and I can build the project. it installs perfectly on my jailbroken device (with no error); but when I wanna run it, it jumps out of the app immediately! (crash at runtime)
I've installed the same app with the same file on another iPod Touch running iOS 5.0 and it works perfectly. so the problem seems to be with the 5.1.1 version. (iGuess)
I have NO IDEA how to make this work.
any ideas?
The answer is to use JailCoder.
I've been all up and down this problem and I think I have your solution. Yes, you have to have a minimal level of fake code signing if you want to deploy and debug from Xcode 4.3. Turn code signing back on in Xcode and follow the basic instructions here. Don't worry about the -gta code signing flag and use the following for your ldid3.py script (the other one won't work at all):
!/usr/bin/python
from sys import argv
from subprocess import call, check_call
from os.path import basename, splitext, join
from tempfile import NamedTemporaryFile
app = argv[-1]
obj_path = join(app, splitext(basename(app))[0])
with NamedTemporaryFile() as f:
f.write("""
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>get-task-allow</key>
<true/>
</dict>
</plist>\n""")
f.flush()
check_call(['/usr/local/bin/ldid', '-S' + f.name, obj_path])
I didn't have to do the tdmtanf step, but that may be because I have appsync installed.

how to multi task on iPhone sdk?

I want to be able to multitask in Matt Gallagher's AudioStream iphone application which can be found over here http://cocoawithlove.com/2008/09/streaming-and-playing-live-mp3-stream.html I tried uibackground by adding to info.plist but it isn't working any ideas on how to make it work? I did read the apple documentation but I have failed to find anything. any code would be appritated
thanks,
add this to your info.plist
<key>UIBackgroundModes</key>
<array>
<string>audio</string>
<string>voip</string>
<string>location</string>
</array>