문제

I'm trying to create my first mobilesubstrate tweak using theos on my device but when i'm compiliing im getting this error

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

My 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

Please be specific i'm new to objective-c and all this, Thank you

도움이 되었습니까?

해결책

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

You don't need the second condition in the else part. Remove it and the compiler should be happy

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top