I need to access the sandbox directory for an application installed on an iOS device, using the command line (non-gui) from a Mac or Linux. This is to help with development and testing automation. Dropping a json file into the sandbox lets me set parameters like extra debug messages and smaller refresh intervals.
A tool like iFunBox works perfectly but is graphical only, requiring numerous clicks to do this. Emails to the developers were unanswered. It also does not support AppleScript. I did find another app that provided a Fuse module, but it turned out buggy especially if the app was uninstalled and then reinstalled (in order to reset back to first time user experience). I reported the problems to the developer but there is no fix on the horizon.
The things I need to do are:
Test if an app with a specific bundle id is installed
Create Library/Caches/MYLIBNAME directory if it doesn't exist
Copy a ~100 byte json file from the Mac to that directory
Get a copy of that file
A solution that only works from Linux is acceptable too
Devices are not jailbroken and I would prefer not to need that as a requirement
In some cases I do not have the source code to the app since it is a third party using my library, so compiling different versions of the app isn't practical.
Answer is below in many comments thanks to lxt. Summary is:
Various libraries and programs associated with libimobiledevice can solve the problems
Use patched iFuse to mount an application sandbox
Use idevicesyslog to see the console log
Use ideviceinstaller to install/uninstall apps
The various libraries and programs associated with libimobiledevice are incredibly difficult if not impossible to compile as is on Linux or Mac, and there is no unified distribution of the source or binaries
For Ubuntu try libimobiledevice (may have 3 suffix), ideviceinstaller and libimobiledevice-utils packages
For Mac a search for libimobiledevice-macosx may get you some of the way there
This is going to be a little tricky, because as I think you've found out the application name is randomly generated on every install. I don't think there is a way past that, certainly that I know of. This explains the problems you're running into when simulating a new install (...the app directory name changes to a new, random hash, and then you're stuck).
Although my preference would be to access this config file in some other way (perhaps over a network, and have some code that only executes on debug/test builds check for it), if you did want to do this then I'd suggest trying something like writing a script that when you want to simulate a new install chooses the app directory that's most recently modified. But this is very hacky.
If you're not able to insert conditional code that only executes on debug/ test builds then I think the random app naming schema that iOS uses at a file system level is going to be problematic for you whatever approach you take.
Update: Regarding iFuse and libimobiledevice - out of the box it limits you to the documents directory. This is because the authors of iFuse don't entry-level users to be confused, and also because the structure is a little different depending on iOS version. You can comment out the lines in the iFuse source - fuse_opt_add_arg(&args, "-osubdir=Documents"); - to get access to the library directory through the mount. You will obviously need to re-compile iFuse yourself if doing this.
You can make use of MobileDevice Library
I know this is an old question and I doubt anyone is looking here anymore, but I thought I'd mention that you can use 'brew install libimobiledevice' to compile on the mac. There are a lot of dependencies and Homebrew really helps make it an easy process by installing them for you.
Related
I'm trying to use the functionality of libimobiledevice on my iPad to do stuff like change location (idevicesetlocation) and etc. I have no problems if I install the Developer Disk Image using XCode, but as a primarily PC user, I would like to be able to use my program solely from my own computer. After trying the command ideviceimagemounter IMAGE_FILE IMAGE_SIGNATURE_FILE and using the files from https://github.com/mspvirajpatel/Xcode_Developer_Disk_Images/releases for the two files, I get these messages:
Mounting...
Error: mount_image returned -3
I've tried this with multiple different file sources and two different iOS devices with the same result. Any help would be appreciated, and let me know if I can clarify my question in any way, I've never really posted on here before. Thanks!
You're probably using an old version of libimobiledevice. The libimobiledevice team from time to time updates the codebase to maintain compatibility with new versions of libimobiledevice.
If you're on Windows, you can try to use the binaries from the libimobiledevice-win32 project which I maintain. The latest release is available at https://github.com/libimobiledevice-win32/imobiledevice-net/releases/tag/v1.3.6.
I made a nice (aren't they all) app using VS 2013, debugged, tested etc. without much fuss and muss.
Now I want to pass it out to some friends for reality check, and so used the VS2015.Tools.Android.Publish Android App... feature.
I followed the instructions, got a Release build signed APK (and a non-signed APK too). I e-mailed the signed APK to myself on the Motorola Razr Turbo, and installed just fine.
However, it does not run. It just flashes up then terminates. I have reviewed the Xamarin instructions and tried a number of things but I am blocked for now. This app runs fine on the same phone after I have deployed it during development (Release build as well as Debug).
I feel I am missing something obvious to all those who have traveled this path before, and really would appreciate a pointer to a happier place.
Two things to check:
I often have to uninstall the previous version of the app (the one deployed during debugging/development).
Also, if the app requires some special permissions, check that those are still allowed.
Got it! Ah yes, have to run the old zipalign on the signed package. Help here (thanks Nigel) took me to use LogCat, and there was the problem. Found some more help at:
https://forums.xamarin.com/discussion/4169/apk-no-longer-working-on-device
and put together a batch file to run it; one line:
"C:\Users\mike\AppData\Local\Android\android-sdk\build-tools\23.0.3\zipalign.exe" -f -v 4 ./bin/Release/MyFineApp.SoNice-Signed.apk ./WillRunNow.apk
This is the error messsage I get.
I know it's kind of an eye roller, that it's difficult nigh impossible to tell what I may need without the source, but it seems like a deployment problem as people that installed the Qt SDK can run it. Plus, I figured I'd have better luck asking here than with a chinese developer that speaks google-english.
So here's what I've done:
I installed the MSVC2012.
I used a program called cffexplorer to see what the exe was looking for. I have the 7 or so .dlls that are at the top of the tree.
I found a recent (jun 2013) qwindows.dll from elsewhere on my system and put it in ./plugins (I've tried this file in ./, ./plugins, and ./plugins/platforms
I created a qt.conf with the following data (I determined the format from an existing Qt based app that works)
[Paths]
Plugins = plugins
Yet, I continue to get this message. Any suggestions on what I might look for to clear this up?
Ask the developer what compiler was used to build the application. Then you will need the right dll (that was built with the same compiler as the application). Also notice that (by default) the documentation says that qwindows.dll should be in the platforms folder in the same path as your executable, read more here. Depending on whether the developer used a Qt built with angle, you may also need: libEGL.dll and libGLESv2.dll. Dependency walker might help you find dependencies that are not there.
I'm writing a script that will install some of the optional postgresql modules. Is there a way to programmatically figure out where the contrib directory is or do I have to prompt for the path? I've looked at a few examples and it seems inconsistent; doesn't appear in pg_config.
(The script might be run on OS X or linux, and I can't make assumptions about how postgresql was installed).
There is no easy works everywhere answer to this, so it's a matter of how much intelligence you want to try and put into your installer. And for some people it will be impossible to do what you hope for, the best you'll be able to do is offer guidance about what's missing. There is a lot of variation on packaging here between Linux distributions, versions of PostgreSQL, and the various ways you can install PostgreSQL on OS X (MacPorts, homebrew, etc.)
First off, only source code installs will have a contrib directory with source code in it that allows building the optional modules. In the packaged builds for Linux, all the contrib binaries may only be available via an optional package, called something like postgresql-contrib. That's the only way to make the optional modules that come with the database available: install the package the binaries are included in. You may see some variation in the OS X builds here too.
If you want to install extensions (what these are officially called as of PostgreSQL 9.1 now, rather than 'modules') using binaries you provide instead, what you then want to know is where to put the resulting shared libraries and matching SQL files that reference them. What pgconfig returns for pkglibdir will tell you where the binaries go, while sharedir points toward the default place to put the SQL. Providing binaries is a losing game though; the job of syncing with every platform to build them is a huge one.
And here are the sort of additional complications you'll run into in this area, if you wanted to ship source code and try to build things yourself in an automatic way:
PostgreSQL 9.1 now installs these using the CREATE EXTENSION
mechanism, so you'll need to handle both the pre-9.1 method and the
new one introduced there.
Not all PostgreSQL installations will have
pg_config. It's considered a development tool, and which package it
gets bundled with (and whether that package is mandatory or not)
varies. Debian/Ubuntu put it into the optional liqpq-dev, RedHat
derived RPMs have it in postgresql-devel or
postgresql-[version]-devel.
Due to pg_config being necessary for
compiling the new 9.1 extensions, packagers have started
reconsidering where pg_config goes; it's considered a lot more
important now than it used to be. 9.1 or later packages might alter which package it's contained in. That doesn't really change what you can and can't do though. It just impacts what advice you might offer for correcting situations your program can't deal with.
I've been describing the standard
Linux packaging here when I talk about that OS. There are also installers for both Linux and
OS X from EnterpriseDB, what they call their "one-click installers".
These use a different standard altogether for what people do and don't get installed in this area. I don't follow the commercial packaging to know what is actually different, but it's another variable you can expect people to encounter.
Recent OS X versions may
have some system PostgreSQL components floating around too. No idea
yet how this handle extensions though.
Basically, all three of version/packager/platform can vary how this will work, and the idea that you'll find any solution that handles even the majority of those permutations is optimistic. Installing extensions is known to be difficult in PostgreSQL, which is one thing that motivated all the 9.1 changes to turn it into a simple CREATE EXTENSION for many of them. But for now, those changes have just added another whole set of variation into the mix, actually making this harder during the transition period. It will be a while until PostgreSQL versions supporting that are the only ones in popular use.
I've been developing a web application and a lot of customers are asking if they can host the application in their network (for security reasons). I have been looking for a way to package up a rails app into a single executable (with server and all), but haven't been able to find anything. My other requirement is that we distribute it without the source. Because of that I was looking at JRuby and Warbler. The end product should run on linux or windows. Has anyone done anything like this before, or can anyone point me in the right direction.
Thanks
My best guess would be to use JRuby and the JRubyCompiler, although I have no idea if you could compile a whole rails project (including all the required gems). I got it to compile a small ruby script though. Anyway, if you succeed, you could package those in a jar or war and deploy that as a contained application.
It doesn't sound like you necessarily need to package it as an executable, as long as the code is obfuscated. I personally haven't needed to protect any of my code, but a quick google search returned this product http://rubyencoder.com/. I'm sure there are others out there, but the basic idea is that your code is unreadable and cannot be reverse engineered. This would allow you to run a standard rails environment without giving access to your source code.
If you have the budget and really want to outsource this, the Github guys partnered with BitRock to build their cross-platform installable product (Github Firewall Install). BitRock has this case study on their website.