Giter Site home page Giter Site logo

helloworld-ios's Introduction

helloworld-ios-app

Build Status

Swift version is available here.

Author: Corinne Krych
Level: Intermediate
Technologies: Objective-C, iOS, RHMAP, CocoaPods. Summary: A demonstration of how to get started with remote cloud call in RHMAP. Community Project : Feed Henry Target Product: RHMAP
Product Versions: RHMAP 3.7.0+
Source: https://github.com/feedhenry-templates/helloworld-ios
Prerequisites: fh-ios-sdk : 3.+, Xcode : 8+, iOS SDK : iOS8+, CocoaPods 1.0.1+

What is it?

Simple native iOS app to test your remote cloud connection in RHMAP. Its server side companion app: HelloWorld Cloud App. This template app demos how to intialize a cloud call and make calls to cloud endpoints. The app uses fh-ios-sdk.

If you do not have access to a RHMAP instance, you can sign up for a free instance at https://openshift.feedhenry.com/.

How do I run it?

RHMAP Studio

This application and its cloud services are available as a project template in RHMAP as part of the "Native iOS Hello World Project" template.

Local Clone (ideal for Open Source Development)

If you wish to contribute to this template, the following information may be helpful; otherwise, RHMAP and its build facilities are the preferred solution.

Build instructions

  1. Clone this project
  2. Populate helloworld-ios-app/fhconfig.plist with your values as explained on section 2.1.4. Setup.
  3. Run pod install
  4. Open helloworld-ios-app.xcworkspace
  5. Run the project

How does it work?

Init

In helloworld-ios-app/HomeViewController.m the FH.init call is done:

- (void)viewDidLoad {  
    // Initialized cloud connection
    [FH initWithSuccess:^(FHResponse *response) { // [1] 
        // Do you other calls to the cloud.       // [2]
    } AndFailure:^(FHResponse *response) {
        // Log an error                           // [3]
    }];
}

[1] Initialize the cloud connection.
[2] On successfull callback, you are ready to do other calls.
[3] Log an eror.

Cloud call

In helloworld-ios-app/HomeViewController.m the FH.init call is done:

- (IBAction)cloudCall:(id)sender {
    NSDictionary *args = [NSDictionary dictionaryWithObject:name.text forKey:@"hello"];
    FHCloudRequest *req = (FHCloudRequest *) [FH buildCloudRequest:@"/hello" WithMethod:@"POST" AndHeaders:nil AndArgs:args];      // [1]  
    [req execAsyncWithSuccess:^(FHResponse * res) {       // [2]
        // Response
    } AndFailure:^(FHResponse * res){
        // Errors
    }];
}

[1] Create a cloud request specifying endpoint and its arguments.
[2] Make asynchronous call with its success and error callbacks.

iOS9 and non TLS1.2 backend

If your RHMAP is depoyed without TLS1.2 support, open as source helloworld-ios-app/helloworld-ios-app-Info.plist uncomment the exception lines:

  <!--
  <key>NSAppTransportSecurity</key>
  <dict>
    <key>NSAllowsArbitraryLoads</key>
    <true/>
  </dict>
   -->

helloworld-ios's People

Contributors

corinnekrych avatar jcesarmobile avatar jasonmadigan avatar danielpassos avatar matzew avatar pmdarrow avatar cianclarke avatar jhellar avatar thailekha avatar

Watchers

James Cloos avatar Wei Li avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.