Skip to end of metadata
Go to start of metadata

IOS SDK Integration Guide - CM

 

Version 1.2.7

This is Phunware's iOS SDK README for the Content Management module. Visit http://maas.phunware.com/ for more details and to sign up.

Requirements

  • MaaS Core v1.3.0 or greater
  • iOS 6.0 or greater
  • Xcode 6 or greater

Getting Started

Installation

The following frameworks are required:

MaaSCore.framework

MaaS Content Management has a dependency on MaaSCore.framework, which is available here: Core SDK (iOS)

It's recommended that you add the MaaS frameworks to the 'Vendor/Phunware' directory. This directory should contain MaaSCore.framework and MaaSCMS.framework as well as any other MaaS frameworks that you are using.

Documentation

Documentation is included in the Documents folder in the repository as both HTML and as a .docset. You can also find the latest documentation here: CM API iOS Reference

Overview

The MaaS Content Management SDK allows developers to fetch and manage the various pieces of data in the Content Management module, including containers, schemas, structure and content. Content Management spans across your entire organization, so different applications can potentially share the same content.

Container

Containers hold a single structure. You can create any number of containers in the MaaS portal. You can also associate tags with containers to assist with fetching.

Schema

Schemas are applied to structure items and define what fields of data a particular structure item can contain. You can create any number of schemas in the MaaS portal. You can also associate tags with schemas to assist with fetching.

Structure

Structure items are used to build the structure and hierarchy of the data. Each structure item that is defined as an object can also optionally be assigned a schema that defines what content can be saved to structure items.

Content

The structure of the content object relies completely on the structure of the menus and schemas.

Integration

The primary methods in Content Management revolve fetching, creating, updating and deleting content. You can also GET structures, containers and schemas.

Getting Content

	// Get a specific piece of content for the specified content ID, container ID and structure ID. The contents are always returned as an NSDictionary object. It's recommended that you parse the dictionary into a model object.
    [MaaSCMS getContentForContentID:@"CONTENT_ID" containerID:@"CONTAINER_ID" structureID:123 success:^(NSDictionary *content) {
        ...
    } failure:^(NSError *error) {
        ...
    }];

Updating Content

	// Update content for the specified content ID, container ID and structure ID. Any omitted fields will maintain their previous values.
    NSDictionary *updatedContent = @{@"user_name" : @"MaaS Test User"};
    
    [MaaSCMS updateContentForContentID:@"CONTENT_ID" containerID:@"CONTAINER_ID" structureID:123 updatedContent:updatedContent success:^{
        ...
    } failure:^(NSError *error) {
        ...
    }];

Creating Content

	// Add content to the specified container ID, structure ID and parent content ID. Ideally, the new content dictionary has all the fields as specified by the structure and schema. If not, the required fields will be created for you with empty values.
    NSDictionary *newContent = @{@"user_name" : @"MaaS Test User"};
    
    [MaaSCMS addContent:newContent containerID:@"CONTAINER_ID" structureID:123 parentContentID:@"PARENT_CONTENT_ID" success:^(NSString *newContentID) {
        ...
    } failure:^(NSError *error) {
        ...
    }]; 

Deleting Content

	// Delete content for the specified content ID, as well as all content children.
    [MaaSCMS deleteContentForContentID:@"CONTENT_ID" traverse:YES success:^{
        ...
    } failure:^(NSError *error) {
        ...
    }];
    
    // Delete all content children for the specified content ID.
    [MaaSCMS deleteContentChildrenForContentID:@"CONTENT_ID" success:^{
        ...
    } failure:^(NSError *error) {
        ...
    }];

Containers

	// Fetch all containers.
    [MaaSCMS getAllContainersWithSuccess:^(NSArray *containers) {
        ...
    } failure:^(NSError *error) {
        ...
    }];
    
    // Fetch a specific container item.
    [MaaSCMS getContainerWithContainerID:@"CONTAINER_ID" success:^(PWContainer *container) {
        ...
    } failure:^(NSError *error) {
        ...
    }];
    
    // Get an array of containers that match an array of tags.
    [MaaSCMS getContainersContainingAnyTags:@[@"CONTAINER_TAG"] containingAllTags:nil success:^(NSArray *containers) {
        ...
    } failure:^(NSError *error) {
        ...
    }];

Schemas

	// Fetch all schemas.
    [MaaSCMS getAllSchemasWithSuccess:^(NSArray *schemas) {
        ...
    } failure:^(NSError *error) {
        ...
    }];
    
    // Fetch a specific schema item.
    [MaaSCMS getSchemaWithSchemaID:@"SCHEMA_ID" success:^(PWSchema *schema) {
        ...
    } failure:^(NSError *error) {
        ...
    }];
    
    // Get an array of schemas with the specificed pagination parameters
    [MaaSCMS getSchemasWithLimit:10 offset:0 success:^(NSArray *schemas, PWPagination *pagination, BOOL pagingEnabled) {
        ...
    } failure:^(NSError *error) {
        ...
    }];

Structure

	// Fetch a specific structure item with the specified stucture and container ID. In this example, we want to traverse into all child structures and exclude schemata.
    [MaaSCMS getStructureWithID:123 containerID:@"CONTAINER_ID" depth:kMaaSCMSDepthFullHierarchy includeSchema:NO success:^(PWStructure *structure) {
        ...
    } failure:^(NSError *error) {
        ...
    }];
    
    // Get an array of structures for the specified container ID. In this example, we want to traverse into all child structures and include schemata.
    [MaaSCMS getStructuresForContainerID:@"CONTAINER_ID" depth:kMaaSCMSDepthFullHierarchy includeSchema:YES success:^(NSArray *structures) {
        ...
    } failure:^(NSError *error) {
        ...
    }];

ON THIS PAGE

  • No labels