PopUpLib 1.0.8

PopUpLib 1.0.8

测试已测试
语言语言 Obj-CObjective C
许可证 商业
发布最后一次发布2018年12月

CanvasPopChris Taggart 维护。




PopUpLib 1.0.8

canvaspop-ios-library

api-overview

我们的照片打印 API 是应用开发者、品牌和网站所有者货币化其视觉内容并使其客户轻松将其图像转换成美丽的画布打印的绝佳方式。

该 iOS 库可以帮助你在大约半小时内集成我们的照片打印 API!按照以下说明,在你的 iOS 应用程序中集成该库。该库是通用的,并可在 iPhone 和 iPad 设备上运行。

一旦在你的应用程序中购买了一次打印,我们的设计师可以将任何图像转换成一个大美的画布。我们会充满爱心地打印、包装和发货所有订单直接给你的客户。

lib-screenshot

当前版本: 1.0.7 (下载)

手动安装

安装 PopUpLibLib.framework 简单易行。

  1. 从 github 下载 仓库

  2. PopUpLib.bundlePopUpLib.framework 拖入你的项目。

    lib-copy

  3. 在你的应用程序目标的“构建阶段”标签下,在“与二进制文件链接”部分,点击添加按钮并添加:MobileCoreServices.frameworkCFNetwork.frameworkSystemConfiguration.frameworklibz.dylib

    lib-dep1 lib-dep1 lib-dep1 lib-dep1

如果你遇到任何问题,请在此处免费报告:https://github.com/canvaspop/canvaspop-ios-library/issues

集成

将 CanvasPop iOS 库集成到你的应用程序中非常简单。

框架包含两个主要文件。

文件 说明
PopUpLib.h 你包含在项目中的文件,即 #import <PopUpLib/PopUpLib.h>
PopUpStoreController.h 你将需要初始化和显示的视图控制器
  1. 选择你的用户将启动 Pop-up Store 控制器的位置。在你的控制器头文件内部添加 #import <PopUpLib/PopUpLib.h> 并实现 PopupStoreControllerDelegate 协议: objective-c @interface ViewController : UIViewController <PopupStoreControllerDelegate> { }
  2. 在期望的时间(例如,点击按钮,拍照/编辑照片后)实例化一个 PopupStoreController。如果成功创建了(即调用没有返回 nil),则显示 Pop-up Store 控制器。

    参数

    • image - 将打印在画布上的图像
    • applicationKey - 你的合作伙伴 API 密钥
    • delegate - 实现 PopupStoreControllerDelegate 协议的任何类(通常是 self)
    PopupStoreController *controller =  [[PopupStoreController alloc] 
                                        initWithImage:[UIImage imageNamed:@"your_descired_image.jpg"] 
                                        applicationKey:YOUR_PARTNER_KEY 
                                        delegate:self];
    
    if (controller) {
        [self presentViewController:controller animated:YES completion:NULL];
    }

    状态栏

    现在,iOS库支持在使用PopupStoreController时显示或隐藏状态栏。默认情况下,库会隐藏状态栏。如果您想使用此选项,可以使用下面的bool值通过setLibShouldShowStatusBar方法进行设置。

    PopupStoreController *popUpStoreController = [[PopupStoreController alloc] initWithImage:[UIImage imageNamed:@"your_descired_image.jpg"] applicationKey:YOUR_PARTNER_KEY delegate:self];
    
    [popUpStoreController setLibShouldShowStatusBar:<STATUS_BAR_PREFERENCE>];
    
    [self presentViewController:popUpStoreController animated:YES completion:NULL];
  3. 实现PopupStoreControllerDelegate协议。目前有六个委托方法;一个必须实现,五个可以可选实现。具体如下:

    必须实现

    - (void)popupStoreLibWasClosed:(PopupStoreController *)lib
    {
        /*
        * Here a user has closed the Pop-up Store controller and it must be dismissed
        */
        [self dismissViewControllerAnimated:YES completion:nil];
    }

    可选实现

    以下方法为可选实现,可以用来接收回调。

    - (void)popupStoreLibWasOpened:(PopupStoreController *)lib
    {
        /*
        * Here a user has opened the Pop-up Store controller successfully
        */
        NSLog(@"Pop-up Store lib was opened");
    }
    
    - (void)popupStoreLibUserTappedContinue:(PopupStoreController *)lib
    {
        /*
        * Here a user has tapped the continue button after the initial image handshake was completed
        * The user will then be taken to the store with their desired image
        */
        NSLog(@"Pop-up Store user tapped continue");
    }
    
    - (void)popupStoreWasLoadedWithImage:(PopupStoreController *)lib
    {
        /*
        * Here the web request to load Pop-up Store with a users image completed successfully
        * A user is presented with a cart containing their image and print options
        */
        NSLog(@"Pop-up Store cart page loaded successfully with image");
    }
    
    - (void)popupStoreLibPrintHandshakeCompleted:(PopupStoreController *)lib
    {
        /*
        * The library implements a two-step handshake documented here: https://developers.canvaspop.com/documentation/image-handshake#two-step
        * Here the high resolution, printable version of the desired image was uploaded succesfully
        * 
        */
        NSLog(@"Pop-up Store print image handshake completed");
    }
    
    - (void)popupStoreEventWasEmitted:(PopupStoreController *)controller withEvent:(NSString*)eventName withPayload:(NSDictionary *)payload
    {
        /*
        * Here a user has interacted with Pop-up Store and an HTML5 pushMessage() was emitted.
        * Depending on the event, it may have an associated payload value sent along with the event name.
        * 
        * For further details emitted events and their payloads see here: 
        * https://developers.canvaspop.com/documentation/events
        */
    
        NSLog(@"PopupStore event was emitted with payload");
    
        NSLog(@"Event: %@", eventName);
    
        if(payload)
            NSLog(@"Payload: %@", payload);
    }
    

支持

我们很乐意帮助您解决代码或其他任何问题。尽快、尽可能顺利地将PopUp Store集成到您的应用程序中对我们来说非常重要。

邮箱: [email protected]

Twitter: CanvasPopApi

需要更多关于API本身的信息?请查看https://developers.canvaspop.com/

错误

在库或文档中发现了错误吗?

请随时在此处报告任何问题:https://github.com/canvaspop/canvaspop-ios-library/issues