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]; }