XPC test bundle on Xcode 5 - objective-c

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.

Related

How to set breakpoints in a Objc framework that is used by a blackbox Mac application?

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.

How to create a Hello World XPC program?

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

Is there any DSYM file for .framework (besides 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.

Preserve an external legacy apps file resource fork when including in an Xcode archive

I have created a cocoa application primarily to run on OS 10.6.8. to convert certain types of proprietary legacy files. The app looks at the legacy files creator code and processes it accordingly if it is a known type. Once the file is identified, I call an external legacy app (which I have added to the project) using [NSWorkspace openFile: withApplication: ]to open the droplet and process the file conversion.
The application works just like it is supposed to until I archive it and try to run it from the application bundle. Actually, it will continue to work but it is using the converter app from the project. If I delete the converter in the project area, then the app in the app bundle can not open the external app in that location. One work around is to delete the external app from the bundle after its archived and replace it with a copy of the one in the project area.
I would appreciate any suggestions on resolving this. I'm not sure if the problem is in some Xcode build setting I can change to include an external apps resource fork when archiving, or if this is a launch services issue with apps hidden in packages, or , something I'm not even considering.
Thanks
Mike
Try setting the "Preserves HFS Data" (COPYING_PRESERVES_HFS_DATA) build setting.

Is it possible to make an Objective-C project (no UI, no simulator) to be tested on Travis (travis-ci.org)?

I wonder if it is possible to make an Objective-C project (no UI, no simulator is needed, hosted on Github) to be built on Travis?
Current Travis docs seems not to contain any information regarding the option to have Objective-C projects built on Travis.
But Building a C Project says that:
Travis VMs are 32 bit and currently provide
gcc 4.6
clang 3.1
core GNU build toolchain (autotools, make), cmake, scons
and that default test script is run like
./configure && make && make test
So, to rephrase the subject question:
Do any workarounds exist to make SenTestingKit test suite, that my project currently uses, behave like a C test suite, so it could be treated as such by Travis VM?
NOTE 1: Here is the list of resources, which seem to be related to the question:
Compiling Objective-C without a GUI. It claims that Both gcc and clang compile Objective-C 2.0 and that sounds very promising!
NOTE 2: I suspect that it is possible to use some testing tool other than SenTestingKit:
this tool should be easy to be run without a GUI and without xcodebuild etc: I've opened related issue for that: Is there any non-Xcode-based command line testing tool for Objective-C?. I am even thinking about writing an easy one just to be used by my project.
A few days Travis announced that they are now also supporting objetive-c projects. See Building An Objective-C Project for more info.
Update
It is even possible to make Travis launch the simulator so that you can run application tests and UI related stuff. I required a little extra work, but it's pretty straight forward. I wrote about it here.