Dyci-main - Dynamic Code Injection Tool for Objective-C

Overview

# DyCI – Dynamic Code Injection

Join the chat at https://gitter.im/DyCI/dyci-main Carthage compatible

This tool allows you to inject code into running iOS application, without restarting it.

  1. DyCI is not about loading new code in application.
  2. DyCI is about speeding up development.
  3. Each time, you are using DyCI, it saves you time.

WARNING

Uninstall DyCI before updating Xcode. If you don't you may need to reinstall xcode. We're currenlty working on this issue... If you've already expirienced this issue - remove and reinstall Xcode.

Installation

1. Install on machine

This is done once per machine. See details on installation page.

2. Add to your project

DyCI needs to integrate with the project as well. If you are using CocoaPods you can add this to your podfile

pod 'dyci', :git => 'https://github.com/DyCI/dyci-main.git'

If you prefer a manual approach you can read about it in the wiki.

Reasons, why do you need this tool

  • apply small logic changes in no time
  • when working with UI and animations you can see the results immediately
  • It's good for debugging purposes. Remember, you can inject any code at runtime, add log statements etc.

Compared to other tools

  • You need minimum moves to enable dyci
  • You aren't writing some kind of script, you are writing your code!
  • You don't need to prepare/modify/lock your code for dyci
  • Your changes are always saved (they will not be discarded on next run)

How it works

You can read all about it in the How it works wiki.

Demos

ic-Tac-Toe game

Tic-Tac-Toe Game recreation

Example

  • There's an interactive demo in the workspace found in the Dynamic Code Injection folder.
  • Krzysztof Zabłocki created KZPlayground.

WARNING

Please, do not use this tool in your real applications, that you will publish to the App Store. DyCI won't work on devices by default, by purpose. Dynamic code injection is good for development, but it will leave huge security hole if you put it in your application.

FAQ

Please open any issue, but be sure to read the FAQ before you do:-)

Other Tools

There's few other tools those works kind'a the same, so if you don't like dyci - you can try those

Author(s)

Taykalo Paul, [email protected]
Find me on twitter.

