PWCME 2.0.0-b2

PWCME 2.0.0-b2

测试已测试
语言语言 Obj-CObjective C
许可 自定义
发布最后发布2015年2月

Illya BusiginIllya BusiginSam OdomXiangwei WangSteven Spry 维护。



PWCME 2.0.0-b2

为 iOS 的 Phunware 内容管理 SDK

版本 1.3.0

这是 Phunware 的 iOS SDK,用于内容管理模块。访问 http://maas.phunware.com/ 了解更多详细信息并注册。

要求

  • PWCore v2.0.0 或更高版本
  • iOS 7.0 或更高版本
  • Xcode 6 或更高版本

入门指南

  • 下载 Phunware 内容管理 (下载 Phunware 内容管理) 并运行包含的示例应用程序。
  • 继续阅读以下部分以获取安装和集成说明。
  • 请务必阅读 文档 以获取更多详细信息。

安装

以下框架是必需的

PWCore.framework

Phunware 内容管理依赖于 PWCore.framework,该框架可在以下位置找到:https://github.com/phunware/maas-core-ios-sdk

建议将 MaaS 框架添加到 'Vendor/Phunware' 目录。此目录应包含 PWCore.framework 和 PWCME.framework 以及您使用的任何其他 MaaS 框架。

文档

文档包括在存储库的 Documents 文件夹中,既包括 HTML 格式,也包括 .docset 格式。您也可以在此处找到最新文档:http://phunware.github.io/maas-content-management-ios-sdk/

概述

Phunware 内容管理 SDK 允许开发者获取和管理内容管理模块中的各种数据片段,包括容器、架构、结构和内容。内容管理贯穿整个组织,因此不同的应用程序可能会共享相同的内容。

容器

容器 存储单个结构。您可以在 Phunware 站点创建任意数量的容器。您还可以将标签与容器关联起来以协助检索。

架构

模式(Schemas)应用于结构项,并定义了特定结构项可以包含哪些数据字段。您可以在Phunware门户中创建任意数量的模式。您还可以将标签与模式关联,以帮助数据检索。

结构

结构项用于构建数据的结构和层次。每个定义为对象的结构项均可选择分配一个模式,用以定义可以保存到结构项中的内容。

内容

内容对象的结构完全依赖于菜单和模式的结构。

集成

内容管理的主要方法围绕着获取、创建、更新和删除内容。您还可以获取结构、容器和模式。

获取内容

    // 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.
    [PWCME getContentForContentID:@"CONTENT_ID" containerID:@"CONTAINER_ID" structureID:123 success:^(NSDictionary *content) {
        ...
    } failure:^(NSError *error) {
        ...
    }];

更新内容

    // 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"};

    [PWCME updateContentForContentID:@"CONTENT_ID" containerID:@"CONTAINER_ID" structureID:123 updatedContent:updatedContent success:^{
        ...
    } failure:^(NSError *error) {
        ...
    }];

创建内容

    // 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"};

    [PWCME addContent:newContent containerID:@"CONTAINER_ID" structureID:123 parentContentID:@"PARENT_CONTENT_ID" success:^(NSString *newContentID) {
        ...
    } failure:^(NSError *error) {
        ...
    }];

删除内容

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

    // Delete all content children for the specified content ID.
    [PWCME deleteContentChildrenForContentID:@"CONTENT_ID" success:^{
        ...
    } failure:^(NSError *error) {
        ...
    }];

容器

    // Fetch all containers.
    [PWCME getAllContainersWithSuccess:^(NSArray *containers) {
        ...
    } failure:^(NSError *error) {
        ...
    }];

    // Fetch a specific container item.
    [PWCME getContainerWithContainerID:@"CONTAINER_ID" success:^(PWContainer *container) {
        ...
    } failure:^(NSError *error) {
        ...
    }];

    // Get an array of containers that match an array of tags.
    [PWCME getContainersContainingAnyTags:@[@"CONTAINER_TAG"] containingAllTags:nil success:^(NSArray *containers) {
        ...
    } failure:^(NSError *error) {
        ...
    }];

模式

    // Fetch all schemas.
    [PWCME getAllSchemasWithSuccess:^(NSArray *schemas) {
        ...
    } failure:^(NSError *error) {
        ...
    }];

    // Fetch a specific schema item.
    [PWCME getSchemaWithSchemaID:@"SCHEMA_ID" success:^(PWSchema *schema) {
        ...
    } failure:^(NSError *error) {
        ...
    }];

    // Get an array of schemas with the specificed pagination parameters
    [PWCME getSchemasWithLimit:10 offset:0 success:^(NSArray *schemas, PWPagination *pagination, BOOL pagingEnabled) {
        ...
    } failure:^(NSError *error) {
        ...
    }];

结构

    // 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.
    [PWCME getStructureWithID:123 containerID:@"CONTAINER_ID" depth:kPWCMEDepthFullHierarchy 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.
    [PWCME getStructuresForContainerID:@"CONTAINER_ID" depth:kPWCMEDepthFullHierarchy includeSchema:YES success:^(NSArray *structures) {
        ...
    } failure:^(NSError *error) {
        ...
    }];