how to multi task on iPhone sdk? - objective-c

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>

Related

Unrecognized font family 'Lato-Regular'

I started getting this error when building my project. "Unrecognized font family 'Lato-Regular' " I'm not sure how to fix it because "Lato-Regular" Is not a font I use in my project at all.. I even did a search in for my entire project that this font is not used or mentioned anywhere. I cleaned my build folder and tried adding it to my info file to see if this would fix the issue. It been a few days now of trying to fix this. This started after I made a change in my podfile. Specifically this:
installer.pods_project.targets.each do |target|
if target.name == "React-Core.common-AccessibilityResources"
target.remove_from_project
My project won't archive without it. so removing it is not an option.
Here is my info.plist
<key>UIAppFonts</key>
<array>
<string>Kufam-SemiBoldItalic.ttf</string>
<string>Lato-Bold.ttf</string>
<string>Lato-BoldItalic.ttf</string>
<string>Lato-Italic.ttf</string>
<string>Lato-Regular.ttf</string>
<string>AntDesign.ttf</string>
<string>Entypo.ttf</string>
<string>EvilIcons.ttf</string>
<string>Feather.ttf</string>
<string>FontAwesome.ttf</string>
<string>FontAwesome5_Brands.ttf</string>
<string>FontAwesome5_Regular.ttf</string>
<string>FontAwesome5_Solid.ttf</string>
<string>Foundation.ttf</string>
<string>Ionicons.ttf</string>
<string>MaterialCommunityIcons.ttf</string>
<string>MaterialIcons.ttf</string>
<string>Octicons.ttf</string>
<string>SimpleLineIcons.ttf</string>
<string>Zocial.ttf</string>
</array>
I was able to fix this by adding lato-regular.tff to my target. This might have to do with a recent module Awesome fonts that I installed.. I have to dig further but for now this was the solution.

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

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.

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.

titanium disable device rotation & fix so only one mode ever shown

how do i fix the device rotation in a titanium app across all mobile platforms? Any references to official doco would be super useful!
so i don't want to so much "disable rotation" as "only ever let the app run in a particular orientation" (which in my case is portrait mode)
cheers
The official web site is down at the moment, but you would want to look up 'orientation modes'. The following code locks my windows to only portrait mode in my app.
loginWin = Ti.UI.createWindow({
orientationModes: [Ti.UI.PORTRAIT]
});
// Required to fix Android still?
loginWin.orientationModes = [Ti.UI.PORTRAIT];
Full-ish answer - this will STILL allow an orientation change when the loading screen starts up. Titanium seems to be holding this one close to their chest, but here goes:
in the tiap.xml file, you need to make changes to the first indentation-level android element
<android xmlns:android="http://schemas.android.com/apk/res/android">
<manifest>
<application>
<activity
android:configChanges="keyboardHidden|orientation"
android:name="org.appcelerator.titanium.TiActivity" android:screenOrientation="portrait"/>
<activity
android:configChanges="keyboardHidden|orientation"
android:name="org.appcelerator.titanium.TiTranslucentActivity"
android:screenOrientation="portrait" android:theme="#android:style/Theme.Translucent"/>
<activity
android:configChanges="keyboardHidden|orientation"
android:name="org.appcelerator.titanium.TiModalActivity"
android:screenOrientation="portrait" android:theme="#android:style/Theme.Translucent"/>
<activity
android:configChanges="keyboardHidden|orientation"
android:name="ti.modules.titanium.ui.TiTabActivity" android:screenOrientation="portrait"/>
<activity
android:name="ti.modules.titanium.ui.android.TiPreferencesActivity" android:screenOrientation="portrait"/>
</application>
</manifest>
</android>
the above code can be dropped in (remove the existing android element first, of course!) and should work.
The trick here is the use of
android:screenOrientation="portrait"
which sets the orientation to portrait. The other option is 'landscape', of course. I think if you leve this out the the default behaviour is to allow the orientation to switch around.
iOS is, of course, easier.
In the same tiapp.xml file you need
<ios>
<plist>
<dict>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
</array>
</dict>
</plist>
</ios>
this will replace whatever is in your current ios element, and is at the same level as the android element
ie
<?xml version="1.0" encoding="UTF-8"?>
<ti:app xmlns:ti="http://ti.appcelerator.org">
...
<ios>
...
</ios>
<android>
...
</android>
</ti:app>
I still don't know how to stop android (and possibly ios) from re-orienting the splash screen, if anybody knows how let me in on the secret!!!

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.