iOS FrameWork UnitTesting - iphone

I have created a iOS framework and want to use that framework in one of my application.
My question is about the UnitTesting of the framework.
I have read about the inbuilt xcode unittest framework, but not sure how to get started on testing the framework.
Or do I have to import the framework in one of my apps and then perform the testing of the framework via
Regards,
Nirav

Add a new target to your project, select Others -> Cocoa Touch Unit Testing Bundle, give it a name.
Add to the new target the Compile Sources and the Link Binary. And in your test class write the tests you need.

Related

Debug a framework while developing

I am creating a statistical calculator app. It has various functions.
I am creating the functions in a cocoapod framework.
How can we test or debug a library framework while we develop it? That means every time without copying it to the demo/test project.
In your framework project, in Xcode add a target for testing. Press File > New > Target... > iOS Unit Testing Bundle.
This will create a test target for you. You can run this target at any time. Also, a swift file with a subclass of XCTestCase. This class has all functions necessary for testing, such as setUp(), testExample() or testPerformanceExample(). You can read how to use this in the XCTest framework reference.

I'm making Swift framework but it doesn't have the class I made

I'm testing creating framework.
So, I made the test framework first.
And in another project, I imported the framework but I can't access the MyClass I made.
What's the problem? I don't know weather if can't access the class or framework doesn't have the class I made.
I'm struggling with this problem about two days.
Help me please.
Got the issue.PFB the explanation.
You have built the framework against 'Generic iOS device'.
You are trying to use against simulator which requires x86_64 architecture.
This is the reason which your iOS framework classes are not getting recognized in your view controller. Since your framework is built only for iOS devices.
Solution to your Question:
Change your build target device to 'Generic iOS device' and just build it and you can't run.
Generic Solution:
Try the tutorials for building universal framework where you will add 'Run Script phase' to create binary slices for all architectures(32-bit, 64-bit devices and simulators).
Output:

Swift: Creating Framework dependencies

iOS8:
I'm trying to create a Database framework (DBKit) that will be used amongst our apps. DBKit requires Couchbase (ObjC) and Alamofire (Swift) frameworks.
I'm trying to avoid using Umbrella framework as it's discouraged by Apple.
Questions:
When creating a framework, how do I tell the framework to use Couchbase and Alamofire within the Demo Project?
Is using Cocoa Pods to manage frameworks inside a framework a good idea?
Believe you should be linking to the respective external libraries from within your application and NOT your own framework.
For Couchbase, you can simply drag in the frameworks to the 'Supporting Files' folder within your iOS project.

Implementing Cocoa XML-RPC framework for iphone

I have my drupal xml-rpc service setup, and now I want to retrieve content for my iphone app.
I'm attempting to use https://github.com/eczarny/xmlrpc, however I dont know where to begin. How do I add the project to my own project for use? I've added a static library before; is it the same process? Just drag the proj file to my project and add the xml-rpc library?
Any tips would be appreciated.
Try dragging the project file for xmlrpc framework into the code list in XCode for starters. Next make the framework target in the xmlrpc framework a build dependency. Finally add the xmlrpc.framework to your linked frameworks. Exactly how you do this depends on whether you are using XCode 3 or 4

How to build a Framework class in XCode?

I want to build a framework regarding some common aspects used in xcode like that of UIKit, Foundation etc. Is it possible for us to create our own framework which could be reused later ? If so, could you tell us a step by step procedure of how to do it?
This is now possible, see:
https://github.com/kstenerud/iOS-Universal-Framework
It's not currently possible to create a framework using the iPhone SDK. The closest you can come is bundling the logic you want to have shareable into a static library.
This is a good writeup on how to go about doing that for the iPhone SDK:
http://blog.stormyprods.com/2008/11/using-static-libraries-with-iphone-sdk.html