Crie um método SHA-1 em Objective-C

Primeiro, importe CommonDigest.h de CommonCrypto #import <CommonCrypto/CommonDigest.h> Em seguida, cole este código de amostra onde você precisa: -(NSString*) returnHashWithSHA1:(NSString*)inputText { const char *cstr = [inputText cStringUsingEncoding:NSUTF8StringEncoding]; NSData *data = [NSData …

Continuar lendo

Como recuperar informações da operadora?

CTTelephonyNetworkInfo* telephonyNetworkInfo = [[CTTelephonyNetworkInfo alloc] init];CTCarrier* carrierObject = [telephonyNetworkInfo subscriberCellularProvider];string = [[NSString alloc] initWithFormat:@”Allow VoIP: %dnCarrier Name: %@nISO Country Code: %@nMobile Country Code: %@nMobile Network Code: %@”, carrierObject.allowsVOIP, carrierObject.carrierName, carrierObject.isoCountryCode, …

Continuar lendo

layoutView e NSData

Ainda não tenho certeza do porquê (irei fazer o acompanhamento se tiver tempo), mas não faça isso: -(void)layoutSubviews { NSData *imageData = [[NSData alloc] initWithContentsOfURL:imageURL]; UIImage *image = [[UIImage alloc] …

Continuar lendo

Inicialização lenta em Objective-C

A inicialização lenta em Objective-C pode ser feita de maneira simples via BloodMagic @­interface ViewController : UIViewController <BMLazy>@­property (nonatomic, strong) ProgressViewService *progressViewService;@­property (nonatomic, strong) ResourceLoader *resourceLoader;@­end@­implementation ViewController@­dynamic progressViewService;@­dynamic resourceLoader;- (void)loadResources{ …

Continuar lendo