官方教程 收藏本版 已有2人收藏 +发表新主题
查看: 17025|回复: 0
打印 上一主题 下一主题

metaio Cloud Plugin官方教程--IOS开发

[复制链接]

metaio Cloud Plugin官方教程--IOS开发

Luc_metaio 发表于 2014-6-16 13:55:15 浏览:  17025 回复:  0 只看该作者 复制链接
如果您打算基于metaio Cloud Plugin模板来开发应用,您只需要修改频道ID和Application Identifier即可

如果您想将metaio Cloud Plugin整合到您自己的应用上,请参照下列步骤:



将函数库导入Xcode

metaio Cloud Plugin是捆绑在metaio SDK上的

首先,将metaioSDK导入工程中。您可以直接在Finder中找到metaioSDK.framework,然后将其拖拉到Xcode的文件总览中

然后,将AugmentedReality文件夹中的文件拖拉到Xcode工程中,(根据需要)选择Copy items into destination group’s folder

之后,Xcode会将Plugin内容展开,如下图所示:





调整编译设置

使用Obj-C++编译

metaio Cloud Plugin是静态Obj-C++函数库,因此,包括MetaioCloudPlugin头文件在内的任何文件都必须用Obj-C++编译

要做到这点,您可以把文件扩展名改为.mm,或在Xcode中设置合理的定义

  • 连接器标签

由于Plugin在函数库中定义了一些Objective-C对象,请您为Other Linker Flags添加-ObjC



  • 所需框架

如果Xcode工程中没有下列框架/函数库,您需要人工添加:

  • libXML2.dylib, libz.dylib
  • AVFoundation, CoreVideo, CoreFoundation, CoreGraphics, CoreLocation, CoreMotion, CoreMedia, MediaPlayer, CFNetwork, Security, AudioToolbox, SystemConfiguration, MobileCoreServices, OpenGLES, QuartzCore, MapKit



启动ARViewController的代码示例:
  1. - (IBAction)onStartPushed:(id)sender
  2. {
  3.    // Create a new ARViewController. All channel details and properties are defined in that class.
  4.     // see ARViewController.mm for the implementation
  5.     ARViewController* metaioCloudPlugin = [[ARViewController alloc] init];

  6.     // present the viewcontroller
  7.     [self presentModalViewController:metaioCloudPlugin animated:YES];

  8.     // release it, because it's retained as modalViewController
  9.     [metaioCloudPlugin release];
  10. }
复制代码


调整MetaioCloudPluginDelegate协议的参数
  1. /**
  2. * Provide the channel number that should be opened by the plugin
  3. * In order to get your channel ID, please signup as a developer on http://www.junaio.com/developer
  4. * and create your own junaio channel.
  5. *
  6. * If you want to use a location based channel, be sure to return 'YES' for (BOOL) shouldUseLocation,
  7. * otherwise 'NO'.
  8. */
  9. - (NSInteger) getChannelID
  10. {
  11.     // TODO: fill in your channel ID here.
  12.     return 124471;        // AREL Test

  13.     // set locationAtStartup to YES, because we're loading a location based channel
  14.     // that needs the location at the first request
  15.     //m_useLocationAtStartup = YES;
  16.     //return 4796;    // Wikipedia EN channel
  17. }



  18. /** Optional
  19. *
  20. * return YES if the application should activate location sensors at startup
  21. * This will cause the application requesting permission at startup
  22. * Return YES here if you are using a location based channel that needs location at startup
  23. * Returning NO will cause the request to the server having no location
  24. */
  25. - (BOOL) shouldUseLocationAtStartup
  26. {
  27.     return m_useLocationAtStartup;
  28. }



  29. /** Optional
  30. *
  31. * return YES if the application should support location
  32. * If you return NO here, your application will never access the location sensors.
  33. * Most scan channels don't need a location, so NO can be returned here.
  34. */
  35. - (BOOL) shouldUseLocation
  36. {
  37.     return YES;
  38. }


  39. /** Optional
  40. *
  41. * return YES to cache downloaded files
  42. * During the development phase it makes sense to return NO here,
  43. * if the channel content changes a lot.
  44. */
  45. - (BOOL) shouldUseCache
  46. {
  47.     return YES;
  48. }


  49. /** Default implementation for Sharing a screenshot
  50. *
  51. * Feel free to adjust the source of ASImageSharingViewController to adjust its behavior or integrate the Facebook SDK
  52. */
  53. - (void) openSharingViewController: (UIImage*) imageToShare
  54. {
  55.     ASImageSharingViewController* controller = [[ASImageSharingViewController alloc] initWithNibName:@"ASImageSharingViewController" bundle:nil];
  56.     controller.imageToPost = imageToShare;
  57.     [self presentModalViewController:controller animated:YES];
  58.     [controller release];
  59. }
复制代码

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?立即注册

x
分享至:
| 人收藏
回复

使用道具 举报

*滑动验证:
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Copyright © 2013-2017 ARinChina-增强现实中国技术论坛   All Rights Reserved.