1. Create Empty Application in Xcode and Name it "MyFirstFramework"
2. Click on "Add Target" and add bundle in the Targets and named it "MyiOSFramework".
3. Now right click on "MyiOSFramework" and click on "New Files" and add NSObject file and named it "MyClass".
4. In the MyClass.h add below code,
@interface MyClass : NSObject
-(void)Log:(NSString *)str;
@end
5. In the MyClass.m add below code,
-(void)Log:(NSString *)str
{
NSLog(@"%@",str);
}
6. Now click on main menu and do the "MyiOSFramework" and change the settings as below :
7. Add Copy Headers
8. Now make the file private and public according to your need. Generally .h file goes in public and .m file goes in private. like this
9. Remove #import <Cocoa/Cocoa.h> From the MyiOSFramework-Prefix.pch
10. Remove all reference in the Link Binary with Libraries
11. Now Build the "MyiOSFramework"
12. Your framework in ready in the build folder. Now copy this framework to safe folder and use it in the another project
13. Just add this framework to you Test project in the resource folder, go the app delegate and add this line
#import <MyiOSFramework/MyClass.h>
And in the didFinishLaunchingWithOptions in app delegate
MyClass *obj = [[MyClassalloc]init];
[obj log:@"Hi! My First Framework works great"];
Enjoy the framework
Thanks
2. Click on "Add Target" and add bundle in the Targets and named it "MyiOSFramework".
3. Now right click on "MyiOSFramework" and click on "New Files" and add NSObject file and named it "MyClass".
4. In the MyClass.h add below code,
@interface MyClass : NSObject
-(void)Log:(NSString *)str;
@end
5. In the MyClass.m add below code,
-(void)Log:(NSString *)str
{
NSLog(@"%@",str);
}
6. Now click on main menu and do the "MyiOSFramework" and change the settings as below :
- Base SDK: Latest iOS (iOS X.X).
- Architectures: Standard (armv7, armv7s) in xCode 4.3 Standard (armv7)
- Build Active Architecture Only: NO
- Supported Platforms: iOS, in xCode 4.3 (iphonesimulator iphoneos)
- Valid Architecture: $(ARCHS_STANDARD_32_BIT)
- OS X Deployment Target: Compiler Default.
- Dead Code Stripping: NO.
- Link With Standard Libraries: NO.
- Mach-O Type: Relocatable Object File.
- Other Linker Flags [optional change, depends upon your framework]: -ObjC
- Wrapper Extension: framework
7. Add Copy Headers
8. Now make the file private and public according to your need. Generally .h file goes in public and .m file goes in private. like this
9. Remove #import <Cocoa/Cocoa.h> From the MyiOSFramework-Prefix.pch
10. Remove all reference in the Link Binary with Libraries
11. Now Build the "MyiOSFramework"
12. Your framework in ready in the build folder. Now copy this framework to safe folder and use it in the another project
13. Just add this framework to you Test project in the resource folder, go the app delegate and add this line
#import <MyiOSFramework/MyClass.h>
And in the didFinishLaunchingWithOptions in app delegate
MyClass *obj = [[MyClassalloc]init];
[obj log:@"Hi! My First Framework works great"];
Enjoy the framework
Thanks






