How to make my app to support multitasking - iphone

i am developing an app for iphone and ipad with 4.0 as base SDK and 3.0 as target.
how to enable multitasking to this app.
thanks..

To adopt Multi-Tasking in your app. apply the following points:
Support all orientation from the target's General section in settings.
In the General section too. remove the check next to Requires full screen if any.
Select storyboard, click the File Inspector icon in the right side bar. check the box next to Use Size Classes. Check out tutorials how to use size class to adjust your views according to the screen size assigned to your app.

Refer http://answers.oreilly.com/topic/1867-how-to-update-your-iphone-app-for-multitasking-with-ios-4/
Also duplicate question how to do multitasking application in ios 4.0

If you build an iOS app using a 4.x SDK, Apple's "multitasking" will be enabled by default, unless you explicitly add a plist key to prevent it.
But multitasking may not work properly unless you add support for it in the app's resign/become active, and/or app's suspend/resume delegates.
If you actually want to run code in the background, then your app needs to be of a few very specific types, or add support for running some code for a very limited amount of time, for which you probably want to read Apple's documentation.

Related

How to specify different dock icon in Swift for macOS App

My app icons are a light blue with clear background and I find that it doesn't show up nicely in the macOS dock.
I'm trying to find a way to use a different icon for the dock icon only but can't seem to find a way to do it programatically or through Xcode.
The dock icon I created does adhere to the Apple HIG guidelines however I'm not distributing through the App Store anyways.
Can anyone help me out?
I'm using XCode 13 with Swift 5.
Setting NSApp.applicationIconImage should do what you need.
EDIT: If you need to display a custom icon even when the app is not running, you need to make a dock tile plugin. Unfortunately, documentation on this is pretty scarce, but basically you need to make a plugin target, embed it inside your app's bundle with the extension .docktileplugin, put the path to your plugin in your app's Info.plist under the NSDockTilePlugIn key, and then make the plugin's principal class implement the NSDockTilePlugIn protocol. Also keep in mind that dock tile plugins are not allowed in the Mac App Store, so you'll need to self-publish with a Developer ID certificate if you go this route.

Using in app purchase to unlock iPad UI? [duplicate]

I've seen tons of questions and answers regarding merging an iPhone and an iPad app into an universal app, but that isn't what I want to do. What I am going to do is use in app purchase to unlock an iPad interface and then display the correct interface using conditionals. If the interface is purchased, the app displays the iPad Nib, and if not, it just displays the same way as an iPhone application does (with the option to scale the app, etc). The conditionals are very simple and I have already implemented them, however the issue I run into is this: If the IAP is NOT purchased, the iPad displays the iPhone Nib, but not in the typical way. It is just in the corner with no option to scale it, rather than in the center with the black border that you usually see. Does anyone know how I can set it up so i fixes this issue? I'm a little stumped to be honest.
The Info.plist file in an iOS app contains a key, UIDeviceFamily, which lists the devices that the app natively supports. If the key's value is 1, or a array containing 1, the app natively supports iPhones and iPods Touch. If the value is 2, or a array containing 2, the app natively supports iPads.
If UIDeviceFamily says the app supports iPads, then it will run the app in native iPad mode, not in iPhone-wrapper mode.
The Info.plist file is part of your app bundle, and you can't modify files in the app bundle.
So there is no way to enable or disable the system's native-iPad support at runtime. You'll have to move your app's top-level view into a wrapper view that centers and scales its child, and use that wrapper view as the UIWindow's subview.
UIDeviceFamily in the Information Property List Key Reference
This isn't possible, unfortunately. The iPad will know that the app is iPad ready and will tell draw the screen at full size. Even if you showed iPhone xib file on the iPad, they would still be scaled to fit the full screen using the UIViewAutoresizingMask params you've set for them.
One thought would be to force the size of your UIWindow to be iPhone sized (remember to account for retina) and centered, but I'm not 100% sure how/if this would work. You may have to change each UIView frame. I'm not sure.

iPhone & iPad Apps Launch Images

