https://github.com/nst/iOS-Runtime-Headers
Private Framework 有两种情况,
1,Framework 已经加载,只是未导出头文件,这种情况只需要把头文件加入到工程即可直接调用。
如下面代码中的_MFSocket
2, Framework未加载,则需要把Framework和头文件一起加入到工程,之后在调用。
如下面代码中的UIProgressHUD
例子:
#import "ViewController.h"
#import "UIASyntheticEvents.h"
#import "MFSocket.h"
#import "UIProgressHUD.h"
#import "UIAlertTextView.h"
@implementation ViewController
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Release any cached data, images, etc that aren't in use.
}
#pragma mark - View lifecycle
- (void)viewDidLoad
{
[super viewDidLoad];
//UIASyntheticEvents *events = [UIASyntheticEvents sharedEventGenerator];
//[events lockDevice];
_MFSocket *socket = [[_MFSocket alloc] init];
BOOL isOK = [socket connectToHost:@"127.0.0.1" withPort:8888 service:nil];
if (isOK) {
int bufferLength = 1024;
char *buffer = malloc(bufferLength * sizeof(char));
int length = [socket readBytes:buffer length:bufferLength];
NSLog(@"read length -> %d", length);
NSLog(@"read string -> %@", [NSString stringWithCString:buffer encoding:NSUTF8StringEncoding]);
NSString *command = @"Hello World. \n\r";
[socket writeBytes:[command UTF8String] length:[command length]];
}
[socket release];
UIProgressHUD *progressHUD = [[UIProgressHUD alloc] initWithFrame:CGRectMake(50., 50., 100., 100.)];
//[progressHUD setText:@"Loading..."];
[progressHUD setShowsText:YES];
[progressHUD showInView:self.view];
//[progressHUD setFontSize:12];
[progressHUD release];
}