Question

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

Was it helpful?

Solution

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top