如果您打算基于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的代码示例:- - (IBAction)onStartPushed:(id)sender
- {
- // Create a new ARViewController. All channel details and properties are defined in that class.
- // see ARViewController.mm for the implementation
- ARViewController* metaioCloudPlugin = [[ARViewController alloc] init];
-
- // present the viewcontroller
- [self presentModalViewController:metaioCloudPlugin animated:YES];
-
- // release it, because it's retained as modalViewController
- [metaioCloudPlugin release];
- }
复制代码
调整MetaioCloudPluginDelegate协议的参数- /**
- * Provide the channel number that should be opened by the plugin
- * In order to get your channel ID, please signup as a developer on http://www.junaio.com/developer
- * and create your own junaio channel.
- *
- * If you want to use a location based channel, be sure to return 'YES' for (BOOL) shouldUseLocation,
- * otherwise 'NO'.
- */
- - (NSInteger) getChannelID
- {
- // TODO: fill in your channel ID here.
- return 124471; // AREL Test
-
- // set locationAtStartup to YES, because we're loading a location based channel
- // that needs the location at the first request
- //m_useLocationAtStartup = YES;
- //return 4796; // Wikipedia EN channel
- }
-
-
-
- /** Optional
- *
- * return YES if the application should activate location sensors at startup
- * This will cause the application requesting permission at startup
- * Return YES here if you are using a location based channel that needs location at startup
- * Returning NO will cause the request to the server having no location
- */
- - (BOOL) shouldUseLocationAtStartup
- {
- return m_useLocationAtStartup;
- }
-
-
-
- /** Optional
- *
- * return YES if the application should support location
- * If you return NO here, your application will never access the location sensors.
- * Most scan channels don't need a location, so NO can be returned here.
- */
- - (BOOL) shouldUseLocation
- {
- return YES;
- }
-
-
- /** Optional
- *
- * return YES to cache downloaded files
- * During the development phase it makes sense to return NO here,
- * if the channel content changes a lot.
- */
- - (BOOL) shouldUseCache
- {
- return YES;
- }
-
-
- /** Default implementation for Sharing a screenshot
- *
- * Feel free to adjust the source of ASImageSharingViewController to adjust its behavior or integrate the Facebook SDK
- */
- - (void) openSharingViewController: (UIImage*) imageToShare
- {
- ASImageSharingViewController* controller = [[ASImageSharingViewController alloc] initWithNibName:@"ASImageSharingViewController" bundle:nil];
- controller.imageToPost = imageToShare;
- [self presentModalViewController:controller animated:YES];
- [controller release];
- }
复制代码 |
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
|
|
|
|
|