How to add a Background service in Ionic app - ios

I try to use cordova Background Geolocation to send my position to a server in background. But when i put my app in background after some time it stop working. So I tried BackgroundFetch service https://github.com/christocracy/cordova-plugin-background-fetch but doesn't work: the error is:
You've implemented -[<UIApplicationDelegate> application:performFetchWithCompletionHandler:], but you still need to add "fetch" to the list of your supported UIBackgroundModes in your Info.plist.
how can i add fetch to the list of your supported UIBackgroundModes in my Info.plist?

Just do it as it is. Find the Info.plist in your project and add a pair of key/value like this,
<key>UIBackgroundModes</key>
<array>
<string>fetch</string>
</array>
Once you did it, rebuild it and the warning will disappear.

Related

SceneConfiguration Info.plist contained no UIScene configuration dictionary (looking for configuration named "(no name)")

I'm getting this error when trying to run flutter app to IOS devices, this error occurs when launching the application on the device for the first time.
Assuming you don't actually use scenes, this warning can appear for a few reasons. Most common I've noticed is using a LaunchScreen.storyboard sort of thing, they contain scene data. If indeed you don't use scenes. You can get rid of this by being explicit in your Info.plist. Add the following;
<key>UIApplicationSceneManifest</key>
<dict>
<key>UIApplicationSupportsMultipleScenes</key>
<false/>
<key>UISceneConfigurations</key>
<dict/>
</dict>
If you are managing your Info.plist with Targets > Info > Custom iOS Target Properties you would set Application Scene Manifest like the picture

How to deal with this error AVAudioSessionErrorCodeMissingEntitlement?

I'm trying to integrate with iOS10's CallKit, however when I'm trying to initialize the audio session after accept a phone call, this "AudioUnitInitialize" API will throw out this error "AVAudioSessionErrorCodeMissingEntitlement".
According to the document, it's just one line explanation:
https://developer.apple.com/reference/avfoundation/avaudiosessionerrorcode/avaudiosessionerrorcodemissingentitlement
How should I update the entitlement for support this? Does any body has any experience?
I also ran into this issue in iOS10 Beta 6, and was able to resolve it by moving the "AudioUnitInitialize" API from the performAnswerCallAction: method (as implemented in SpeakerBox) to the init routine of the ProviderDelegate.
By moving initialization earlier in the lifecycle of the ProviderDelegate, somehow the 'entitlement' problem is avoided.
I've downloaded Apple's Speakerbox sample app to examine the entitlements and background modes used for CallKit.
It looks like they add the Background Modes -> voice over IP entitlement and the "App provides Voice over IP services" key to the app's Info.plist:
<key>UIBackgroundModes</key>
<array>
<string>voip</string>
</array>
It also adds the INStartAudioCallIntent key to NSUserActivityTypes and the following Microphone Usage Description:
<key>NSMicrophoneUsageDescription</key>
<string>$(PRODUCT_NAME) uses the Microphone for call audio</string>
<key>NSCallKitUsageDescription</key>
<string>$(PRODUCT_NAME) makes and receives calls</string>
<key>NSUserActivityTypes</key>
<array>
<string>INStartAudioCallIntent</string>
</array>

iOS: Crashlytics Crashing on Init

In my AppDelegate, I call
[Fabric with:#[CrashlyticsKit]];
and everything works fine. Now I pulled my code onto another machine, and the same line gives me the following error:
*** Terminating app due to uncaught exception 'FabricException', reason: '[Fabric] Value of Info.plist key "Fabric" must be a NSDictionary.'
I'm not aware of any additions in my project's plist. Any ideas what this error may be referring to and how to fix it?
Fabric automatically inserts of hunk of text into your application's plist when you install it. These are essential and Fabric throws an exception on initialisation if they're not present.
Unfortunately it doesn't actually tell you it does this, so we ran into this crash on a project where the plist was automatically generated by a tool - which overwrote what Fabric had added.
For reference, this is what the Fabric part of the plist looks like in the current version (not sure where the version number is, but the latest version as of 15th June 2015).
<key>Fabric</key>
<dict>
<key>APIKey</key>
<string>your-api-key</string>
<key>Kits</key>
<array>
<dict>
<key>KitInfo</key>
<dict/>
<key>KitName</key>
<string>Crashlytics</string>
</dict>
</array>
</dict>
One more way to solve this Using Fabric App.
Launch Fabric app and log in with your user ID.
Click on Add New App
Select your .xcodeproj file and follow on screen instruction
Do not manually add Fabric key in your .info plist file
The solution required us to update Crashlytics. The other targets that we had set up had the latest version and those were working fine, but the latest update (3.0.9 at the time of this post) seems to fix the issue.
It just happened to me and this is how I solved it (thanks for the leads to everyone.)
Context: When you have more than one different target in your Xcode project, by creating a New App in the Mac Fabric app is, apparently, not enough.
Solution: If you select the same project (to make it for your Pro version for instance) Fabric app does not touch the Pro´s .plist properly.
So just copy the Fabric dictionary entry of your non-pro version of .plist and paste it into your Pro´s version.
API key goes on Organisation level, so this is the right way to do it.
just change the Fabric key type from String to Dictionary. go to your-project-info.plist>Fabric>kits>item0>KitName and change type to Dictionary. problem resolved for me
May be this will look weird but the same problem happened to me and this is how i solved the problem. I have a project with multiple target and schemes, i have also two additional targets for unit tests and UI Tests. The solution was to uncheck these tests targets from "Analyse", "Run", "Profile" and "Archive" tabs under Manage Schemes > Edit > Build. See the image Below :
my two cents:
in my all I add for mistake to plist of "myAppTests" and not to "myApp" plist.
So as also Eugene noted, be careful to add in EVERY .plist.
For me the reason was:
While you are creating a new target - a new Info.plist files is created automatically.
Thus you need to put the Fabric property to all Info.plist files.
<key>Fabric</key>
<dict>
<key>APIKey</key>
<string>43336ce109856f4452829a8e6b6783886fefb</string>
<key>Kits</key>
<array>
<dict>
<key>KitInfo</key>
<dict/>
<key>KitName</key>
<string>Crashlytics</string>
</dict>
</array>
</dict>
At first I've missed that, and put this code only to the first one - initial Info.plist file.

iOS: Require Retina Display in plist

This is an odd request, but I would like to be able to require devices to have a retina display in order to build an application. Is there a key and value I can add to my plist to add that build requirement?
You can check if there id a front camera, and set it in the info.plist UIRequiredDeviceCapabilities key.
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>front-facing-camera</string>
</array>
look here for more details:
iPhoneOSKeys
BTW
That will work for iPhone only.

How to properly set UIRequiredDeviceCapabilities?

I have had an app rejected by Apple stating that I need to implement UIRequiredDeviceCapabilities in my info.plist due to my app requiring a camera flash. I understand the issue but I am not sure how to properly set this key. Do I create UIRequiredDeviceCapabilities as a dictionary or array? and camera-flash as a bool or string? Any help is appreciated! Thanks!
Add this text to your app's Info.plist file:
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>camera-flash</string>
</array>
You only need a dictionary if some of the capability requirements need to be false.
Important note from docs:
For app updates, you can only maintain or relax capability requirements. Submitting an update with added requirements would prevent some customers who previously downloaded your app from running the update.
In Xcode -> Info(info.plist)
add key
UIRequiredDeviceCapabilities
in this key add:
camera-flash
still-camera

Resources