gpt4 book ai didi

c++ - 编译时出错 : control may reach end of non-void function

转载 作者:太空宇宙 更新时间:2023-11-04 08:43:54 26 4
gpt4 key购买 nike

我正在尝试在我的设备上使用 theos 创建我的第一个 mobilesubstrate tweak但是当我编译时我得到了这个错误

Tweak.xm:23:1: error: control may reach end of non-void function [-Werror,-Wreturn-type]

我的 Tweak.xm

#import <UIKit/UIKit.h>
#import <Foundation/Foundation.h>

static NSMutableDictionary *plist = [[NSMutableDictionary alloc] initWithContentsOfFile:@"/var/mobile/Library/Preferences/com.myplist.customwapprefs.plist"];

static BOOL pictureFit = NO;

static id connection = nil;

%hook WAPhotoMoveAndScaleViewController

- (BOOL)mustScaleToFill {


pictureFit = [[plist objectForKey:@"photofit"]boolValue];

if (pictureFit) {
return NO;
}
else if (!pictureFit) {
return %orig;
}
}

%end

请具体说明我是 objective-c 的新手,谢谢

最佳答案

if (pictureFit) {
return NO;
}
else if (!pictureFit) {
return %orig;
}

您不需要 else 部分中的第二个条件。删除它,编译器应该会很高兴

关于c++ - 编译时出错 : control may reach end of non-void function,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22437539/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com