C++ 编译时出错:控件可能到达非void函数的末尾

C++ 编译时出错:控件可能到达非void函数的末尾,c++,ios,objective-c,c,theos,C++,Ios,Objective C,C,Theos,我正在尝试在我的设备上使用theos创建我的第一个mobilesubstrate调整 但是当我编译的时候,我得到了这个错误 Tweak.xm:23:1:错误:控件可能到达非无效函数的末尾[-Werror,-Wreturn type] 我的Tweak.xm #import <UIKit/UIKit.h> #import <Foundation/Foundation.h> static NSMutableDictionary *plist = [[NSMutableDict

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

Tweak.xm:23:1:错误:控件可能到达非无效函数的末尾[-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
#导入
#进口
静态NSMutableDictionary*plist=[[NSMutableDictionary alloc]initWithContentsOfFile:@/var/mobile/Library/Preferences/com.myplist.customwapprefs.plist];
静态BOOL pictureFit=否;
静态id连接=零;
%吊钩移动和缩放控制器
-(BOOL)mustScaleToFill{
pictureFit=[[plist objectForKey:@“photofit”]布尔值];
if(pictureFit){
返回否;
}
如果(!pictureFit){
返回%orig;
}
}
%结束
请具体说明我对objective-c和所有这些都是新手,谢谢

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

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

很好,然后尝试完全删除
else
<代码>如果(pictureFit){返回否;}返回%orig我通过添加
返回%orig在最后两个括号之间,现在我测试了你在最后一条评论中所说的内容,效果也很好。谢谢你,伙计,我会接受你的答案而不是我的。谢谢