-3

Hey guys i'm building a tweak for instagram i'm adding a sub preference called instatroll similar to trolltwitter to change the number of followers to any number the user sets (using PSEditTextCell) here is my code so far

#import <Foundation/Foundation.h>
static NSMutableDictionary *plist = [[NSMutableDictionary alloc]     initWithContentsOfFile:@"/var/mobile/Library/Preferences/com.idevicelover.InstaEnhancer.plist"];


NSNumber *chosenNumber = [NSNumber numberWithInt:999];
int number = chosenNumber;
static BOOL followerson = NO;


%hook IGUser -(void)setFollowerCount:(NSNumber*)fp8{
followerson = [[plist objectForKey:@"followerson"]boolValue];
if(followerson){

%orig(number);
}
else{
%orig;
}
}



%end


%ctor
{

NSDictionary *InstaEnhancer = [[NSDictionary alloc] initWithContentsOfFile:@"/var    /mobile    /Library/Preferences/com.idevicelover.InstaEnhancer.plist"];
 if ([InstaEnhancer objectForKey:@"numberoffollowers"]) number = [[InstaEnhancer objectForKey:@"numberoffollowers"] intValue];
[InstaEnhancer release];

}

i'm getting this error when compiling :"assigning to NSNumber * from incompatible type "int"

nhgrif
  • 61,578
  • 25
  • 134
  • 173
  • I don't know what is going on in your code... for 1 it is objective-c or maybe objective-c++ but certainly not c++ and what is `%end` this isn't lex right? – Grady Player Jun 15 '14 at 14:06
  • This is almost Objective-C, but some of the things look odd for Objective-C. Normally, we'd see `@end` sure, but I have no idea what `%hook`, `%orig`, or `%ctor` are... but since the real problem is with `NSNumber`, the [tag:foundation] tag is appropriate since `NSNumber` is definitely out of that no matter the language you're using. – nhgrif Jun 15 '14 at 14:09
  • %hook, %orig, %end, %ctor and more are directives for [logos](http://iphonedevwiki.net/index.php/Logos), it's a preprocessor that simplifies tweak making. It's a component of Theos, which is why the tag is there (not Theos as in an OS, but a build environment). – uroboro Jun 15 '14 at 14:49
  • many didn't understand the language this is logos with objective C coded using theos (developed by dustin howett) to make substrate tweaks – user3551278 Jun 16 '14 at 08:10

1 Answers1

1

NSNumber is an object. In order to use it as a primitive data type such as an int, you have to pull that type of value out of it with the appropriate method:

NSNumber *chosenNumber = [NSNumber numberWithInt:999];
int number = [chosenNumber intValue];

Also, later on, here:

number = [[InstaEnhancer objectForKey:@"numberoffollowers"] intValue];

If at this point number is an int (I have no clue as this syntax isn't C++ or Objective-C) then this should be fine. But if number is of type NSNumber *, then you need to drop the call to intValue:

number = [InstaEnhancer objectForKey:@"numberoffollowers"];
nhgrif
  • 61,578
  • 25
  • 134
  • 173