Preamble: This is intended to be be a canonical question (and answer) on iOS Apps launch images (aka Default.png).
Questions
What is the best way to set the Default.png; Manually in the Info.plist or using Xcode (supported in xcode-4 only, I think)
Does the iPhone auto-rotate the Default.png depending on the device orientation?
What effect does the UIInterfaceOrientation (Initial interface orientation) key in the Info.plist have?
Does UISupportedInterfaceOrientations and UISupportedInterfaceOrientations~ipad have any effect on displaying the Default.png
Can I set different Default.png for the iPad using these file names?:
Default-Portrait.png
Default-PortraitUpsideDown.png
Default-Landscape.png
Default-LandscapeLeft.png
Default-LandscapeRight.png
Are there iPhone equivalents (see 3)
Is there any Apple documentation that covers all aspects of "Launch Images"? If so, where?
NB: It seems the usage of launch
images changes quite frequently
between SDK releases, please indicate
in your answers what version you are
talking about
5) Is there any Apple documentation that covers all aspects of "Launch Images"? If so, where?
There's something here:
Supply a launch image to improve user experience.
Avoid using it as an opportunity to
provide:
An “application entry experience,” such as a splash screen
An About window
Branding elements, unless they are a static part of your application’s
first screen
Partial answers based on latest iPhone iOS
Manually in the Info.plist or using Xcode (supported in xcode-4 only, I think)
These two methods are equivalent. Xcode merely presents a convenience editor UI for the info.plist. There is no other way to specify the launch image (available to 3rd party developers) than setting it in info.plist.
Does the iPhone auto-rotate the Default.png depending on the device orientation?
No. but as Springoard does not support upside down, it is unlikely that any portrait apps are launched upside down.
What effect does the UIInterfaceOrientation (Initial interface orientation) key in the Info.plist have?
None
Does UISupportedInterfaceOrientations and UISupportedInterfaceOrientations~ipad have any effect on displaying the Default.png
No.
In my experience, the simplest approach with the easiest maintenance is to simply follow Apple's conventions when naming your launch image files. If you carefully read and follow those naming conventions, everything else becomes automatic. Automated features include:
Choosing different launch image files for different device screens.
Handling the new taller screen found on current iPhone 5/5S & iPod touch.
Handling Retina screens.
Handling device orientation (Portrait vs Landscape) on iPad. (handhelds have only Portrait)
Displaying thumbnails in Xcode 4
If you:
Create image files with the correct resolution (carefully read the doc, as resolutions are not what you might expect)
Follow the naming rules documented by Apple
Place the files at the top level of your app bundle†
…then:
Thumbnails of the images will automatically appear within project settings of Xcode 4.
Your launch images will automatically be used on devices as well as the iOS Simulator.
By following the naming conventions, you need not:
Select images manually in the Xcode project settings
Edit any info-plist
The naming conventions work at least in iOS 5, 6, and 7. I believe they also work in earlier versions as well.
†Image files should not be nested in any physical folder. After adding them to Xcode, you may group them into a virtual folder within Xcode's project listing to avoid visual clutter.
Tip: To verify which image is being used, alter the image itself to display the file name as part of the image. Make a backup of your images first, of course.

iphone app only showing in little window on ipad

I have developped an iPhone app and I now need it to work on iPad. On the simulator the app only show in a little window (the x2 zoom enable the app to work in full screen) but is there a way to have the app directly showing in full screen ?
Thanks a lot,
Luc
go to project settings and set Targeted Device Family to iPhone/iPad
As Max said, go to project setting and set Target Device Family to iPhone/iPad. But this is not enough. With this change the application type will be universal application. This is good, because the app will start in full screen, but if you hard coded the dimensions of the views in the application then the look and feel on the iPad will be bad. So do the first step what Max suggested for you and then check if the app looks like you want, because it will not arrange the views automatically. You should do the changes from code or from nibs.
There is a little help if you set properly the autoresizing masks.
Edit:
Project menu -> Edit Project settings -> Targeted device family
You will need to do at least the following:
Change the Targeted Device Family to include the iPad.
Create or convert all needed .xibs for the iPad (using the Interface Builder Menu).
Reference the top level iPad .xib from your app's info.plist (using the NSMainNibFile~ipad key).
Handle the iPad paradigm wherever the controller or view source code needs to differ.

Dynamic (Default.png) splashscreen in 3.0 [iPhone SDK]

I know it's possible to create a dynamically changable Default.png by creating a symbolic link. But that's not possible in iPhone SDK 3.0 anymore (only in 2.0).
How can I make this in 3.0, or is this impossible?
Tim
This worked on iPhone OS 2.0 http://collison.ie/blog/2008/11/dynamic-defaultpng-files-on-the-iphone but not on iPhone OS 3.0 anymore. The default-screen is always black.
I can change the default-screen in the documents-folder and the symbolic-link does link to that file. I tested that by browsing to the app-folder from the Simulator. I saw the right file in the documents-directory and I saw that the symbolic link points to that (the right) file.
It's not possible in 3.0. It was only possible on 2.0 because it was an exploitable bug. The bug was fixed in 3.0 which is why it's not possible.
Apple don't intend the Default.png to be a "splash screen".
If you read the HIG, you'll see that the Default.png is suppose to represent your user interface as it would be "empty" - without any content. It is intended to give the user the illusion of an "near instant" launch.
Check out all of the Apple apps on the iPhone and you'll see how the default.png is meant to be used properly.
Apple frown upon using the Default.png as a splash screen. They say that it is really only appropriate for apps such as games that don't use the standard UI elements that are provided in the SDK.
That being said - lots of apps these days are using this feature to show splash screens, and seems Apple aren't really enforcing this guideline.
Long story short, you can do a splash screen, but it can't be dynamic - not anymore.
Use a blank Default.png and then in your app delegate's -applicationDidFinishLaunching: method, load a UIView that contains your dynamic content. This solution sidesteps any conflicts with Apple's SDK terms as well as all technical problems.