Jump to content

2 posts in this topic

Recommended Posts

Posted (edited)

Hi! Just started to learn Objective-C. Could someone help me please? I understand what these errors mean, but have no idea how to fix them.

 

 

Spoiler

%hook someClass
-(id) someMethod {
NSString *r = arc4random_uniform(100);
  return r;
  }
%end

Error:

48f1b7fcfbeeb00ea9d07.png

 

 

Spoiler

%hook someClass
-(id) someMethod {
  NSArray *array = [NSArray arrayWithObjects: @"one", @"two", @"three", @"four", nil];
  id randomObject = [array count] ? self[arc4random_uniform((u_int32_t)[array count])] : nil;
  return randomObject;
  }
%end

Error:

120acd362482545afd4f9.png

 

 

Updated by piqerez
Posted

in the first code, try NSValue or something maybe, youre trying to return an int to a string.

In the second one, there is no arc4random_uniform function in the class so try removing the "self"

  • Like 1
  • Agree 1

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
  • Create New...

Important Information

We would like to place cookies on your device to help make this website better. The website cannot give you the best user experience without cookies. You can accept or decline our cookies. You may also adjust your cookie settings. Privacy Policy - Guidelines