首页 > 导入百度全景SDK后,SDK里结构体报错

导入百度全景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.

【热门文章】
【热门文章】