NowSDK framework - iOS

  • リリースバージョン: Australia
  • 更新日 2026年03月12日
  • 所要時間:4分
  • The NowSDK framework contains methods that enable the instantiation of various feature services.

    NowSDK - configure(with configuration: NowSDKConfiguration) throws

    Configures NowSDK for use. You must call this function before calling any of the feature services within the Mobile SDK.

    注:
    If the configuration that you pass is invalid, a NowSDKError is thrown.
    表 : 1. Parameters
    Name Type Description
    with configuration NowSDKConfiguration NowSDKConfiguration that contains the information necessary to initialize the service.
    表 : 2. Returns
    Type Description
    None, NowSDKError NowSDKError is thrown if the configuration that you pass is invalid.

    The following code example shows how to call this function.

    guard 
      let jwtUrl = URL(string: "http://13.57.38.237:8080"),
      let instanceUrl = URL(string: "https://mobilecoresdk.service-now.com") else {
        return
      }
    
    // AuthorizationProvider – struct conforming to NowSDKAuthorizationProviding protocol
    let authorizationProvider = AuthorizationProvider(userEmail: "sdk@servicenow.com", jwtProviderUrl: jwtUrl, clientId: "deb8756b452d201039231ca568f26511")
            
    // PermissionProvider – class conforming to DevicePermissionDelegate protocol
    let permissionProvider = PermissionProvider()
    let config = NowSDKConfiguration(authorizationProvider: authorizationProvider, permissionDelegate: permissionProvider, logLevel: .debug)
    
    do {
      try NowSDK.configure(with: config)
                …
    } catch {
       print(“error is \(error.localizedDescription)”)
    }

    NowSDK - core()

    Returns a reference to the SDK core service.

    注:
    Host applications don't need to call this function.
    表 : 3. Parameters
    Name Type Description
    None
    表 : 4. Returns
    Type Description
    Object Object conforming to the NowCoreServiceProviding protocol is returned if the SDK has been initialized by calling the NowSDK - configure(with configuration: NowSDKConfiguration) throws method; otherwise nil.

    The following code example shows how to call this function.

    guard let coreService = NowSDK.core() else {
      // Error with NowServiceError.sdkNotConfigured
      return
    }

    NowSDK - makeServiceConfiguration(for instanceUrl: URL)

    Convenience function that feature services can use to construct n NowServiceConfiguration object.

    表 : 5. Parameters
    Name Type Description
    instanceUrl URL URL of the ServiceNow instance that the service will access.
    表 : 6. Returns
    Type Description
    NowServiceConfiguration If the specified URL passes basic validity checks, and the service configuration can be properly constructed, returns the NowServiceConfiguration object; otherwise nil.

    The following code example shows how to call this function.

    guard 
      let instanceUrl = URL(string: "https://mobilecoresdk.service-now.com"),
      let serviceConfig = NowSDK.makeServiceConfiguration(for: instanceUrl) else {
        logger.error(message: "Could not create service - service configuration invalid")
        return 
      }