DJI SDK iOS 开发之二:搭建基本的开发环境

来源:互联网 发布:北风网大数据实战破解 编辑:程序博客网 时间:2024/06/09 19:17

本文想介绍搭建基本的DJI SDK iOS下的开发环境,不过DJI官方已经给出了很详细的运行其demo的教程,网址如下:
https://dev.dji.com/cn/guide
我这里总结一下搭建一个新的工程的步骤:

Step 1:注册一个app
这里写图片描述

这里的识别码和app密钥很重要。DJI在这里做了限制。
对于iOS开发来说,识别码就是工程的bundle identifier。密钥则使用SDK在运行时对程序进行注册。

Step 2:建立工程

Step 3:导入DJISDK.Framework
这个在下载的SDK中lib文件夹里面。
这里写图片描述
还需要链接 libz.dylib这个库。

Step 3:加入注册代码

AppDelegate.h#import <DJISDK/DJISDK.h>@interface AppDelegate : UIResponder <UIApplicationDelegate,DJIAppManagerDelegate>AppDelegate.mm- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {    // Override point for customization after application launch.    //Register App with key    NSString* appKey = @"57ecf55facf5564967f33333";    [DJIAppManager registerApp:appKey withDelegate:self];    return YES;}- (void)appManagerDidRegisterWithError:(int)errorCode{    NSString* message = @"Register App Successed!";    if (errorCode != RegisterSuccess) {        message = @"Register App Failed!";    }    UIAlertView* alertView = [[UIAlertView alloc] initWithTitle:@"Register App" message:message delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil];    [alertView show];}

需要注意的是因为其SDK使用了c++,所以要把m后缀改成mm

这样基本的工程就能运行了。
对于链接视频库,在官方文档中有详细介绍,这里不多讲。

OK,这样我们就可以开始真正进行具体开发了。
【注明:本文为原创文章,转载请注明出处:blog.csdn.net/songrotek】

0 0