SRK SRK - 1 year ago 224
Swift Question

AppConnect Error : AppConnect cannot be instantiated directly

I am trying to Access the MDM using AppConnect SDK in swift 1.2 but it is giving following error :

[AppConnect:Error] AppConnect cannot be instantiated directly.
Instead, call +initWithDelegate: and then +sharedInstance.

Code Snippet :

import UIKit

class AppDelegate: UIResponder, UIApplicationDelegate, AppConnectDelegate {

var window: UIWindow?
var appct = AppConnect();

func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
// Override point for customization after application launch.

// Initialize the AppConnect library
self.appct = AppConnect.sharedInstance()

return true

Application is crashing while accessing the Keys of MobileIron Backend Config file.

Any other way to implement this?

Answer Source

You are initializing AppConnect without delegate


var appct = AppConnect();


var appct : AppConnect!;

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download