This repository is deprecated; please follow the main search page or use the ‘Related code repos’ widget on the right side of the current page.

DNA-C Claim Devices Mobile App

This app is used to claim Day-0 or DNA-C supported Plug-n-Play(PnP) devices and provision it. As a first step, we are listing the uncalimed devices found by PnP service.

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See Deployment section on how to deploy the project on a live system.

Prerequisites

  • MacBook
  • Xcode min v9.3.1 (9E501)
  • node.js min v8.x

Deployment

  • Clone the repo
  • Run npm install to get the dependencies
  • Open Xcode and choose Open existing project. Select ios/claimDevices from the cloned repo and open it
  • Will load the project in Xcode
  • Either select your MacBook USB connected device or select a simulator from Xcode.
  • Click on Play button (>) to build and deploy the app to the selected device

Debugging

  • Command /bin/sh failed with exit code 2

    Select Show the Project Navigator. Select claimDevices --> Libraries --> React.xcodeproj. Select Build Phases tab. Expand Start Packager and change the port to 8888.

    Search 8081 port in your cloned project and replace it with 8888 (RCTDefines.h -> line # 79 and 88 and in RCTInspectorDevServerHelper.mm)

  • Network request failed
    Open RCTHTTPRequestHandler.h file in XCode. Search "#pragma mark - NSURLSession delegate" and then add the following code

- (void)URLSession:(NSURLSession *)session didReceiveChallenge:(NSURLAuthenticationChallenge *)challenge completionHandler:(void (^)(NSURLSessionAuthChallengeDisposition, NSURLCredential *))completionHandler{
    if([challenge.protectionSpace.authenticationMethod isEqualToString:NSURLAuthenticationMethodServerTrust]){
        NSURLCredential *credential = [NSURLCredential credentialForTrust:challenge.protectionSpace.serverTrust];
        completionHandler(NSURLSessionAuthChallengeUseCredential,credential);
    }
}
  • Code signing error (during installation on mobile using XCode)

    Select Show the Project Navigator. Select claimDevices --> General tab and expand "Signing" accordian. Add an account using Team dropdown. Sign in with your Apple ID

    Also, change the bundle identifier to different path under claimDevices --> General tab --> Identity

Installation

  • On deploy the app in mobile, it will ask to trust the Untrusted Enterprise developer.

TrustApp

  • In the mobile, navigate to Settings --> General --> Device Management --> Profiles
  • Click on 'Trust ClaimDevices'
  • Pop-up will appear and click on Trust in the pop-up
  • After trust, the app run smoothly and it will launch the login screen

Screenshots

Login screen

Login

Unclaimed devices list screen

Unclaimed

Built With

  • react-native
  • react
  • redux
  • react-redux
  • react-native-vector-icons

License

See the LICENSE file for details

View code on GitHub

Code Exchange Community

Get help, share code, and collaborate with other developers in the Code Exchange community.View Community
Disclaimer:
Cisco provides Code Exchange for convenience and informational purposes only, with no support of any kind. This page contains information and links from third-party websites that are governed by their own separate terms. Reference to a project or contributor on this page does not imply any affiliation with or endorsement by Cisco.