Comments
  • Xcode 8 support ?

    Xcode 8 support ?

    I ran a sample project from unsigned Xcode 8 installed with DyCI plugin. After injecting source, the console mentions injection is successful but I do not see any change on simulator. The operation done was simply changing background color of a Single Page app. Please let know if I am missing anything.

    opened by kaustubhkabra 15
  • Failing to compile/inject if path contains non-ascii-symbols

    Failing to compile/inject if path contains non-ascii-symbols

    dyci-main installation sucess,but ,i have got this message when i building the project:

    Traceback (most recent call last): File "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang", line 22, in filename = indexFileLocation + hashlib.md5(className).hexdigest() TypeError: Unicode-objects must be encoded before hashing Command /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang failed with exit code 1

    would-happily-accept-a-patch 
    opened by LengBinBin 13
  • inject for code only work for the files in pods directory when working with workspace with several projects

    inject for code only work for the files in pods directory when working with workspace with several projects

    Using with dyci, I found a strange problem:when working with cocoapods, inject code(^X) can only work for the third party files in pods folders, but not work for the files in the project folders(always pop up 'Failed to inject code, Couldn't load index file' hint)

    My pod file is like the following:

    workspace 'space.xcworkspace'

    target 'Base' do xcodeproj 'project1.xcodeproj' platform :ios, '5.0' pod 'dyci', :git => 'https://github.com/DyCI/dyci-main.git' pod 'MBProgressHUD' end

    target 'Case' do xcodeproj 'project2.xcodeproj' platform :ios, '5.0' pod 'MagicalRecord' pod 'dyci', :git => 'https://github.com/DyCI/dyci-main.git' end

    bug 
    opened by allentofight 13
  • dyci failing on Xcode 7.1

    dyci failing on Xcode 7.1

    I use dyci via KZPlaygrounds for AudioKit's playgrounds (http://audiokit.io/playgrounds/) and recently I've been getting this error on Xcode 7.1. Can someone point me in the right direction to tracking down the problem?

    Failed (1) Playground: Recompiled AudioKitPlayground/AudioKitPlayground/Playground.m Executing: /usr/bin/python /Users/aure/.dyci/scripts/dyci-recompile.py /Users/aure/Developer/AudioKit/Playgrounds/AudioKitPlayground/AudioKitPlayground/Playground.m

    Traceback (most recent call last): File "/Users/aure/.dyci/scripts/dyci-recompile.py", line 177, in runAndFailOnError(compileString) File "/Users/aure/.dyci/scripts/dyci-recompile.py", line 19, in runAndFailOnError stderr=subprocess.PIPE) File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 710, in init errread, errwrite) File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 1335, in _execute_child raise child_exception OSError: [Errno 2] No such file or directory

    Failed (1) Playground: Recompiled AudioKitPlayground/AudioKitPlayground/Playground.m

    opened by aure 12
  • Getting failed to inject code issue

    Getting failed to inject code issue

    Getting Red dote with

    Couldn't load index file '/Users/paritoshraval/.dyci/index/e6130ba5ea97b4e47a5751c29c67eaaa' (/Users/paritoshraval/Desktop/Old Desktop/Old Code/Codes1/MyTest123/MyTest123/ViewController.m). Use default compilation instead

    I am using subproject and clean , successfully compile it. but even getting issue.I am using xcode 6.3

    Please help.

    opened by paritoshraval100 11
  • Problems with integration.

    Problems with integration.

    I had add dyci to my project via cocoa pods. After few hours I get such message:

    2012-11-26 23:39:23.034 Runtime test[28859:c07]
    2012-11-26 23:39:23.036 Runtime test[28859:c07] ================================================= 2012-11-26 23:39:23.037 Runtime test[28859:c07] Found new DCI ... Loading 2012-11-26 23:39:23.069 Runtime test[28859:c07] DCI was successfully loaded 2012-11-26 23:39:23.069 Runtime test[28859:c07] Searching classes to inject 2012-11-26 23:39:23.075 Runtime test[28859:c07] Injecting class : ARViewController 2012-11-26 23:39:23.076 Runtime test[28859:c07] Injecting meta class : ARViewController 2012-11-26 23:39:23.076 Runtime test[28859:c07] Class (ARViewController) and their subclasses instances would be notified with 2012-11-26 23:39:23.076 Runtime test[28859:c07] - (void)updateOnClassInjection 2012-11-26 23:39:23.077 Runtime test[28859:c07] Class was successfully injected 2012-11-26 23:39:23.077 Runtime test[28859:c07]

    But nothing had changed on my screen. After ^x combination. Could you explain why it could be so.

    question 
    opened by Samback 11
  • Failed to inject Xib files

    Failed to inject Xib files

    I can inject .m files,but I can's inject .xib files.The following is the error information.How to fix it?

    Traceback (most recent call last): File "/Users/guangxikatsurahayashishouzanku/.dyci/scripts/dyci-recompile.py", line 125, in resultCode = copyResource(xibFilename, DYCI_ROOT_DIR) File "/Users/guangxikatsurahayashishouzanku/.dyci/scripts/dyci-recompile.py", line 82, in copyResource shutil.copy(source, bundlePath) File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 119, in copy copyfile(src, dst) File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 83, in copyfile with open(dst, 'wb') as fdst: IOError: [Errno 21] Is a directory: '/Users/guangxikatsurahayashishouzanku/Library/Developer/CoreSimulator/Devices/59909BFB-FD4C-412F-B04F-79C1A396F7DB/data/Containers/Bundle/Application/49287987-1933-40D8-8433-79F54AD402A8/test-40-AutoLayout.app/Demo1ViewController.nib'

    opened by qq237761250 10
  • Carthage support

    Carthage support

    Added support for adding dyci as a dependency using Carthage. Right now you can add dyci to your Cartfile using this line:

    git "[email protected]:olegam/dyci-main.git" "master"
    
    opened by olegam 9
  • DYCI directory path is invalid.

    DYCI directory path is invalid.

    I am getting this message, but Ctrl+X not working for me. Directory path has (null) instead of my username.

    2014-10-31 16:44:09.073 MyApp[7479:293707] DYCI directory path is : /Users/(null)/.dyci/ 2014-10-31 16:44:09.080 MyApp[7479:293707] ============================================ 2014-10-31 16:44:09.080 MyApp[7479:293707] DYCI : Dynamic Code Injection was started... 2014-10-31 16:44:09.080 MyApp[7479:293707] To disable it, paste next line in your application:didFinishLaunching: method :

    [NSClassFromString(@"SFDynamicCodeInjection") performSelector:@selector(disable)];

    2014-10-31 16:44:09.080 MyApp[7479:293707] or 2014-10-31 16:44:09.080 MyApp[7479:293707] Simply remove dyci from dependencies

    opened by friendtam 9
  • Autosave on CTRL + X ?

    Autosave on CTRL + X ?

    Hi, fantastic job, really !

    It's there a way to auto save when pressing CTRL + X ? It's not easy to CMD+S and CTRL +X each time, or i have a problem with my installation ?

    Thanks

    enhancement vote more 
    opened by skrew 8
  • not work in ios7

    not work in ios7

    i run it on ios6 simulator it works,but in ios7 ,i can't go into the viewController view,just in a blackColor state~ but when i remove the dyci framework in build phases and rerun xcode i can go into the view controller view ,。it seems that the dyci.framework is not work in iOS 7

    example project is needed 
    opened by jonz-tech 8
  • Symbol not found expected in flat namespace

    Symbol not found expected in flat namespace

    I try to use DyCI in my project, but when i press ctrl + =, error happened. After searching on google, i still can not find what is the problem. Here is the error message:

    2016-08-17 11:31:05.744 beiliao[7207:815699] Couldn't load file Error : dlopen(/Users/huangzeyu/.dyci/dyci4239950.dylib, 10): Symbol not found: _OBJC_CLASS_$_BLAccountRestartRequest Referenced from: /Users/huangzeyu/.dyci/dyci4239950.dylib Expected in: flat namespace in /Users/huangzeyu/.dyci/dyci4239950.dylib

    does anyone get any idea?

    opened by iosanimations 11
  • No recompiler found to handle this file(xxx)

    No recompiler found to handle this file(xxx)

    When I run control+x in my project,i get back this error message: No recompiler found to handle this file(xxx).i don't know why will get this error message. Please help me to solve this problem.thanks

    opened by Sniper-yj 0
  • Couldn't load file Error

    Couldn't load file Error

    Couldn't load file Error : dlopen(/Users/phil/.dyci/dyci2931960.dylib, 10): Symbol not found: _llvm_gcda_emit_arcs Referenced from: /Users/phil/.dyci/dyci2931960.dylib Expected in: flat namespace in /Users/phil/.dyci/dyci2931960.dylib

    opened by cdoky 1
  • Retain class observers

    Retain class observers

    Observers are referenced as __unsafe_unretained, but sometimes observers released, leading to crash on notification. Fix this by retaining observers.

    Other approach may be keeping week references to observers, but i've took simple way :)

    example project is needed 
    opened by zintus 6
  • Separate DYCI to tool-projects

    Separate DYCI to tool-projects

    Now there are next projects, coupled within one

    • Installation Scripts
    • Python based Clang Proxy and Recompiler scripts (Command-line plugin)
    • AppCode Plugin
    • Xcode Plugin

    It will make sense to distribute them to different repositories since work on them can be parallelized

    opened by PaulTaykalo 0
  • There should be way to recompile files without clang proxying (No IDE)

    There should be way to recompile files without clang proxying (No IDE)

    For now there's only way to find how the file was compiled - is to use clang proxying scheme. There' should be way to do it without proxying, like in #87 for Xcode

    opened by PaulTaykalo 0
