I'm new to Apple XPC tech(actually I'm also new to Objective-C), recently I want to learn something about XPC technology, which is used to communicate between processes.
Does anybody know how to combine a command line hello world program with an XPC program by using XCode?
What I did is:
1) Create a command line 'HelloWorld' project;
2) Create a 'target' under the project 'HelloWorld' project;
3) Then I don't know how to combine them together; (maybe be set something in build setting?)
If you can show me how to do this, it would be very helpful. Thanks.
My os is 10.12, xcode is 8.2.
This link has some useful information about what you are looking for.
https://developer.apple.com/library/content/documentation/MacOSX/Conceptual/BPSystemStartup/Chapters/CreatingXPCServices.html#//apple_ref/doc/uid/10000172i-SW6-SW1
Adding a XPC service target to your Xcode project should be the only thing you need to do, other than implementing the actual service.
The grunt work is taken care by Xcode itself. If you check the BuildPhase of your app, it will show that there is an Embedded service section which will take care of copying your XPC service output to your build output dir.
Once things compile, you ll find your XPC service is #build/(Debug || Release)//XpcServices
Related
I want to set breakpoints in the Objc framework that is compiled from my Xcode project, and let it break the Mac application that is dependent on the framework I build.
For example, Application "Blackbox" will use Framework "A", and I have access to the source code of "A" only.
Thus I cannot set breakpoints in the framework projects and simply change them to User, which will be accessible to all the Xcode projects. Or simply merge these two projects since I have to access to "Blackbox".
How can break the application to jump to the breakpoints I set in my framework?
I want to set breakpoints in the Objc framework that is compiled from my Xcode project, and let it break the Mac application that is dependent on the framework I build.
Breakpoints are managed by the debugger; they're not compiled into your framework. What you need to do is to first set up your Mac so that you can attach the debugger, lldb, to the application you're trying to work on. In order to do that you'll probably need to first disable System Integrity Protection so that the operating system won't block you from debugging the app. Then you'll need to a copy of the symbol file (it'll end in .dsym) that you built when you built the framework, and you'll need to load it into the debugger. The blog post Attaching sources to iOS/macOS binaries compiled on another machine might help you walk through those steps.
Once you've done all that, you should be able to set breakpoints on particular methods in your framework, watch what happens as you step through the framework, etc. What you won't be able to do, unless you can also get the symbol file for the application itself, is to see the app's source code when method calls into your framework return to the app.
I am a new guy in OC programming. Now I am involved in a framework development project.
I know the framework works as a library, which contains a group of methods. It's not an application that can run on devices.
Actually, our framework will work with customer's application. We want to investigate what happened inside our framework when customer's application crashed. So I want the 'DSYM' file of our framework, instead of an application.
As far as I know any iOS application does have corresponded 'DSYM', but I didn't find the 'DSYM' of our framework.
Does iOS framework project have 'DSYM'? If it does have, how can I obtain it?
By the way, I am using Xcode 8.1.
Thanks!
According to my observations, .dSYM files are generated for iOS dynamic framework built with Release configuration only.
After build succeeds, the debug symbols files can be found at these paths, for a device and simulator, respectively:
<Build_Root>/build/Release-iphoneos/<Product_Name>.framework.dSYM
<Build_Root>/build/Release-iphonesimulator/<Product_Name>.framework.dSYM
, where
<Build_Root> is usually a subdirectory within Derived Data directory;
<Product_Name>is the name of your framework.
Yes, you can generate dSYMs for dynamic frameworks. There are a few relevant build settings that control whether and where these files are generated:
DEBUG_INFORMATION_FORMAT = dwarf-with-dsym,
DWARF_DSYM_FOLDER_PATH = "$(CONFIGURATION_BUILD_DIR)",
DWARF_DSYM_FILE_NAME = "$(PRODUCT_NAME).dSYM"
Obviously, you can set these to whatever you want, either in your project's build settings in Xcode (the project.pbxproj file) or as arguments to xcodebuild (depending on how you generate your framework).
DSYM (Debugging SYMbols) files generally store the debugging symbols for your app. And if app crash any where symbols replaced with appropriate method name so that it could help developer in a readable form. And for that you can use the crash log and they can be find in the iPhone where the app is installed. Each app and device have their own crash log.
Also please check this link it might help you.
Read Crash Report
Upload Symbols for iOS Framework
Hopefully these might help you or guide in the right direction.
Our Mac application can (sadly) only build and run in 32bit-only. Reason is: a huge bunch of very old 32bit-only C++ code shared with other platforms (Windows, Android, Linux, etc.). This is cross server-client networking-protocol code, so it can't really be replaced. Until EVERYONE needs is 64bit, we're bound to build our app 32bit only.
Now I'm building a new module for this application as an external private dynamic framework. I'd like to use ARC, and the new niceties of modern Obj-C runtime, but these are only available in 64bit-only builds.
So… Could my 32bit Mac Application link, and use, and load a 64bit-only framework?
Well, I found the answer, which is on the whole --- NO.
Here are the details, and a work-around.
First off, a 32bit process can’t load 64bit code. The linker complains when you try to link the 64bit-only framework to your 32bit app.
I was offered two ways around this, both rely on parting the 32bit-only code and the 64bit-only code into 2 different processes, talking using XPC.
The first way would be to create a "host" 64bit process that will load my 64bit framework, and the 32bit application can then use XPC to talk to it.
The second option would be to extract all the 64bit-unsafe code (things I MUST compile 32bit-only) and put THAT in a special 32bit-only process then I can make my application 64bit only on Mac, add the new framework, and talk via XPC to the 32bit helper process.
I have Cocoa application with custom XPC service. I would like to create tests for that XPC, so I created new test bundle for that and created some tests. But when I run those tests (whose doesn't show any error in Xcode), IDE is not able to link them to tested XPC bundle. Of course I set Target Dependency to my XPC bundle but it still doesn't work.
I think that problem will be at Test host settings but I'm not good at Xcode configuration. I also studied Apple's tutorial (Daemons and Services Programming Guide) but it doesn't mention testing XPC bundle. Neither their example SandboxedFetch.
On Xcode 7, I managed to test my XPC by adding it in the Copy file build phase of my test target (specifying XPC Services for destination.
Is there any tutorials or references, if such thing is possible, to make GUI applications out of command line apps?
What I mean is, having a command line app, wrap it into an app bundle and create a Cocoa GUI app that would have a simple interface to execute the command line app with its flags and parameters.
As a matter of fact there are. Here is the first hit for a Google search:
Cocoa Dev Central: Wrapping UNIX Commands
What you're looking for is the NSTask class. Check out the documentation for all the information you need.
For very simple scripts, I recommend Platypus. For more complicated scenarios, you could try something like Pashua.