IOS Use Private Framework

來源:互聯網
上載者:User

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

     

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.