Releases(1.6)
  • 1.6(May 28, 2015)

    Hi guys there's some features were added to DYCI

    Some bugs were fixed, and some weren't:) there's not so much time I can spend on upgrading DYCI, but.

    Injection without clang proxy

    With this release, Xcode plugin will try to find compilation line without using dyci index, right from the Xcode structure itself. If this won't work, it will fallback to previous behaviour and use python script (dyci-recompile)

    What does this mean for you:
    If you're using Xcode only and injecting only code .h, .m files, you can try to use Dyci installation without clang proxying. In order to do this, you need to uninstall previous version of DYCI, and install it by running ./install.sh -s

    Source code(tar.gz)
    Source code(zip)
  • v0.1.5.4(Aug 16, 2014)

Owner
null
Injectionforxcode - Runtime Code Injection for Objective-C & Swift

Injection Plugin for Xcode Copyright (c) John Holdsworth 2012-19 TLDR: Xcode is an integrated development environment (IDE) for macOS containing a sui

John Holdsworth 6.5k Dec 29, 2022
Injection - Dependency injection using property wrappers

Dependency injection using property wrappers. Registering types: // injecting a

Alejandro Ramirez 3 Mar 14, 2022
JSPatch bridge Objective-C and Javascript using the Objective-C runtime. You can call any Objective-C class and method in JavaScript by just including a small engine. JSPatch is generally used to hotfix iOS App.

JSPatch 中文介绍 | 文档 | JSPatch平台 请大家不要自行接入 JSPatch,统一接入 JSPatch 平台,让热修复在一个安全和可控的环境下使用。原因详见 这里 JSPatch bridges Objective-C and JavaScript using the Object

bang 11.4k Jan 1, 2023
This project is a clone of YouTube. But the main intention is to show how to write clean code, using proper MVC patterns and re-usable coding methodologies!

