I have an NSImage which I am trying to resize like so;
NSImage *capturePreviewFill = [[NSImage alloc] initWithData:previewData];
NSSize newSize;
newSize.height = 160;
newSize.width = 120;
[capturePreviewFill setScalesWhenResized:YES];
[capturePreviewFill setSize:newSize];
NSData *resizedPreviewData = [capturePreviewFill TIFFRepresentat...
cipher.h cipher.m are developing a module has.
NSData value of the encrypted value problem as follows. : <0b21kck 0v35919 sk2910>
As the purpose of encryption is to be sent to NSURLConnection String value.
NSString value to NSData encrypted so I think it must be converted to
What can you do?
...
*cipher.h, cipher.m all code : http://watchitlater.com/blog/2010/02/java-and-iphone-aes-interoperability
Cipher.m
-(NSData *)encrypt:(NSData *)plainText{
return [self transform:KCCEncrypt data:plainText;
}
step1.
Cipher *cipher = [[Cipher alloc]initWithKey:@"1234567890"];
NSData *input = [@"kevin" dataUsingEncoding:NSUTF8StringEnc...
I'm attempting to take an NSImage and convert it to a string which I can write in an XML document.
My current attempt looks something like this:
[xmlDocument setCharacterEncoding: @"US-ASCII"];
NSData* data = [image TIFFRepresentation];
NSString* string = [[NSString alloc] initWithData:data encoding:NSASCIIStringEncoding];
//Put stri...
After some searching, I got the following solution :
ref: http://stackoverflow.com/questions/1392909/nsmutablearray-addobject-with-mallocd-struct
CLLocationCoordinate2D* new_coordinate = malloc(sizeof(CLLocationCoordinate2D));
new_coordinate->latitude = latitude;
new_coordinate->longitude = longitude;
[points addObject:[NSData dataWithB...
hi,
I am attempting to encrypt/decrypt a plain text file in my text editor. encrypting seems to work fine, but the decrypting does not work, the text comes up encrypted. I am certain i've decrypted the text using the word i encrypted it with - could someone look through the snippet below and help me out?
Thanks :)
Encrypting:
NSAlert...
Hi.
I am trying to write an NSData object to a directory like so;
[myData writeToFile:[NSString stringWithFormat:@"%@/%@.txt", path, filename] atomically:YES];
I receive no errors or warnings but I am assuming the write fails because the path variable has the format of afp://10.0.0.20/username/Desktop. I am connected to the networked...
I have a fairly large NSData (or NSMutableData if necessary) object which I want to take a small chunk out of and leave the rest. Since I'm working with large amounts of NSData bytes, I don't want to make a big copy, but instead just truncate the existing bytes. Basically:
NSData *source: < a few bytes I want to
discard > + < big chunk...
I'm trying to serialize an object containing a number of data fields...where one of the fields is of datatype NSData which won't serialize. I've followed instructions at http://www.isolated.se but my code (see below) results in the error "[NSConcreteData data]: unrecognized selector sent to instance...". How do I serialize my object?
He...
I have a data source with about 2000 lines that look like the following:
6712,Anaktuvuk Pass Airport,Anaktuvuk Pass,United States,AKP,PAKP,68.1336,-151.743,2103,-9,A
What I am interested in is the 6th section of this string so I want to turn it into an array, then i want to check the 6th section [5] for an occurrance of that string "PA...
Hello, all!
I need in UIImage created from my colors (for example, i need in image 1x1 pixel with black color).
I've got array:
unsigned char *color[] = {0, 0, 0, 1};
How can i create UIImage from this array ?
I've try
unsigned char *bytes[4] = {0,0,0,1};
NSData *data = [NSData dataWithBytes:bytes length:4];
UIImage *img = [UII...
Hey
is there any way to send whats in a text view (im trying to make a suggestion box) to my email address?
example
user types in the box " I think you should add twitter support"
then that is sent in the background to my email address [email protected]
then a message is popped up on the screen saying "suggestion sent"
just an exampl...
Hello all, this is my first post. I am building an iPhone app and stuck with the following:
unsigned char hashedChars[32];
CC_SHA256([inputString UTF8String], [inputString lengthOfBytesUsingEncoding:NSASCIIStringEncoding], hashedChars);
NSData *hashedData = [NSData dataWithBytes:hashedChars length:32];
NSLog(@"hashedData = %@", hashedDa...
Hi, I'm trying to write a basic test "game state" singleton in cocos2d, but for some reason upon loading the app, initWithCoder is never called. Any help would be much appreciated, thanks.
Here's my singleton GameState.h:
#import "cocos2d.h"
@interface GameState : NSObject <NSCoding>
{
NSInteger level, score;
Boolean seenInstruct...
I use NSData to persist an image in my application. I save the image like so (in my App Delegate):
- (void)applicationWillTerminate:(UIApplication *)application
{
NSLog(@"Saving data");
NSData *data = UIImagePNGRepresentation([[viewController.myViewController myImage]image]);
//Write the file out!
NSArray *paths = NSSe...
I'm having a leak with this code without being able to find where it's coming from.
This function get called within an autorelease pool.
I release the IplImage* image argument.
When I run the ObjAlloc tool, it tells me that "NSData* data" is leaking. If I try to manually release the UIImage returned by this function, I get an EXC_BAD_AC...
NSData *data = [[NSData alloc] initWithContentsOfURL:url];
Url is an NSURL and it works fine. However I'd like to get the HTML (data) after I've logged in.
So the website has a standard way of logging in with 2 textboxes and a submit action on the form.
So how can I log in then get the HTMl source so I can parse it. Do i have to use ...
Hey all!
I'm using ASyncSocket to move some UIImages from one device over to another.
Essentially, on one device I have:
NSMutableData *data = UIImageJPEGRepresentation(image, 0.1);
if(isRunning){
[sock writeData:data withTimeout:-1 tag:0];
}
So a new image will be added to the socket every so often (like a webcam).
Then, on ...
Hi
I am working on a e-banking iphone application.
I am using WSS with XML-Signature to sign the requests to the customer's SOAP server.
Since the iPhone device can not be trusted (due to jail-breaking), the customer
requirement is to manually encrypt the RSA key pair (using AES128) before storing the keys into keychain.
From what I ...
I have downloaded a gif image into an NSData object (I've checked the contents of the NSData object and it's definitely populated). Now I want to load that image into my UIWebView. I've tried the following:
[webView loadData:imageData MIMEType:@"image/gif" textEncodingName:nil baseURL:nil];
but I get a blank UIWebView. Loading the ima...