dyci / dyci-main Goto Github PK
View Code? Open in Web Editor NEWDynamic Code Injection Tool for Objective-C
License: MIT License
Dynamic Code Injection Tool for Objective-C
License: MIT License
There SHOULD be way.
Any suggestions are appreciated.
This should work for Xcode and AppCode For Any project.
When I'm trying to compile c++ project Cedar, i see lot of errors
Undefined symbols for architecture x86_64:
"std::__1::__vector_base_common<true>::__throw_length_error() const", referenced from:
std::__1::vector<std::__1::shared_ptr<Cedar::Doubles::Argument>, std::__1::allocator<std::__1::shared_ptr<Cedar::Doubles::Argument> > >::allocate(unsigned long) in StubbedMethod.o
void std::__1::vector<std::__1::shared_ptr<Cedar::Doubles::Argument>, std::__1::allocator<std::__1::shared_ptr<Cedar::Doubles::Argument> > >::__push_back_slow_path<std::__1::shared_ptr<Cedar::Doubles::Argument> const&>(std::__1::shared_ptr<Cedar::Doubles::Argument> const&&&) in InvocationMatcher.o
"std::__1::__basic_string_common<true>::__throw_length_error() const", referenced from:
__ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE6__initIPcEENS_9enable_ifIXsr21__is_forward_iteratorIT_EE5valueEvE4typeES9_S9_ in CDRProtocolFake.o
"std::__1::locale::use_facet(std::__1::locale::id&) const", referenced from:
More than that. If I add -lstdc++ in project, all works fine with dyci proxy compiler
But default clang doesn't have to specify that parameter.
It would be great if you could add a note in the readme about alternative solutions, how this compares to the others and what's different. I know there's a project called injectionforxcode.
Thanks!
I have project, without workspace...
For now, I have to perform too much operations to have dyci running...
Any reason it isn't possible to install via homebrew?
I can have a go at it
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
Hi,
I'm trying to use dyci for first time, but I can't use it. dyci shows this on console, but nothing changes on simulator:
2014-11-05 13:43:30.969 TestDyci[6884:286286] New file injection detected at path : /Users/mhergon/.dyci/dyci2141745.dylib.ld_EwEn4P
2014-11-05 13:43:30.969 TestDyci[6884:286286]
2014-11-05 13:43:30.969 TestDyci[6884:286286] =================================================
2014-11-05 13:43:30.969 TestDyci[6884:286286] Found new DCI ... Loading
2014-11-05 13:43:30.977 TestDyci[6884:286286] DYCI was successfully loaded
2014-11-05 13:43:30.977 TestDyci[6884:286286] Searching classes to inject
2014-11-05 13:43:30.981 TestDyci[6884:286286] Injecting class : AppDelegate
2014-11-05 13:43:30.981 TestDyci[6884:286286] Injecting meta class : AppDelegate
2014-11-05 13:43:30.981 TestDyci[6884:286286] Class (AppDelegate) and their subclasses instances would be notified with
2014-11-05 13:43:30.981 TestDyci[6884:286286] - (void)updateOnClassInjection
2014-11-05 13:43:30.981 TestDyci[6884:286286] 1 (AppDelegate) class instanses were notified on Class Injection :
2014-11-05 13:43:30.981 TestDyci[6884:286286] 1 instanses were notified on Class Injection by injecting class: (AppDelegate)
2014-11-05 13:43:30.982 TestDyci[6884:286286] Class was successfully injected
2014-11-05 13:43:30.982 TestDyci[6884:286286]
Any idea?
Thanks!
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
I've notice strange line in podspec file
sp.compiler_flags = '-fobjc-no-arc'
It raises question because if you want to use compiler flag to build file without ARC you should use -fno-objc-arc flag. But original project (not downloaded as pod) using ARC, except one file (not sure if this file need it).
So the question is: Does podspec file correct or i should fix project preferences to avoid unpredictable issues?
Hi there - we use the static void* kvoContext=&kvoContext
pattern (http://nshipster.com/key-value-observing/#correct-context-declarations) for supplying a context for key value observing.
Not surprisingly, this causes problems when DYCI reloads the code, as the pointer value changes. Calls to [self removeObserver:foo forKeyPath:bar context:kvoContext]
blow up, as does the call to super in :
- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context
{
if (context == kvoContext) {
// handle our own changes
} else {
[super observeValueForKeyPath:keyPath ofObject:object change:change context:context];
}
}
Any suggestions on working around this?
After I'm saving a storyboard and trying to inject it, application is crashing with the following error: Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<UIProxyObject 0x7bff9e90> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key collectionView.'
Does DYCI supports storyboards?
Working in XCode 5, but not in XCode 4.6.3 now.
Still getting the same issue.
"Couldn't load index file '/Users/prabha-1044/.dyci/index/8845d3f04edeb8499c9547d736a6ba41' (/Users/prabha-1044/Friendtam/Official/NativeApp/HomeViewController.m). Use default compilation instead"
Still working good in XCode 5.
After configuring dyci, i am getting the success logs. but when I change my code and try to inject, it says "Searching classes to inject" and no update after that. Can't understand where it gets hanged.
Hi,
thanks for a really useful lib!
When using dyci on my mac at work, I have moved my home folder, so instead of:
/Users/mquinones/
it is
/Volumes/BigSATA/miquHome/
I've debugged the code, and it happens that:
In SFDynamicCodeInjection.m:103:
char * userENV = getenv("USER")
is NULL, and default path override is not working.
Hi, great lib! I find it very useful.
I found a small issue I want to share with you:
When a project has analizer setup to run with every build (RUN_CLANG_STATIC_ANALIZER build setting), then the command captured by DYCI will not be correct, and no code will be injected.
The current workaround is to RUN_CLANG_STATIC_ANALIZER = NO when working with code injection, which is far from ideal.
Thanks!
Create project without ARC =>
Add DyCI by copying sources =>
Bulid & Run =>
^X =>
EXC_BAD_ACCESS
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
We need some Unit tests on Dyci injection logic, That's a given. :)
For some reason I can't get DyCI to work. I have never tried it before.
I upgraded Xcode before installing. Then I installed using guide found here https://github.com/DyCI/dyci-main/wiki/Installation
Traceback (most recent call last):
File "/Users/hfossli/.dyci/scripts/dyci-recompile.py", line 166, in <module>
xcodeLocation = args[2]
IndexError: list index out of range
Xcode: Version 6.1 (6A1052d) (latest as of today)
OS: 10.10 (14A388a) (latest as of today)
╰─$ ./install.sh
== Backing up clang : grep -Fq == CLANG_PROXY == /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang
Password:
Done.
== Faking up clang : Done.
== Preparing dyci-recompile directories: Done.
== Copying scripts : Done.
== AppCode 2.x found. Installing DYCI as AppCode plugin : Done.
Restart Appcode. Plugin should be loaded automaticaly. If not, you may need to install it manually
== Installing Xcode DYCI plugin : Done.
Now you can use DYCI from the Xcode :P
DYCI was successfully installed!
Use (^X) hot key in your IDE to perform code injections. Have fun.
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
There's a way to peform dyci via partial xcode-build ?
Like this
% make build 2>&1 | tee /dev/stderr | awk '/^CompileC/ { print $2 }' | xargs -I % sh -x ~/dev/ios/dyci-main/bin/gendylib.sh % ~/.dyci/inject_APF_$(date +%s).dylib
Ofcourse, it is cool, that we have support of dyci, as "External Tool", But it will be more valuable, if we'll have normal AppCode plugin.
Currenlty external tool have some disadvantages:
What is needed in order to be able inject json files in to bundle?
I inject dyci to my workspace project and it work well.
But when I modify my custom cell's contentView's subViews
and press ^X,and then reload my tableview,the UI
in simulator does not change.
Then I try again.This time I override setFrame: method
and set custom frame to my cell.Save,^X,reload,and
then it works.
So,is that a bug?
For my case, calling sudo
is not permitted.
Install script works without sudo
command. Should we remove sudo?
Dyci is a great framework, but I have one question as title. Thanks for answering.
2014-03-20 18:14:27.202 CigaretteDispenser[91836:60b] - (void)updateOnClassInjection
2014-03-20 18:14:27.379 CigaretteDispenser[91836:60b] *** Terminating app due to uncaught exception 'NSGenericException', reason: '*** Collection <__NSCFSet: 0xa489550> was mutated while being enumerated.'
*** First throw call stack:
(
0 CoreFoundation 0x020ba1e4 __exceptionPreprocess + 180
1 libobjc.A.dylib 0x01d838e5 objc_exception_throw + 44
2 CoreFoundation 0x02149cf5 __NSFastEnumerationMutationHandler + 165
3 CigaretteDispenser 0x00177332 -[SFInjectionsNotificationsCenter notifyOnClassInjection:] + 802
4 CigaretteDispenser 0x00175189 -[SFDynamicCodeInjection performInjectionWithClass:] + 361
5 CigaretteDispenser 0x00174f11 -[SFDynamicCodeInjection performInjectionWithClassesInSet:] + 577
6 CigaretteDispenser 0x00175ad3 -[SFDynamicCodeInjection newFileWasFoundAtPath:] + 1251
7 CigaretteDispenser 0x001766ec -[SFFileWatcher checkForFileCreationDate] + 828
8 CigaretteDispenser 0x00176272 __42-[SFFileWatcher setupHandlerOnFileChange:]_block_invoke_2 + 50
9 libdispatch.dylib 0x023b97b8 _dispatch_call_block_and_release + 15
10 libdispatch.dylib 0x023ce4d0 _dispatch_client_callout + 14
11 libdispatch.dylib 0x023bc726 _dispatch_main_queue_callback_4CF + 340
12 CoreFoundation 0x0211f43e __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 14
13 CoreFoundation 0x020605cb __CFRunLoopRun + 1963
14 CoreFoundation 0x0205f9d3 CFRunLoopRunSpecific + 467
15 CoreFoundation 0x0205f7eb CFRunLoopRunInMode + 123
16 GraphicsServices 0x036175ee GSEventRunModal + 192
17 GraphicsServices 0x0361742b GSEventRun + 104
18 UIKit 0x006d0f9b UIApplicationMain + 1225
19 CigaretteDispenser 0x0000275d main + 141
20 libdyld.dylib 0x02603701 start + 1
21 ??? 0x00000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
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'
Would it be possible to support Swift? I guess native swift objects cannot be swizzled, but how about everything that inherits from NSObject?
We need to support Localizable.strings contenst change in runtime.
I have zero intention of releasing an app with this; but as a developer who makes unity 3d/cocoa hyrbid AR apps, I would benefit so much from having this run on the device.
Is there any way to do it?
If so it there any documentation?
Am using xcode and my project is configured to use DLog preprocessor than the default NSLog. I couldn't use Dlog in injectable code section. please let me know if I am missing any.
I have an app which uses a sub-project, where all code except for the appdelegate is included.
If I include the files from the example projects into the main project, all goes well.
If i do the same inside the subproject, i see this:
0 instanses were notified on Class Injection by injecting class: (DYCIViewController)
And nothing is updated.
If I do the same in any other of my custom classes, nothing at all happens dyci does not seem to be called.
Pressing ctrl-x only seems to show a green bubble on classes that are not currently loaded
The results were the same, no matter if adding as subproject, library or as a Pod
Currently "Recompile task is running in Main thread", sometimes it leads to Xcode crash.
Can you add dyci
to Cocoapods specs repo? This will prevent download on each pod update
command and help people to find it via 'pod search'.
For the current momnet, we allowing only resources, that will be simply dropped to bundle. This approach won't work on lozalized resourses, that is needed to be placed at correct lproj directory
If you try to change view position/size etc at storyboard it's not work + send message with error.
Also if you try to change IBOutlets programmatically position/size etc they dismissed from app view.
If you not save changes at file and push ^X changes not injected.
We're using the master
version of DyCI. It would be great if you could tag it with a version number so we can depend on the specific version instead of having to use master
.
Thanks for a great library!
If dyci is installed, then, when Xcode updates,
it deletes clang-real, and clang-backup
And you can restore it only by fully removing and reinstalling Xcode
That sucks.
Current solution 1:
Uninstall dyci before updating Xcode
Current solution 2:
Remove and reinstall Xcode
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.
AppCode 3 does not rely on xcode-select, instead you choose the desired Xcode version in the Preferences.
But I believe the dyci plugin still relies on xcode-select. Is it possible to make the AppCode version of the plugin aware of the AppCode setting instead of using code-select?
Please, cleanup Dynamic Framework installation script, so we can use it without user interaction.
It would be amazing if we only needed to install DyCI on the computer as an xcode plugin. Is this possible?
I'm thinking something along the lines of how Spark Inspector connects
xcode 6 it not work ,I am sure it install finished
We need some tool that will allow us check if dyci correctly (un)installs in the system
Need some wiki pages that describes WHAT actualy DYCI is
And how it can help to the user
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.