YouTubeClone This project is a clone of YouTube. But the main intention is to show how to write clean code, using proper MVC patterns and re-usable co

Vamshi Krishna 169 Dec 10, 2022
Reliant - Nonintrusive Objective-C Dependency Injection

Reliant Reliant is a Dependency Injection (DI) framework for Objective-C, both for OS X and iOS. Its goal is to make its use as simple as possible, wh

AppFoundry 52 Oct 14, 2022
DevTool - A simple UI and powerful Mac OS application, Such as JSON-Formatting tool, JSON-to-model tool, AppIcon generator, Network-Request tool...

?? ?? ?? A simple UI and powerful Mac OS application. It is a collection of tools commonly used in my development work. Such as JSON-Formatting tool, JSON-to-model tool, AppIcon generator, Network-Request tool...

渠晓友 3 Dec 21, 2022
A static source code analysis tool to improve quality and reduce defects for C, C++ and Objective-C

OCLint - https://oclint.org OCLint is a static code analysis tool for improving quality and reducing defects by inspecting C, C++ and Objective-C code

The OCLint Static Code Analysis Tool 3.6k Dec 29, 2022
SwiftDI - A dependency injection tool for Swift

SwiftDI SwiftDI is a dependency injection tool for Swift. With it you can build well-structured and easily testable applications for iOS class Example

Satish Babariya 0 Jan 15, 2022
Demonstration code for a simple Swift property-wrapper, keypath-based dependency injection system. The keypaths ensure compile-time safety for all injectable services.

Injectable Demo Preliminary musings and demonstration code for a simple Swift property-wrapper, keypath-based dependency injection system. The keypath

Michael Long 12 Aug 5, 2022
Inject-Dylib - ObjC Code to Programmatically Perform Dylib Injection

Inject-Dylib ObjC Code to Programmatically Perform Dylib Injection. Code leveraged from Wojciech Regula's FirefoxStealer project (https://github.com/r

Cedric Owens 1 Jan 2, 2022
Inject Dylib - Swift code to programmatically perform dylib injection

Inject_Dylib Swift code to programmatically perform dylib injection. You can als

Cedric Owens 40 Sep 27, 2022
Spin aims to provide a versatile Feedback Loop implementation working with the three main reactive frameworks available in the Swift community (RxSwift, ReactiveSwift and Combine)

With the introduction of Combine and SwiftUI, we will face some transition periods in our code base. Our applications will use both Combine and a thir

Spinners 119 Dec 29, 2022
Sample app to demonstrate data sharing between a WatchKit app and its main app using Realm

#Done! A sample app demonstrating how to share data between an app an its Watch extension using Realm. You can read more about it here. ##Screenshot #

Fancy Pixel 147 Dec 8, 2022
Class for logging excessive blocking on the main thread

Watchdog Class for logging excessive blocking on the main thread. It watches the main thread and checks if it doesn’t get blocked for more than define

Wojtek Lukaszuk 1.8k Dec 6, 2022
Sample app to demonstrate data sharing between a WatchKit app and its main app using Realm

#Done! A sample app demonstrating how to share data between an app an its Watch extension using Realm. You can read more about it here. ##Screenshot #

Fancy Pixel 147 Dec 8, 2022
A guard to help you check if you make UI changes not in main thread

ODUIThreadGuard ODUIThreadGuard is a guard to help check if you make UI changes not in main thread. As Xcode 9 embedded this function into Xcode, ther

Old Donkey 690 Nov 23, 2022
An app that uses Multipeer Connectivity to play a video across 6 different iOS screens with an additional phone acting as a Main/Control phone.

MultiScreenApp An app that uses Multipeer Connectivity to play a video across 6 different iOS screens with an additional phone acting as a Main/Contro

Vedant 113 Nov 21, 2022
ADVANCED APP DESIGN The main goal of this mini project is to inspire you on what we can accomplish with the SwiftUI framework.

Restart-App.0.2 ADVANCED APP DESIGN The main goal of this mini project is to inspire you on what we can accomplish with the SwiftUI framework. COMPLEX

Noye Samuel 1 Dec 11, 2021
Instagram clone, the main focus of the app is the seamless swipe between views that we see on instagram

InstaSwipe Instagram clone, the main focus of the app is the seamless swipe betw

Stavros Pachoundakis 1 Dec 15, 2022
MainTask - Create main task by using a simple way

MainTask Create a main task by using a simple way. MainTask { print(Thread.c

Underthestars-zhy 1 Jan 17, 2022