2

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

    @UIApplicationMain
    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
            AppConnect.initWithDelegate(self)
            self.appct = AppConnect.sharedInstance()
            self.appct.startWithLaunchOptions(launchOptions)

            return true
        } 
}

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

Any other way to implement this?

Patrick
  • 1,629
  • 5
  • 23
  • 44
SRK
  • 744
  • 3
  • 11
  • 23

2 Answers2

1

You are initializing AppConnect without delegate

change

var appct = AppConnect();

to

var appct : AppConnect!;

Daniel Krom
  • 9,751
  • 3
  • 43
  • 44
  • Daniel, Now app is crashing at self.appct = AppConnect.sharedInstance() with this error : [AppConnect:Error] AppConnect is unable to start because [UIApplication sharedApplication] is not an instance of AppConnectUIApplication – SRK May 06 '16 at 08:21
  • change `class AppDelegate: UIResponder` to `class AppDelegate : AppConnectUIApplication` – Daniel Krom May 06 '16 at 08:34
0

My solution was to set a new key/value in the plist:

Principal class AppConnectUIApplication

or in source mode:

  <key>NSPrincipalClass</key>
    <string>AppConnectUIApplication</string>

Hope it help you

movaction.com
  • 537
  • 6
  • 6