The apply-patch-to-file script allows you to apply a Git patch to files with the same content but different name or file path without having to manually modify the patch itself.
Prepare each commit with its patch in one file per commit, formatted to resemble UNIX mailbox format. The output of this command is convenient for e-mail submission or for use with git.
Instructions
Use with the following syntax:
Not specifying any options defaults to interactive mode.
Options
- -ffile_to_patch — allows you to specify a single file that will be patched. This means that the specified patch must only modify one file.
- -i — starts your favorite editor with a pre-formatted table in which you specify target files that will be patched.
- -h — displays usage information.
Example
Create a patch of, for example, the HEAD commit in your Git repository:
Switch to a different repository in which you'd like to apply the patch to a file or files of your choosing, and run apply-patch-to-file script, specifying the previously-created patch as an argument:
In your editor, specify the target files where the patch should apply:
Save and exit you editor. In case of no conflicts, check git log to see your patch applied.
Copyright
Github Download
apply-patch-to-file — . Copyright (C) 2012 Martin Prpič
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.
IPAPatch provide a simple way to patch iOS Apps, without needing to jailbreak.
[ Features • Instructions • Example • FAQ • License ]
Features
IPAPatch includes an template Xcode project, that provides following features:
Build & Run third-party ipa with your code injected
You can run your own code inside ipa file as a dynamic library. So you can change behavior of that app by utilizing Objective-C runtime.
Presented an custom alert in Youtube app
Step-by-step Debugging with lldb
You can debug third-party apps like your own. For example:
- Step-by-Step debug your code inside other app
- Set Breakpoints
- Print objects in Xcode console with lldb
Debugging Youtube with Xcode
Link external frameworks
By linking existing frameworks, you can integrate third-party services to apps very easily, such as Reveal.
Inspect Youtube by linking RevealServer.framework
Generate distributable .ipa files
You can distribute your patch/work to your friends very easily, with IPAPatch generated modified version of .ipa files
Modified version of Facebook.ipa created by IPAPatch
Download Github Repository
Instructions
Clone or Download This Project
Download this project to your local disk
Prepare Decrypted IPA File
The IPA file you use need to be decrypted, you can get a decrypted ipa from a jailbroken device or download it directly from an ipa download site, such as http://www.iphonecake.com
Replace Placeholder IPA
Replace the IPA file located at
IPAPatch/Assets/app.ipa
with yours, this is a placeholder file. The filename should remainapp.ipa
after replacing.Place External Resources/Frameworks (Optional)
Follow types of external file are supported:
- Frameworks:
- External frameworks can be placed at
IPAPatch/Assets/Frameworks
folder. - Frameworks will be linked automatically.
- For example
IPAPatch/Assets/Frameworks/RevealServer.framework
- External frameworks can be placed at
- Dynamic Libraries:
- External dynamic libraries can be placed at
IPAPatch/Assets/Dylibs
folder. - Libraries will be linked automatically
- External dynamic libraries can be placed at
- Resources/Bundles:
- Other resources or bundles can be placed at
IPAPatch/Assets/Resources
- Resources will be copied directly to the main bundle of original app
- Other resources or bundles can be placed at
- Frameworks:
Configure Build Settings
- Open
IPAPatch.xcodeproj
- In the Project Editor, Select Target
IPAPatch-DummyApp
Display Name
defaults to '💊 ', this is used as prefix of the final display name.- Change
Bundle Identifier
to match your provisioning profiles - Fix signing issues if any.
- Open
Configure IPPatch Options
You can config IPAPatch's behavior with
Tools/options.plist
Name Description Default RESTORE_SYMBOLS When YES
, IPAPatch will try to restore symbol table from Mach-O for debugging propose (with tools from https://github.com/tobefuturer/restore-symbol, also thanks to @henrayluo and @dannion)NO CREATE_IPA_FILE When YES
, IPAPatch will generate a ipa file on each build. Genrated file is located atSRCROOT/Product
NO IGNORE_UI_SUPPORTED_DEVICES When YES
, IPAPatch will deleteUISupportedDevices
from source app'sInfo.plist
NO
Code Your Patch
The entry is at
+[IPAPatchEntry load]
, you can write code start from here. To change apps' behavior, You may need to use some method swizzling library, such as steipete/Aspects.Build and Run
Select a real device, and hit the 'Run' button at the top-left corner of Xcode. The code your wrote and external frameworks you placed will inject to the ipa file automatically.
Example
I created some demo project, which shows you how to use IPAPatch
:
- Reveal + Youtube:
- Cycript + Youtube (Idea from @phpmaple):
FAQ
Q: Library not loaded with reason:
mach-o, but wrong architecture
?- A: Try set
IPAPatch
target'sValid Architectures
to match your ipa binary's architecture.
- A: Try set
Q: process launch failed: Unspecified (Disabled) ?
- A: The ipa file use with IPAPatch must be decrypted, See step.2 of Instructions.
Q: dyld: Symbol not found: XXX, Referenced from: XXX, Expected in: XXX/libswiftXXX.dylib
- The swift version the framework you injecting use, is incompatible with the version of your Xcode
License
IPAPatch
IPAPatch is licensed under the MIT license.