Install IPA using itms-services from disk on iOS device [duplicate] - ios

I'm trying to install an iOS app from a plist on the device's filesystem.
NSString *launchNewPlistURL = [NSString stringWithFormat:#"itms-services://?action=download-manifest&url=file://%#",[self saveFilePath]];
[[UIApplication sharedApplication]openURL:[NSURL URLWithString:launchNewPlistURL]];
And I'm prompted with "(null) would like to install {myappname}". Usually (null) is the domain name the plist is coming from, but in this case it's null as it's a local file.
Is there anyway to specify the title in the plist or pass a fake domain name in the url?
Thanks,
Dan

You can use the project MongooseDaemon to create an HTTP local server.
With a domain similar to: http://192.168.xxx.xxx/yourplist.plist to install it.
Anyhow, I think you can't use it with an large IPA. I have tried with my IPA greater than 15MB and it is very, very slow to start the install.

I was in a similar situation, and went through the route of using Mongoose originally, but just today stumbled upon CocoaHttpServer.
With Mongoose, I was only getting about a 20% success rate serving up local plist/IPA files. Sometimes the localhost would like to install dialog never came up, sometimes install started and failed about halfway in, and sometimes it actually worked. Even worse, once an App failed, I had to completely uninstall and reinstall it, so all data was lost. I was never able to successfully "fix" a failed install.
So far, with just about 10-15 minutes of testing, the CocoaHttpServer hasn't failed, yet. I know this is a very small sample size, but my Mongoose success rate was around 10%.
self.httpServer = [[HTTPServer alloc] init];
[self.httpServer setType:#"_http._tcp."];
[self.httpServer setPort:8080];
//This is just a path where I save my IPA and Plist file locally.
//In my case it's /{NSDocumentDirectory}/install/
[self.httpServer setDocumentRoot:[self pathForLocalInstallFiles]];
Then the URL to the plist on the disk:
NSURL *plistUrl = [NSURL URLWithString:#"itms-services://?action=download-manifest&url=http://localhost:8080/appname.plist"];
[[UIApplication sharedApplication] openURL:plistUrl];
Inside the plist, where you have your URL that points to the local IPA file, I had success using either file:// or http://localhost/.

Related

Could not locate installed application Xcode

I am trying to build share extension. Created the target, fixed the project settings (provisioning profile, app group, NSExtension).
Tried to run and saw the logs I added to the three methods isContentValid, didSelectPost, and configurationItems. This is my first time to create a share extension so, I was just looking around first and see when each method is called.
Now for some reason (I don't know what I did wrong), I am unable to see the logs from the extension. When I hit the run button in Xcode, the message Finished running ... gets displayed in the status bar on top.
Tried to change the scheme settings to the extension in the executable field, I get the following message when trying to run:
Could not locate installed application
Install claimed to have succeeded, but application could not be found on device. bundleId = <my-bundle-id-value>
Followed every solution I could find on the internet. Tried the solution from here and here.
UPDATE
I wanted to check if the extension actually runs or just the logs don't work. So I added the following logic to isContentValid:
- (BOOL)isContentValid {
// Do validation of contentText and/or NSExtensionContext attachments here
NSLog(#"isContentValid");
NSUserDefaults * userDefaults = [[NSUserDefaults alloc] initWithSuiteName:#"<group-id>"];
[userDefaults setObject:#"haha" forKey:#"key"];
[userDefaults synchronize];
return YES;
}
and read then read the haha in the main application it worked! So, the question is: Why can't I debug the application? Why doesn't the application print the log statements. Developing without logging and/or debugging could take 2x, if not more, time.
UPDATE 2
The best I was able to come up with is to manually attach the debugger to the extension, add breakpoints here and there (where I wanted to put logs) and edited the breakpoints to log as action and continue after evaluation.

iOS - Accessing filesystem outside sandbox on a jailbroken device

I'm developing an app using theos [application_swift] and would like to gain access to the filesystem, outside the sandbox.
To my understanding, using the [application_swift] with theos should enable me to access files outside the sandbox, but I've tried using FileManager.default.fileExists(atPath:) to access the file I like and the result was that the file was not found.
Worth mentioning I'm obviously running on a jailbroken device running 11.2.
Am I missing something?
I've been able to solve this issue by adding com.apple.private.security.no-container to my entitlements file and adding them using codesign.
codesign --entitlements app.entitlements -f -s "iPhone Developer: xxxxxxxxxxxxxxxxx" MyApp.app
Jailbreak doesn't open everything to everyone, that's not how it works in general and could open different things depending on specific jailbreak. For example, electra on iOS 11 allows me to read SMS database from inside a regular app. But I still can't read someone else's sandbox. It all depends on how jailbreak is implemented and what it patches inside the kernel. It could even be that you can't access anything outside of the sandbox. That's actually would be preferable to preserve security of AppStore apps.
It could also be much simpler - Swift knows which paths you shouldn't try to access and throws an error without even actually trying to access them. Try to access the files with C or Objective-C as these are proven to work without any artificial restrictions.
If you're still looking for the answer to this, you must add the com.apple.private.security.no-sandbox entitlement to your app.
I like your plist permisson change. If you want an alternative, like #Creker said, try stat or access from C.
I have seen your problem, when trying to detect a Frida running on a jailbroken device:
NSString *frida_on_filesystem = #"/usr/sbin/frida-server";
NSURL *theURL = [ NSURL fileURLWithPath:frida_on_filesystem isDirectory:NO ];
NSError *err;
if ([ theURL checkResourceIsReachableAndReturnError:&err] == YES )
return YES;
if ( err != NULL ) {
NSLog(#"[*]🐝Error in file check: %ld", (long)err.code);
if ( err.code == 257 )
NSLog(#"[*]🐝Sandbox permission error.");
}
FILE *file;
file = fopen(frida_on_filesystem.fileSystemRepresentation, "r");
if ( !file )
NSLog(#"[*]🐝if ObjC APIs fails, fopen also failed!");
but then access() - which loads from libsystem_kernel.dylib - works:
return (access(frida_on_filesystem.fileSystemRepresentation, F_OK) == 0) ? YES : NO;

ios distribution preproduction and production version

I am developing an app for iPad which is using webservices. In current version I have a constant string which is the address of the server. Each time I want to check something I just change the address (from production, freezed version of app to preproduction, version that is equal to repository). The problem is I would like to have two versions of an app on iPad, but I think as long as the bundle identifier is the same it isn't possible. What is the proper way of doing so without creating another project? Can I have "two targets" which can distribute both versions of app with the only difference being the webservice address?
This problem will escalate when application will be delivered to the client, because whenever I will deploy test version the "freezed" version will be deleted.
Should I change the bundle identifier each time I change webservice address before deploy? Or maybe there is some "automated" way of doing so?
Thanks in advance
I wouldn't rely on the bundle identifier for your service call as you will end up with many version of your API in the server that you need to maintain. What you can do is to create a new target on your project and add a Pre processor macro to your Build settings and then you reference on that macro in your code to decide which URL use.
Then on your code:
- (NSURL *)url {
NSString *urlString = #"your://standars.url";
#if APITEST
urlString = #"your://test.url";
#endif
return [NSURL URLWithString:urlString];
}

Fresh SpeakHere example app has error when recording audio in Simulator/Xcode

I can't record audio using the SpeakHere example app from apple. When I run the app in Simulator from within Xcode, it starts up normally, but when I press the record button, the error "Thread 1: EXC_BREAKPOINT (code=EXC_I386_BPT, subcode=0x0)" occurs:
The log message about the missing root view controller at app startup is already there BEFORE the above error occurs and it is probably not connected to my problem.
I have downloaded the SpeakHere example project from the linked website (see top of this question), opened the fresh download in Xcode and directly started the app. I did not modify any setting and not any line of code. I've also searched on google and stackoverflow for this problem and didn't find a solution, although this problem must be very general.
I use Xcode Version 4.5.2 (4G2008a) and a MacBook Pro from late 2009 with Mac OS X 10.8.
I've also had a friend try this on his computer and he has the very same problem. He has the same OS and his XCode version is also 4.5.2.
I would now try older Xcode versions, but right now I don't like to download a few gigabytes for a trial'n'error approach on my connection.
Any help appreciated, including reports like "works for me with Xcode version ...". Thanks!
The problem occurs because in the method AQRecorder::StartRecord(CFStringRef inRecordFile), the function CFURLCreateWithString() fails and returns a pointer to nil. This is not detected and later on the code calls CFRelease() on this nil pointer, which causes the EXC_BREAKPOINT.
The purpose of the method CFURLCreateWithString() basically is to take a url string as input and return a pointer to a CFURL object as output. The problem here is that the input is not a url string. Instead, it's simply a path on the local file system without file:/ or the like as prefix. For this reason, this method fails.
The solution is to remove the not-working call to the method CFURLCreateWithString() and instead call a related method, namely CFURLCreateWithFileSystemPath(), which is prepared to take a local file system path and convert it to a CFURL:
In the method AQRecorder::StartRecord(CFStringRef inRecordFile), replace or comment out the line
url = CFURLCreateWithString(kCFAllocatorDefault, (CFStringRef)recordFile, NULL);
and insert
url = CFURLCreateWithFileSystemPath(kCFAllocatorDefault, (CFStringRef)recordFile, kCFURLPOSIXPathStyle, false);
at its place.
url = CFURLCreateWithFileSystemPath(kCFAllocatorDefault, (CFStringRef)recordFile, kCFURLPOSIXPathStyle, false);
The code above made my xcoce 4.6 compile and run in simulator, but it doesnot record my voice from my usb microphone, I test my microphone in the garash band application and sucessfully record and play my voice, and the dbmeter does not move at all, any way when I port it to the real device it work, it just can't record and play voice in my simulator.

Installing iOS Apps from a local plist (null) would like to install

I'm trying to install an iOS app from a plist on the device's filesystem.
NSString *launchNewPlistURL = [NSString stringWithFormat:#"itms-services://?action=download-manifest&url=file://%#",[self saveFilePath]];
[[UIApplication sharedApplication]openURL:[NSURL URLWithString:launchNewPlistURL]];
And I'm prompted with "(null) would like to install {myappname}". Usually (null) is the domain name the plist is coming from, but in this case it's null as it's a local file.
Is there anyway to specify the title in the plist or pass a fake domain name in the url?
Thanks,
Dan
You can use the project MongooseDaemon to create an HTTP local server.
With a domain similar to: http://192.168.xxx.xxx/yourplist.plist to install it.
Anyhow, I think you can't use it with an large IPA. I have tried with my IPA greater than 15MB and it is very, very slow to start the install.
I was in a similar situation, and went through the route of using Mongoose originally, but just today stumbled upon CocoaHttpServer.
With Mongoose, I was only getting about a 20% success rate serving up local plist/IPA files. Sometimes the localhost would like to install dialog never came up, sometimes install started and failed about halfway in, and sometimes it actually worked. Even worse, once an App failed, I had to completely uninstall and reinstall it, so all data was lost. I was never able to successfully "fix" a failed install.
So far, with just about 10-15 minutes of testing, the CocoaHttpServer hasn't failed, yet. I know this is a very small sample size, but my Mongoose success rate was around 10%.
self.httpServer = [[HTTPServer alloc] init];
[self.httpServer setType:#"_http._tcp."];
[self.httpServer setPort:8080];
//This is just a path where I save my IPA and Plist file locally.
//In my case it's /{NSDocumentDirectory}/install/
[self.httpServer setDocumentRoot:[self pathForLocalInstallFiles]];
Then the URL to the plist on the disk:
NSURL *plistUrl = [NSURL URLWithString:#"itms-services://?action=download-manifest&url=http://localhost:8080/appname.plist"];
[[UIApplication sharedApplication] openURL:plistUrl];
Inside the plist, where you have your URL that points to the local IPA file, I had success using either file:// or http://localhost/.

Resources