//
// -[iRate checkForConnectivityInBackground] from 0x10044bff4 to 0x10044c8a0 (2220 bytes)
//
// 1 xrefs:
// > ??> @ 0x1009cf7f0
//
// This function is hookable on this platform (idp: arm, 32 bit: False, 64 bit: True!
//
// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings
// Generated at Fri, 27 Nov 2026 11:05:18 +0000
//
void __cdecl -[iRate checkForConnectivityInBackground](iRate *self, SEL a2)
{
void *v3; // x19
NSString *v4; // x23
NSString *v5; // x22
NSNumber *v6; // x23
NSString *v7; // x0
NSString *v8; // x21
NSURL *v9; // x23
NSURLRequest *v10; // x22
NSData *v11; // x24
id v12; // x23
NSError *v13; // x27
__int64 v14; // x0
__int64 v15; // x28
id v16; // x26
void *v17; // x28
NSString *v18; // x25
NSNumber *v19; // x26
NSDictionary *v20; // x26
NSError *v21; // x22
NSString *v22; // x27
unsigned int v23; // w28
id v24; // x27
id v25; // x27
NSDictionary *v26; // x22
NSString *v27; // x27
void *v28; // x28
NSString *v29; // x27
NSDictionary *v30; // x28
NSDictionary *v31; // x28
NSString *v32; // x27
NSNumber *v33; // x28
NSDictionary *v34; // x22
NSDictionary *v35; // x0
NSURL *v36; // x22
NSString *v37; // x25
unsigned __int64 appStoreID; // x22
const char *v39; // x2
iRate *v40; // x0
NSError *v41; // x3
NSURLRequest *v42; // [xsp+18h] [xbp-B8h]
id v43; // [xsp+20h] [xbp-B0h] BYREF
id v44; // [xsp+28h] [xbp-A8h] BYREF
id v45; // [xsp+30h] [xbp-A0h] BYREF
NSErrorUserInfoKey v46; // [xsp+38h] [xbp-98h] BYREF
NSString *v47; // [xsp+40h] [xbp-90h] BYREF
NSErrorUserInfoKey v48; // [xsp+48h] [xbp-88h] BYREF
const __CFString *v49; // [xsp+50h] [xbp-80h] BYREF
NSErrorUserInfoKey v50; // [xsp+58h] [xbp-78h] BYREF
NSDictionary *v51; // [xsp+60h] [xbp-70h] BYREF
NSErrorUserInfoKey v52; // [xsp+68h] [xbp-68h] BYREF
const __CFString *v53; // [xsp+70h] [xbp-60h] BYREF
if ( +[NSThread isMainThread](&OBJC_CLASS___NSThread, "isMainThread") )
{
-[iRate performSelectorInBackground:withObject:](
self,
"performSelectorInBackground:withObject:",
"checkForConnectivityInBackground",
0);
return;
}
v3 = objc_autoreleasePoolPush();
if ( (byte_1009F7480 & 1) == 0 )
{
byte_1009F7480 = 1;
v4 = objc_retainAutoreleasedReturnValue(-[iRate appStoreCountry](self, "appStoreCountry"));
v5 = objc_retainAutoreleasedReturnValue(
+[NSString stringWithFormat:](
&OBJC_CLASS___NSString,
"stringWithFormat:",
CFSTR("http://itunes.apple.com/%@/lookup"),
v4));
objc_release(v4);
if ( self->_appStoreID )
{
v6 = objc_retainAutoreleasedReturnValue(+[NSNumber numberWithUnsignedInteger:](&OBJC_CLASS___NSNumber, "numberWithUnsignedInteger:"));
v7 = -[NSString stringByAppendingFormat:](v5, "stringByAppendingFormat:", CFSTR("?id=%@"), v6);
}
else
{
v6 = objc_retainAutoreleasedReturnValue(-[iRate applicationBundleID](self, "applicationBundleID"));
v7 = -[NSString stringByAppendingFormat:](v5, "stringByAppendingFormat:", CFSTR("?bundleId=%@"), v6);
}
v8 = objc_retainAutoreleasedReturnValue(v7);
objc_release(v5);
objc_release(v6);
if ( -[iRate verboseLogging](self, "verboseLogging") )
NSLog(&CFSTR("iRate is checking %@ to retrieve the App Store details...").isa, v8);
v9 = objc_retainAutoreleasedReturnValue(+[NSURL URLWithString:](&OBJC_CLASS___NSURL, "URLWithString:", v8));
v10 = objc_retainAutoreleasedReturnValue(
+[NSURLRequest requestWithURL:cachePolicy:timeoutInterval:](
&OBJC_CLASS___NSURLRequest,
"requestWithURL:cachePolicy:timeoutInterval:",
v9,
2,
60.0));
objc_release(v9);
v44 = nullptr;
v45 = nullptr;
v42 = v10;
v11 = objc_retainAutoreleasedReturnValue(
+[NSURLConnection sendSynchronousRequest:returningResponse:error:](
&OBJC_CLASS___NSURLConnection,
"sendSynchronousRequest:returningResponse:error:",
v10,
&v45,
&v44));
v12 = objc_retain(v45);
v13 = (NSError *)objc_retain(v44);
v14 = (__int64)objc_msgSend(v12, "statusCode");
v15 = v14;
if ( !v11 || v14 != 200 )
{
if ( v14 < 400 )
goto LABEL_48;
v19 = objc_retainAutoreleasedReturnValue(+[NSNumber numberWithInteger:](&OBJC_CLASS___NSNumber, "numberWithInteger:", v14));
v18 = objc_retainAutoreleasedReturnValue(
+[NSString stringWithFormat:](
&OBJC_CLASS___NSString,
"stringWithFormat:",
CFSTR("The server returned a %@ error"),
v19));
objc_release(v19);
v46 = NSLocalizedDescriptionKey;
v47 = v18;
v20 = objc_retainAutoreleasedReturnValue(
+[NSDictionary dictionaryWithObjects:forKeys:count:](
&OBJC_CLASS___NSDictionary,
"dictionaryWithObjects:forKeys:count:",
&v47,
&v46,
1));
v21 = objc_retainAutoreleasedReturnValue(
+[NSError errorWithDomain:code:userInfo:](
&OBJC_CLASS___NSError,
"errorWithDomain:code:userInfo:",
CFSTR("HTTPResponseErrorDomain"),
v15,
v20));
objc_release(v13);
v13 = v21;
goto LABEL_46;
}
objc_release(v13);
if ( objc_opt_class(&OBJC_CLASS___NSJSONSerialization) )
{
v43 = nullptr;
v16 = objc_retainAutoreleasedReturnValue(
+[NSJSONSerialization JSONObjectWithData:options:error:](
&OBJC_CLASS___NSJSONSerialization,
"JSONObjectWithData:options:error:",
v11,
0,
&v43));
v13 = (NSError *)objc_retain(v43);
v17 = objc_retainAutoreleasedReturnValue(objc_msgSend(v16, "objectForKeyedSubscript:", CFSTR("results")));
v18 = objc_retainAutoreleasedReturnValue(objc_msgSend(v17, "lastObject"));
objc_release(v17);
objc_release(v16);
if ( v13 )
{
LABEL_47:
objc_release(v18);
LABEL_48:
if ( !v13 )
goto LABEL_52;
if ( (void *)-[NSError code](v13, "code") == (void *)1 )
{
v37 = objc_retainAutoreleasedReturnValue(-[NSError domain](v13, "domain"));
if ( -[NSString isEqualToString:](v37, "isEqualToString:", NSPOSIXErrorDomain) )
{
appStoreID = self->_appStoreID;
objc_release(v37);
if ( appStoreID )
{
LABEL_52:
if ( !-[iRate appStoreID](self, "appStoreID") && !-[iRate previewMode](self, "previewMode") )
goto LABEL_58;
v39 = "connectionSucceeded";
v40 = self;
v41 = nullptr;
LABEL_57:
-[iRate performSelectorOnMainThread:withObject:waitUntilDone:](
v40,
"performSelectorOnMainThread:withObject:waitUntilDone:",
v39,
v41,
1);
LABEL_58:
byte_1009F7480 = 0;
objc_release(v11);
objc_release(v42);
objc_release(v12);
objc_release(v13);
objc_release(v8);
goto LABEL_59;
}
}
else
{
objc_release(v37);
}
}
v39 = "connectionError:";
v40 = self;
v41 = v13;
goto LABEL_57;
}
}
else
{
v18 = (NSString *)objc_msgSend(objc_alloc((Class)&OBJC_CLASS___NSString), "initWithData:encoding:", v11, 4);
}
v20 = (NSDictionary *)objc_retainAutoreleasedReturnValue(-[iRate valueForKey:inJSON:](self, "valueForKey:inJSON:", CFSTR("bundleId"), v18));
if ( v20 )
{
v22 = objc_retainAutoreleasedReturnValue(-[iRate applicationBundleID](self, "applicationBundleID"));
v23 = (unsigned int)-[NSDictionary isEqualToString:](v20, "isEqualToString:", v22);
objc_release(v22);
if ( v23 )
{
if ( !-[iRate appStoreGenreID](self, "appStoreGenreID") )
{
v24 = objc_retainAutoreleasedReturnValue(-[iRate valueForKey:inJSON:](self, "valueForKey:inJSON:", CFSTR("primaryGenreId"), v18));
-[iRate setAppStoreGenreID:](self, "setAppStoreGenreID:", objc_msgSend(v24, "integerValue"));
objc_release(v24);
}
if ( !self->_appStoreID )
{
v25 = objc_retainAutoreleasedReturnValue(-[iRate valueForKey:inJSON:](self, "valueForKey:inJSON:", CFSTR("trackId"), v18));
-[iRate performSelectorOnMainThread:withObject:waitUntilDone:](
self,
"performSelectorOnMainThread:withObject:waitUntilDone:",
"setAppStoreIDOnMainThread:",
v25,
1);
if ( -[iRate verboseLogging](self, "verboseLogging") )
NSLog(&CFSTR("iRate found the app on iTunes. The App Store ID is %@").isa, v25);
objc_release(v25);
}
if ( -[iRate onlyPromptIfLatestVersion](self, "onlyPromptIfLatestVersion")
&& !-[iRate previewMode](self, "previewMode") )
{
v26 = (NSDictionary *)objc_retainAutoreleasedReturnValue(-[iRate valueForKey:inJSON:](self, "valueForKey:inJSON:", CFSTR("version"), v18));
v27 = objc_retainAutoreleasedReturnValue(-[iRate applicationVersion](self, "applicationVersion"));
v28 = -[NSDictionary compare:options:](v26, "compare:options:", v27, 64);
objc_release(v27);
if ( v28 == (void *)1 )
{
if ( -[iRate verboseLogging](self, "verboseLogging") )
{
v29 = objc_retainAutoreleasedReturnValue(-[iRate applicationVersion](self, "applicationVersion"));
NSLog(
&CFSTR("iRate found that the installed application version (%@) is not the latest version on the App Store, which is %@").isa,
v29,
v26);
objc_release(v29);
}
v52 = NSLocalizedDescriptionKey;
v53 = CFSTR("Installed app is not the latest version available");
v30 = objc_retainAutoreleasedReturnValue(
+[NSDictionary dictionaryWithObjects:forKeys:count:](
&OBJC_CLASS___NSDictionary,
"dictionaryWithObjects:forKeys:count:",
&v53,
&v52,
1));
v13 = objc_retainAutoreleasedReturnValue(
+[NSError errorWithDomain:code:userInfo:](
&OBJC_CLASS___NSError,
"errorWithDomain:code:userInfo:",
CFSTR("iRateErrorDomain"),
3,
v30));
objc_release(v30);
}
else
{
v13 = nullptr;
}
v35 = v26;
goto LABEL_40;
}
LABEL_45:
v13 = nullptr;
goto LABEL_46;
}
if ( -[iRate verboseLogging](self, "verboseLogging") )
{
v32 = objc_retainAutoreleasedReturnValue(-[iRate applicationBundleID](self, "applicationBundleID"));
v33 = objc_retainAutoreleasedReturnValue(
+[NSNumber numberWithUnsignedInteger:](
&OBJC_CLASS___NSNumber,
"numberWithUnsignedInteger:",
-[iRate appStoreID](self, "appStoreID")));
NSLog(
&CFSTR("iRate found that the application bundle ID (%@) does not match the bundle ID of the app found on iTunes (%@) "
"with the specified App Store ID (%@)").isa,
v32,
v20,
v33);
objc_release(v33);
objc_release(v32);
}
v50 = NSLocalizedDescriptionKey;
v31 = objc_retainAutoreleasedReturnValue(
+[NSString stringWithFormat:](
&OBJC_CLASS___NSString,
"stringWithFormat:",
CFSTR("Application bundle ID does not match expected value of %@"),
v20));
v51 = v31;
v34 = objc_retainAutoreleasedReturnValue(
+[NSDictionary dictionaryWithObjects:forKeys:count:](
&OBJC_CLASS___NSDictionary,
"dictionaryWithObjects:forKeys:count:",
&v51,
&v50,
1));
v13 = objc_retainAutoreleasedReturnValue(
+[NSError errorWithDomain:code:userInfo:](
&OBJC_CLASS___NSError,
"errorWithDomain:code:userInfo:",
CFSTR("iRateErrorDomain"),
1,
v34));
objc_release(v34);
}
else
{
if ( !self->_appStoreID )
{
v36 = objc_retainAutoreleasedReturnValue(-[iRate ratingsURL](self, "ratingsURL"));
objc_release(v36);
if ( v36 )
{
if ( !self->_appStoreID && -[iRate verboseLogging](self, "verboseLogging") )
NSLog(&CFSTR("iRate could not find your app on iTunes. If your app is not yet on the store or is not intended for A"
"pp Store release then don't worry about this").isa);
goto LABEL_45;
}
}
if ( -[iRate verboseLogging](self, "verboseLogging") )
NSLog(&CFSTR("iRate could not find this application on iTunes. If your app is not intended for App Store release then y"
"ou must specify a custom ratingsURL. If this is the first release of your application then it's not"
" a problem that it cannot be found on the store yet").isa);
if ( -[iRate previewMode](self, "previewMode") )
goto LABEL_45;
v48 = NSLocalizedDescriptionKey;
v49 = CFSTR("The application could not be found on the App Store.");
v31 = objc_retainAutoreleasedReturnValue(
+[NSDictionary dictionaryWithObjects:forKeys:count:](
&OBJC_CLASS___NSDictionary,
"dictionaryWithObjects:forKeys:count:",
&v49,
&v48,
1));
v13 = objc_retainAutoreleasedReturnValue(
+[NSError errorWithDomain:code:userInfo:](
&OBJC_CLASS___NSError,
"errorWithDomain:code:userInfo:",
CFSTR("iRateErrorDomain"),
2,
v31));
}
v35 = v31;
LABEL_40:
objc_release(v35);
LABEL_46:
objc_release(v20);
goto LABEL_47;
}
LABEL_59:
objc_autoreleasePoolPop(v3);
}