As you aware that the famous _XPConnectionHasEntitlement has no longer works in iOS 8, is there anyother way to bypass the entitlements with the tweaks that requires entitlements? I come to know that _BSAuditTokenTaskHasEntitlement might solve the issue, but I can't get through it.
I'm using following snippet of code to hook into backboardd & assertionsd.
static int (*orig_BSAuditTokenTaskHasEntitlement)(id connection, NSString *entitlement);
static int hooked_BSAuditTokenTaskHasEntitlement(id connection, NSString *entitlement) {
NSLog(#"Got it.");
if (xpc_connection_get_pid(connection) == [[UIDevice currentDevice] __qrwaGetPIDForProcess:#"SpringBoard"] && [entitlement isEqualToString:#"com.apple.multitasking.unlimitedassertions"]) {
return 1;
} else {
return orig_BSAuditTokenTaskHasEntitlement(connection, entitlement);
}
}
%ctor {
%init;
MSHookFunction(((int *)MSFindSymbol(NULL, "_BSAuditTokenTaskHasEntitlement")), (int*) hooked_BSAuditTokenTaskHasEntitlement, (int**) &orig_BSAuditTokenTaskHasEntitlement);
}
The problem with it, the NSLog statements never printed. So I feel that something wrong with syntax of the function _BSAuditTokenTaskHasEntitlement, but not sure.
If anyone points me right direction, I appreciate their help.
Related
I have one method in which there is one condition which checks the bool value and do some task based on the condition. It is working perfectly in the debug build but in the release build the bool value always return true.
Below is sample code of the method which is behaving differently in debug and release version.
-(void)addNotification:(NSMutableDictionary *)dictNotificationData
{
BOOL addNotification;
if ([[dictNotificationData objectForKey:#"id"] integerValue] == 2) {
if ([[dictNotificationData objectForKey:#"isActive"] boolValue]) {
addNotification = YES;
}
}
else {
addNotification = NO;
}
//In the release version this value always return true eventhough it is going in the else part.
if (addNotification) {
//code for local notification
}
}
Please let me know if any one has any idea about why it is behaving differently in debug and release version.
Actually I found the solution for that. The Bool local variable always initialised as garbage value if we do not provide any which was creating the problem in my case. When I initialised BOOL addNotification = NO; it works fine.
Found the answer here.
Default value of BOOL
Thanks All.
Not the question that you are asking but in your code is it possible that addNotification is tested before it is initialised - if the second 'if' is false.
For boolValue check please try this
NSNumber * isSuccessNumber = (NSNumber *)[response objectForKey: #"success"];
if([isSuccessNumber boolValue] == YES)
{
} else
{
}
Boolen value can be changed on the device version. So what the result for this line, if this line return 0 or 1, can be change the result. [dictNotificationData objectForKey:#"isActive"]
For instance, run your code on both 32-bit iOS and 64-bit iOS. It should correctly display “Different” on one, but not the other.
if (different(1, 2)) {
NSLog(#"Different!");
} else {
NSLog(#"Not different.");
}
When I am writing a tweak application with
[[UIATarget localTarget].frontMostApp isVisible] in main.mm main function, I get the exception saying
* exception UIAutomation is not enabled on this device. UIAutomation must be enabled in Settings. *
But I have Enabled Settings->Developer->Enable Automation UI in device. iOS version:8.1.2 and 8.0.1 jail broken.
int main(int argc, char **argv, char **envp)
{
#autoreleasepool {
#try
{
[[UIATarget localTarget].frontMostApp isVisible];
if ([UIATarget localTarget].springboard.pid == nil)
{
return 0;
}
}
#catch (NSException *exception)
{
NSLog(#"*** exception %# ***",exception);
return 0;
}
}
}
I have seen this link https://github.com/kif-framework/KIF/issues/707 and some Apple reference documents for UIATarget frontMostApp but I found no solution so far.
Is this problem with the iOS version ? How can I solve this? Any help is appreciated.
Your UIAuomation settings plist will be separately created for each application in case of tweaks.
Enable it in /private/var/mobile/Containers/Data/Application/XXXXXXXX-ACAB-4FC9-AE3E-XXXXXX/Library/Preferences/com.apple.UIAutomation.plist and Reboot your device to get rid of this error.
So I'm not sure if this is an issue with Unity or with the Facebook Unity SDK, or something I might be doing? It only started appearing recently, it was working perfectly fine up until I had to update Unity for iOS9 font issues.
The point at which it crashes in Xcode is:
+ (instancetype)instanceWithRequestID:(int)requestID
{
FBUnitySDKDelegate *instance = [[FBUnitySDKDelegate alloc] init];
instance->_requestID = requestID;
[g_instances addObject:instance]; // Breaks on this line. instance is nil
return instance;
}
And the code I am using for the AppRequest is
public void RequestLivesFromFriends(string[] friendIds)
{
if(!FB.IsLoggedIn)
{
LoginToFacebook ();
return;
}
FB.AppRequest(
"Please send me a life!",
Facebook.Unity.OGActionType.ASKFOR,
livesIdValue,
friendIds,
"RequestLife",
"Request a life from your friends",
requestLifeCallback
);
}
Is there currently an issue with the SDK's? Or am I just doing something wrong?
Well, I found the solution myself in the end.
I had -fno-objc-arc set as the Compiler Flag on FBUnitySDKDelegate.m
Apparently, having that on with the more recent versions of the SDK (or maybe something else was causing it, I'm not exactly sure) causes the NSMutableArray g_instances to be converted to an NSString. So when the code tries to add the FBUnitySDKDelegate object 'instance' to g_instances, it is trying to call addObject on an NSString, passing in an FBUnitySDKDelegate, which obviously doesn't work.
So yeah, if you have this problem, check for Compiler Flags on the file.
So, this code runs properly, without causing any crashes in the iOS simulator. However, on my iOS device (my iPhone), this causes a crash! Can anyone guess why? The logs haven't helped anywhere.
NSInteger loops = 1;
char character = '.';
if ([futureTr rangeOfString:[NSString stringWithFormat:#"%c",character]].location != NSNotFound) {
NSArray *dotsArray = [futureTr componentsSeparatedByString:[NSString stringWithFormat:#"%c",character]];
loops = [dotsArray count];
if ([[dotsArray objectAtIndex:loops-1] isEqualToString:#""] || [dotsArray objectAtIndex:loops-1] == nil) {
loops--;
}
}
And I know that it's this statement that causes trouble, because I comment it out and the app just works fine! What can be going on?
Based on the discussion in the comments, the problem is that futureTr is being released at some point and this code then attempts to use the now deallocated pointer resulting in the "BAD_ACCESS" exception.
Proper memory management of this variable will alleviate the problem.
I am new to the jailbreak tweak development scene. I am trying to figure out the appropriate method to 'hook' so I can intercept an incoming call (and then run some code).
I have dumped the header files of CoreTelephony framework however no methods seem obvious to hook. I have tried:
- (void)broadcastCallStateChangesIfNeededWithFailureLogMessage:(id)arg1;
- (BOOL)setUpServerConnection;
but neither have worked. By worked I mean - get called when the iPhone receives a call.
Any pointers as to the appropriate method to hook? Thanks :)
Note:
This is going to be a jailbreak tweak using private APIs so it won't be submitted to the App Store.
I didn't test your code, but I think your problem might be that you need to use the Core Telephony notification center to register for that event (not what you had in the code in your comment). Something like this:
// register for all Core Telephony notifications
id ct = CTTelephonyCenterGetDefault();
CTTelephonyCenterAddObserver(ct, // center
NULL, // observer
telephonyEventCallback, // callback
NULL, // event name (or all)
NULL, // object
CFNotificationSuspensionBehaviorDeliverImmediately);
and your callback function is
static void telephonyEventCallback(CFNotificationCenterRef center, void *observer, CFStringRef name, const void *object, CFDictionaryRef userInfo)
{
NSString *notifyname = (NSString*)name;
if ([notifyname isEqualToString:#"kCTCallIdentificationChangeNotification"])
{
NSDictionary* info = (NSDictionary*)userInfo;
CTCall* call = (CTCall*)[info objectForKey:#"kCTCall"];
NSString* caller = CTCallCopyAddress(NULL, call);
if (call.callState == CTCallStateDisconnected)
{
NSLog(#"Call has been disconnected");
}
else if (call.callState == CTCallStateConnected)
{
NSLog(#"Call has just been connected");
}
else if (call.callState == CTCallStateIncoming)
{
NSLog(#"Call is incoming");
}
else if (call.callState == CTCallStateDialing)
{
NSLog(#"Call is Dialing");
}
else
{
NSLog(#"None of the conditions");
}
}
}
I offer another technique in this similar question here. Also, note my comment in that question about not getting the notifications in a UIApplication that has been put into the background.
Update: see cud_programmer's comment below about using kCTCallStatus on iOS 6 instead of kCTCall.
Is it possible?
Yes.
Would a regular average person with no background in computer engineering or knowhow of how cell towers work be capable of something like this?
No.
Technically you can buy router looking thing to do this which aren’t cheap, are illegal and cellphone companies can actually track them down since it interferes with the network. So other than government agencies or international spies i don’t think you have anything to worry about. But if the government is exactly what you’re worried about well I’m sorry to tell you they’ve been doing a lot more then intercepting just phones