ios - 导入百度全景SDK后,SDK里结构体报错

查看:124
本文介绍了ios - 导入百度全景SDK后,SDK里结构体报错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

问 题

导入百度全景SDK后,SDK里结构体报错,在demo里就可以这样写结构体,在自己的工程里就不可以这样写..是哪个地方没有配置好呢

解决方案

Structs don't have initializers, if you want to create a struct with a particular set of values you could write a function that returns creates and initialises it for you:

For example

struct Data {
        BOOL isInit;
        BOOL isRegister;
        NSString* myValue;
};

Data MakeInitialData () {
    data Data;
    data.isInit = NO;
    data.isRegister = NO;
    data.myValue = @"mYv4lue";

    return data;
}

now you can get a correctly set up struct with:

Data newData = MakeInitialData();

A note, though; you seem to be using ARC, which doesn't work well with structs that have object pointers in them. The recommendation in this case is to just use a class instead of a struct.

这篇关于ios - 导入百度全景SDK后,SDK里结构体报错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