What is actually the value of UIApplicationBackgroundFetchIntervalMinimum? - ios

I'm about setting up background fetch for an iOS application.
I do:
func application(
application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?
) -> Bool {
...
application.setMinimumBackgroundFetchInterval(
UIApplicationBackgroundFetchIntervalMinimum)
...
if I inspect and print UIApplicationBackgroundFetchIntervalMinimum in the debugger it says 0 - what is the value actually ?
I tried looking through the api as well but no luck https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIApplication_Class/#//apple_ref/occ/instm/UIApplication/setMinimumBackgroundFetchInterval:

It is not specified by Apple how long UIApplicationBackgroundFetchIntervalMinimum time is, however in practice it is around 10 minutes.

Related

iOS - Initialise WebEngage SDK Conditionally with different Accounts Ids

I am in need of Initialising WebEngage SDK based on some conditions.
if condition {
//initialise with `X` Account ID
} else {
//initialise with `Y` Account ID
}
But as per WebEnage-Documentation there is no method for initialising SDK with accountId.
we just call below code in our AppDelegate's didFinishLaunchingWithOptions method.
WebEngage.sharedInstance().application(application,
didFinishLaunchingWithOptions: launchOptions)
and it initialise the SDK by reading account id from info.plist file.
I tried updating Info.plist at run time but that didn't work.
I am looking for the right approach to do it.
In WebEngage v6.0.0 a new initialising method is introduced that can have licenseCode as parameter.
func application(_ application: UIApplication?, didFinishLaunchingWithOptions launchOptions: [AnyHashable : Any]?, notificationDelegate: WEGInAppNotificationProtocol?, autoRegister apnRegister: Bool, setLicenseCode licenseCode: String?) -> Bool
I initialises SDK with help of above method in AppDelegate's didFinishLaunchingWithOptions method.
if staging {
WebEngage.sharedInstance().application(application, didFinishLaunchingWithOptions: launchOptions, setLicenseCode: "xyz")
} else {
WebEngage.sharedInstance().application(application, didFinishLaunchingWithOptions: launchOptions, setLicenseCode: "abc")
}

Firebase Analytics.logEvent() doesn't work, but native event are ok

First of all, here are my steps:
Pod Firebase/Analytics 7.5.0 : OK
FirebaseApp.configure() in app.delegate : OK
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
guard let window = self.window else { return false }
FirebaseConfiguration.shared.setLoggerLevel(.max)
FirebaseApp.configure()
Analytics.setAnalyticsCollectionEnabled(true)
Google plist : OK ( tested with anther blank application it does work )
No env var stored
Debug mode : OK
I do have firebase's native event as Screen view, session_start etc :
[Firebase/Analytics][I-ACS023072] Event logged. Event name, event params: screen_view (_vs)
but as soon as I send myself an event, nothing in DebugViews ( Xcode + Firebase console )
Analytics.logEvent("event", parameters: nil)
What did I miss, configuration, conflicts between some pods ?
Regards

Swift 4 GIDSignIn "undeclared type" error

I am trying to integrate a google sign in to my app and for some reason, in my AppDelegate.swift when I try to implement "GIDSignInDelegate", and anything GIDSignIn related, it flags it as "undeclared type" or "use of unresolved identifier". If anyone has any suggestions please let me know! Thanks in advance :)AppDelegate.swift screenshot
There are different pod names in different documents. If you are using Google/SignIn (3.1.0) pod, this code will work for you:
import Google
class AppDelegate:UIResponder,GIDSignInDelegate{
....
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
GIDSignIn.sharedInstance().clientID = "your_client_id"
GIDSignIn.delegate = self
.....
....
}

Get launchOptions when resuming App

I am able to handle the launchOptions value in the application method (since, obviously, the parameter gets passed to it). What I'm doing is basically receiving an image from a user who imported it by selecting my app in the Share menu:
It works fine if the App hasn't already been launched, but I don't see how I get the input parameters if the App is already running and the application method isn't called.
I tried to find a method that would help me like
applicationWillEnterForeGround(_ application: UIApplication, _ launchOptions: [UIApplicationLaunchOptionsKey: Any]?
but without any success.
I assume it's possible, since you can share images to WhatsApp or Facebook too, even when they've already been launched.
Can someone help me out?
Thanks,
Jan
You should implement the application:openURL:options: method as follows (Swift 2):
func application(app: UIApplication, openURL url: NSURL, options: [String : AnyObject]) -> Bool {
// Do your stuff and return true if you have handled the URL...
// Else
return false
}
Relevant tutorial in Ray Wenderlich
As of Swift 4.2 the signature is:
func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any] = [:]) -> Bool {
// Do your stuff and return true if you have handled the URL...
// Else
return false
}
I think you're currently watching in the wrong direction. You should refer to Inter-App communication guide, provided by Apple. If generalise this, you simply need this method, that will handle URI link to your app.
- (BOOL)application:(UIApplication *)app
openURL:(NSURL *)url
options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options;

Force touch the app icon when app closed from task manager

while using quick actions of 3D Touch it works good but while app is terminated first time force touch the app icon it open home screen but the other times it open the right screen.
why this happen and how I can test the app while it is terminated
From the method application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) you can use the launchOptions argument to detect whether user is launching the app by pressing shortcut item key or not.
if launchOptions != nil {
if let userInfo = launchOptions![UIApplicationLaunchOptionsShortcutItemKey] {
//Handled the implementation here
}
}

Resources