How to debug library in Xcode 5? - ios

I am new to Xcode and Mac world. I usually work in VC++ using Visual Studio. As in Visual Studio, we can attach a process to .lib or .dll code, is there any way to attach process and debug library (.a) code in Xcode?
Regards

One way is to add library XCode project inside the application or use the library source files inside the application. This requires the availability of library source files. Also make sure to use debug mode in XCode.
You can use the Menu option File -> Add Files to option to add files to XCode project.

Create an Workspace (https://developer.apple.com/library/ios/featuredarticles/XcodeConcepts/Concept-Workspace.html) and add the Library-Project and your Project to it (Drag & Drop). After some configurations (Youtube is full of tutorials) you can set breakpoints in the library code.

Related

How do I compile a library in Xcode using a makefile?

I need to compile a library written in C in Xcode. For this I need to use a make file. How can I include a make file in my project?
Any link for writing a make file or sample of a make file for running on the iOS simulator would be helpful.
Also if I use cmake, then what commands do I use in the terminal to create a static Library for iOS simulator?
Thanks
First, your project generator is either Xcode or Make. You can't have a makefile in Xcode.
If you want to generate an iOS library from C/C++ sources, take a look at this google project. The project wiki explains how to use the iOS CMake toolchain. This will give you a .xcodeproj file. You can build and then link to that library from other iOS projects. Also there's this fork available on Github which you could take a look at.
If the target system is exclusively iOS, you could alternatively create a new iOS library project from scratch (no CMake) and throw in your sources manually.

Worklight - Building iPhone environment

I am working on Worklight version 6.1.I have created a native ios environment.I added controller classes in the Xcode project and added native functionalities. I have added .js files in the eclipse project.Now I need build my iPhone environment.But I am afraid that native content (Xcode project) will get lost,after building the environment.What is the solution for this.
I should build at the same time native content shouldn't be lost.
How to do this...
Your explanation is VERY raw... it doesn't make much sense to me.
have created a native ios environment
What is that exactly? do you mean that you:
Created a Worklight project and added a Native API for iPhone, or
Created a Worklight project, added a Hybrid app and then added the iPhone environment to that application
Created a fully native project in Xcode?
The distinction between the 3 is important, and you need to mention this in your question in clear wording.
If what you mean is that you went with option 2 above, then your JS, CSS and HTML can be either in the common folder or in the environment folder.
If you then want to add native code, you need to first build your project and then open the generated Xcode project in Xcode, write native code and make sure to copy it back to your Worklight project in Eclipse.
I added controller classes in the Xcode project and added native
functionalities
Where did you add this? In which file? in the classes provided by Worklight in option 2 above, or in a new Class.
Either way, you need to bring these files back into Eclipse.
In Eclipse, you can create a iphone\nativeResources\Classes folder. During build-time in Eclipse, the files in this folder will be copied into the iphone\native\Classes folder, and when opened again in Xcode - your native code will be there...
Note: if you created your own class file, you will need to reference it in Xcode (right-click > add files...). Worklight cannot do this for you.
I believe your customizations should not be lost. Have you tried making the build already and your resources were overwritten?

Do all artifacts in the Worklight iphone/native folder get propagated from Worklight into the xcode project

Working with a partner who is creating a cordova plugin.
If we add framework folders and artifacts to the Frameworks directory under iphone->native in eclipse will they get pulled into the corresponding xcode project?
There are some flags that need to be added to the ‘Linking’ properties under build settings. Does this need to be done through the xCode IDE?
Thanks!
JT
Some actions must be done in Xcode.
For example, if you are creating a Cordova plug-in, then you need to:
Edit config.xml - this can be done in Eclipse
Place the .m and .h files in the Classes folder - you can put them there while in Eclipse, but they will not be referenced in the Xcode project
for this you must first build the Worklight project
and then open it in Xcode and add the files you've placed in the Classes folder to the project it self
You would normally need to go to Xcode to create the plug-in to begin with, but assuming you downloaded a plug-in...
The same applies to frameworks.

Unity: resources.bundle isn't added to xcode

I used to copy/paste my IOS plugin files inside Plugins/IOS folder on my Unity project, but it doesn't work for bundles (as it has directory structure).
I can't beleave there is no way to generate xcode project from unity with .bundle inside?
Any help appreciated
Unity3D will not contains folders in the Plugins/iOS to Xcode project. In fact Unity3D will only auto merge source file and .a library for you, as described by Unity3D's doc:
Automated plugin integration Unity iOS supports automated plugin
integration in a limited way. All files with extensions
.a,.m,.mm,.c,.cpp located in the Assets/Plugins/iOS folder will be
merged into the generated Xcode project automatically. However,
merging is done by symlinking files from Assets/Plugins/iOS to the
final destination, which might affect some workflows. The .h files are
not included in the Xcode project tree, but they appear on the
destination file system, thus allowing compilation of .m/.mm/.c/.cpp
files.
Note: subfolders are currently not supported.
But you can use the PostprocessBuildPlayer attribute to implement this yourself. I made a tool for this purpose called XUPorter, which can make exporting and libraries setting easier from Unity3D to Xcode. You may want to see it on GitHub. There is a demo in the package and you may set your bundle under the 'folders' tag.

How do I add this C library to my iOS Xcode 4 project?

I'm trying to add the openjpeg library to my XCode 4 project so that I can compress images taken by the iPhone's camera to jpeg2000.
I built the static library (libopenjpeg.a) using Cmake on OS/X. (I'm guessing this may have been the first error, that it needs to be built by XCode so it's built for iPhone architecture and not OS X).
I have the library added in the Link Binary with Libraries of my target.
The project builds successfully but I can't seem to import any of the headers from the library into any of my Objective-C classes. I've tried manually adding the folder that contains the libopenjpeg header files to the User Header Search Path but that did not seem to do anything.
Any suggestions?
for the simplest solution
Import the head files to you project's source.
You can still build it on the command-line with CMake, you'd just have to modify the CMakeLists.txt file so the right flags are passed when compiling.
However as Gavin indicates, it may be simpler just to drag the header and source files from the library into your Xcode project, and forego the building of a static library.

Resources