Search Results

Search found 19072 results on 763 pages for 'iphone sdk 4'.

Page 113/763 | < Previous Page | 109 110 111 112 113 114 115 116 117 118 119 120  | Next Page >

  • How can I programmatically add more than just one view object to my view controller?

    - by BeachRunnerJoe
    I'm diving into iPhone OS development and I'm trying to understand how I can add multiple view objects to the "Left/Root" view of my SplitView iPad app. I've figured out how to programmatically add a TableView to that view based on the example code I found in Apple's online documentation... RootViewController.h @interface RootViewController : UITableViewController <NSFetchedResultsControllerDelegate, UITableViewDelegate, UITableViewDataSource> { DetailViewController *detailViewController; UITableView *tableView; NSFetchedResultsController *fetchedResultsController; NSManagedObjectContext *managedObjectContext; } RootViewController.m - (void)loadView { UITableView *newTableView = [[UITableView alloc] initWithFrame:[[UIScreen mainScreen] applicationFrame] style:UITableViewStylePlain]; newTableView.autoresizingMask = UIViewAutoresizingFlexibleHeight|UIViewAutoresizingFlexibleWidth; newTableView.delegate = self; newTableView.dataSource = self; [newTableView reloadData]; self.view = newTableView; [newTableView release]; } but there are a few things I don't understand about it and I was hoping you veterans could help clear up some confusion. In the statement self.view = newTableView, I assume I'm setting the entire view to a single UITableView. If that's the case, then how can I add additional view objects to that view alongside the table view? For example, if I wanted to have a DatePicker view object and the TableView object instead of just the TableView object, then how would I programmatically add that? Referencing the code above, how can I resize the table view to make room for the DatePicker view object that I'd like to add? Thanks so much in advance for your help! I'm going to continue researching these questions right now.

    Read the article

  • Preset value of HTML Forms

    - by laura
    Hi. I'm trying to preset the value of a dropdown menu and the value of a text box in an HTML form. As soon as the user taps the button in my iPhone app, it enters the webview and I was hoping to preset one of the dropdown menus and text field. How do I go about this? I want to set the dropdown to value "4" and the text field to "Giro Apps" Here's the relevant HTML form code: <select id="advSrcId" class="list" onchange="showOther($('advSrcId').options[$('advSrcId').selectedIndex].value)" name="advSrcId"> <option selected="" value="">Select</option> <option value="1">Google</option> <option value="2">Facebook</option> <option value="3">Friend Referral</option> <option value="4">Other</option> </select> <div id="otherAdvsrc" style=""> <p> Please give details here: <br/> <input class="text" type="text" value="" name="advsrc"/> <br/> </p> </div> TIA!

    Read the article

  • UISlider how to set the initial value

    - by slim
    I'm pretty new at this iphone dev stuff and i'm working on some existing code at a company. The uislider i'm trying to set the initial value on is actually in a UITableViewCell and is a custom control. I was thinking in the cell init cell = (QuantitiesCell *)[self loadCellWithNibName:@"QuantitiesCell" forTableView:ltableView withStyle:UITableViewCellStyleDefault]; i could just call something like ((QuantitiesCell *)cell).value = 5; The actual QuantitiesCell class has the member value and the following functions -(void)initCell;{ if (listOfValues == nil) { [self initListOfValues]; } quantitiesSLider.maximumValue = [listOfValues count]-1; quantitiesSLider.minimumValue = 0; quantitiesSLider.value = self.value; } -(void)initListOfValues;{ listOfValues = [[NSMutableArray alloc] initWithCapacity:10]; int j =0; for (float i = minValue; i <= maxValue+increment; i=i+increment) { [listOfValues addObject:[NSNumber numberWithFloat: i]]; if (i == value) { quantitiesSLider.value = j; } j++; } } like i said, i'm pretty new at this so if i need to post more of the code to show whats going to get help, let me know, This slider always is defaulting to 1, the slider ranges usually from 1-10, and i want to set it to a specific value of the item i'm trying to edit.

    Read the article

  • UIImagePickerControllerDelegate Returns Blank "editingInfo" Dictionary Object

    - by Leachy Peachy
    Hi there, I have an iPhone app that calls upon the UIImagePickerController to offer folks a choice between selecting images via the camera or via their photo library on the phone. The problem is that sometimes, (Can't always get it to replicate.), the editingInfo dictionary object that is supposed to be returned by didFinishPickingImage delegate message, comes back blank or (null). Has anyone else seen this before? I am implementing the UIImagePickerControllerDelegate in my .h file and I am correctly implementing the two delegate methods: didFinishPickingImage and imagePickerControllerDidCancel. Any help would be greatly appreciated. Thank you in advance! Here is my code... my .h file: @interface AddPhotoController : UIViewController <UIImagePickerControllerDelegate, UINavigationControllerDelegate> { IBOutlet UIImageView *imageView; IBOutlet UIButton *snapNewPictureButton; IBOutlet UIButton *selectFromPhotoLibraryButton; } @property (nonatomic, retain) UIImageView *imageView; @property (nonatomic, retain) UIButton *snapNewPictureButton; @property (nonatomic, retain) UIButton * selectFromPhotoLibraryButton; my .m file: @implementation AddPhotoController @synthesize imageView, snapNewPictureButton, selectFromPhotoLibraryButton; - (IBAction)getCameraPicture:(id)sender { UIImagePickerController *picker = [[UIImagePickerController alloc] init]; picker.delegate = self; picker.sourceType = UIImagePickerControllerSourceTypeCamera; picker.allowsImageEditing = YES; [self presentModalViewController:picker animated:YES]; [picker release]; } - (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingImage:(UIImage *)image editingInfo:(NSDictionary *)editingInfo { NSLog(@"Image Meta Info.: %@",editingInfo); UIImage *selectedImage = image; imageView.image = selectedImage; self._havePictureData = YES; [self.useThisPhotoButton setEnabled:YES]; [picker dismissModalViewControllerAnimated:YES]; } - (void)imagePickerControllerDidCancel:(UIImagePickerController *)picker { [picker dismissModalViewControllerAnimated:YES]; }

    Read the article

  • Help needed to write input for .net web services

    - by MaheshBabu
    Hi folks, i am new to iphone web services. I need to get data from .net web server for that my soap message is NSString *xml = [NSString stringWithFormat:@"<MortgageGetLoanOfficerInfo><PhoneNumber>919703661366</PhoneNumber></MortgageGetLoanOfficerInfo>"]; NSString *soapMessage = [NSString stringWithFormat: @"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" "<soap:Envelope xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">\n" "<soap:Body>\n" "<GenericAndroidMethod xmlns=\"Mortgage\">\n" "<methodName>MortgageGetLoanOfficerInfo</methodName>" "<xmlParam>%@</xmlParam>" "</GenericAndroidMethod>\n" "</soap:Body>\n" "</soap:Envelope>\n",xml ]; But i did n't get response. While i am checking in charles web debugging proxy it will show like this. But i need to pass <MortgageGetLoanOfficerInfo><PhoneNumber>919703661366</PhoneNumber></MortgageGetLoanOfficerInfo> as a single string. How can i done this pls help me. Thank u in advance.

    Read the article

  • How do I reference my MainViewController from another class?

    - by todd412
    Hi, I am building an iPhone Utility app that uses UIImageView to display an animation. Within the MainViewController's viewDidLoad() method, I am creating an instance of a CustomClass, and then setting up the animations: - (void)viewDidLoad { [super viewDidLoad]; cc = [CustomClass new]; NSArray * imageArray = [[NSArray alloc] initWithObjects: [UIImage imageNamed:@"image-1-off.jpg"], [UIImage imageNamed:@"image-2-off.jpg"], [UIImage imageNamed:@"image-3-off.jpg"], [UIImage imageNamed:@"image-4-off.jpg"], nil]; offSequence = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 320, 480)]; offSequence.animationImages = imageArray; offSequence.animationDuration = .8; offSequence.contentMode = UIViewContentModeBottomLeft; [self.view addSubview:offSequence]; [offSequence startAnimating]; } That works fine. However, I would like to be able to move all the above code that sets up the UIImageView into my CustomClass. The problem is in the second to last line: [self.view addSubview:offSequence]; I basically need to replace 'self' with a reference to the MainControllerView, so I can call addSubview from within my CustomClass. I tried creating an instance var of CustomClass called mvc and a setter method that takes a reference to the MainViewController as an argument as such: - (void) setMainViewController: (MainViewController *) the_mvc { mvc = the_mvc; } And then I called it within MainViewController like so: [cc setMainController:MainViewController:self]; But this yields all sorts of errors which I can post here, but it strikes me that I may be overcomplicating this. Is there an easier way to reference the MainViewController that instanatiated my CustomClass?

    Read the article

  • OpenGL ES - how to keep some object at a fixed size?

    - by OMH
    I'm working on a little game in OpenGL ES. In the background, there is a world/map. The map is just a large texture. Zoom/pinch/pan is used to move around. And I'm using glOrthof (left, right, bottom, top, zNear, zFar) to implement the zoom/pinch. When I zoom in, the sprites on top of the map is also zoomed in. But I would like to have some sprites stay at a fixed size. I could probably calculate a scale factor, depending on the parameters to glOrthof, but there must be a more natural and straightforward way of doing that, instead of scaling the sprites down when I zoom in. If I add some text or some GUI elements on top of the map, they should definately have a fixed size. Is there a solution to do this, or do I have to leave fixed values in glOrthof and implement zoom/pinch in another way? EDIT: To be more clear: I want sprites that zoom in/out along with the map, but stay at the same size. I have some elements that are like the pins on the iPhone's map application. When you zoom, the pins stay the same size, but move around on the screen to stay on the same spot on the map. That is mainly what I want a solution for. Solutions for this already came below, thanks!

    Read the article

  • App crashes every second time a tableview row is selected in navigation controller setup

    - by Thaurin
    Disclaimer first: I'm pretty new to Objective-C and the retain model. I've been developing in a garbage collected .NET environment for the last five years, so I've been spoiled. I'm still learning. I'm having my iPhone app crash with EXC_BAD_ACCESS. It happens in a navigtation controller/tableview setup. When I select a row the first time, no problems. It switches in the child controller without problems. I go back and select the same row again. Program then proceeds to crash. Every other row works fine, but every second time a row is accessed, it's a crash. I've pinpointed the location where this happens. The child controller (which is a class that I reuse for every row of the same type) that's being switched into has an array of NSString's representing the rows that will be displayed. I set it before pushing the child viewcontroller. It's there where this apparently happens. I'm having a hard time debugging this problem, still wrestling with xcode and all. I fear there may be some vital information missing here, but maybe there is something you recognize here.

    Read the article

  • NSFetchedResultsController on secondary UITableView - how to query data?

    - by Jason
    I am creating a core-data based Navigation iPhone app with multiple screens. Let's say it is a flash-card application. The data model is very simple, with only two entities: Language, and CardSet. There is a one-to-many relationship between the Language entity and the CardSet entities, so each Language may contain multiple CardSets. In other words, Language has a one-to-many relationship Language.cardSets which points to the list of CardSets, and CardSet has a relationship CardSet.language which points to the Language. There are two screens: (1) An initial TableView screen, which displays the list of languages; and (2) a secondary TableView screen, which displays the list of CardSets in the Language. In the initial screen, which lists the languages, I am using NSFetchedResultsController to keep the list of languages up-to-date. The screen passes the Language selected to the secondary screen. On the secondary screen, I am trying to figure out whether I should again use an NSFetchedResultsController to maintain the list of CardSets, or if I should work through Language.cardSets to simply pull the list out of the object model. The latter makes the most sense programatically because I already have the Language - but then it would not automatically be updated on changes. I have looked at the NSFetchedResultsController documentation, and it seems like I can easily create predicates based on attributes - but not relationships. I.e., I can create the following NSFetchedResultsController: NSPredicate *predicate = [NSPredicate predicateWithFormat:@"name LIKE[c] 'Chuck Norris'"]; How can I access my data through the direct relationship - Language.cardSets - and also have the table auto-update using NSFetchedResultsController? Is this possible?

    Read the article

  • Is it possible to achieve MAX(As,Ad) openGL blending?

    - by Jeff B
    I am working on a game where I want to create shadows under a series of sprites on a grid. The shadows are larger than the sprites themselves and the sprites are animated (i.e. move and rotate). I cannot simply render them into the sprite png, or the shadows will overlap adjacent sprites. I also cannot simply put shadows on a lower layer by themselves, because when they overlap, they will create dark bands at their intersection. These sprites are animated, so it is not feasible to render these en masse. Basically, I want the sprites' shadows to blend together such that they max out at a set opacity. Example: I believe this is equivalent to an openGL blending of (Rs,Gs,Bs,Max(As,Ds)), where I don't really care about R,G, and B, as it will always be the same color in src and dst. However, this is not a valid openGL blending mode. Is there an easy way to accomplish this, especially in cocos2d-iphone? I would be able to approximate this by making the shadow sprites opaque, then applying them both to a parent sprite, and making the parent sprite 40% opacity. However, the way cocos2d works, this only sets the opacity of each child to 40%, rather than the combined sprite image, which results in the same stripe.

    Read the article

  • problems getting HTTPRiot working

    - by bwizzy
    I've got an iphone app where I'm trying to use HTTPRiot to make some API calls to a web app. Problem is I can't see that none of the HTTPRiot delegate methods are being called. I've got a log in all the delegate methods, and I'm also looking at the webserver log. I see that the URL is being hit. //API.h #import <Foundation/Foundation.h> #include <HTTPRiot/HTTPRiot.h> @interface API : HRRestModel { } +(void)runTest; @end //API.m #import "API.h" @implementation API + (void)initialize { NSLog(@"api initialize"); [self setDelegate:self]; [self setBaseURL:[NSURL URLWithString:@"http://localhost:3000/api"]]; [self setBasicAuthWithUsername:@"demo" password:@"123456"]; NSDictionary *params = [NSDictionary dictionaryWithObject:@"1234567" forKey:@"api_key"]; [self setDefaultParams:params]; }//end initialize +(void)runTest { NSLog(@"api run test"); // Would send a request to http://localhost:1234/api/people/1?api_key=1234567 [self getPath:@"/save_diet" withOptions:nil object:nil]; } +(void)restConnection:(NSURLConnection *)connection didReturnResource:(id)resource object:(id)object { NSLog(@"didReturnResource"); } +(void)restConnection:(NSURLConnection *)connection didReceiveResponse:(NSHTTPURLResponse *)response object:(id)object { NSLog(@"didReceiveResponse"); } +(void)restConnection:(NSURLConnection *)connection didReceiveParseError:(NSError *)error responseBody:(NSString *)body object:(id)object { NSLog(@"didReceiveParseError"); } +(void)restConnection:(NSURLConnection *)connection didReceiveError:(NSError *)error response:(NSHTTPURLResponse *)response object:(id)object { NSLog(@"didReceiveError"); } +(void)restConnection:(NSURLConnection *)connection didFailWithError:(NSError *)error object:(id)object { NSLog(@"didFailWithError"); } @end //test code [API runTest]; //log output

    Read the article

  • Interface Builder vs Cocos 2D - how choice the best for your app.

    - by baDa
    Hello everyone! I was a flash developer for 3 years, and in the last 5 months, i begin the iphone development, i do 2 applications with interface builder for clients, and now i really want to do a little game, is quite simple, one match 3! I made the engine in interface builder, and seens good to me! But after i read some posts, i really want to try it in the cocos2D! So, in 2 days i rewrite all my first engine for cocos2D, very annoying upsidedown coordinates but ok, i really do! But the performance side by side with interface builder version is really scare! Many Many slow downs at the cocos2d side! And the animation seens bugged to me! I really scare! I really don't know what is the best choice for a simple game. And i want some opinions: Using cocos2d when need some physics? When we have many objects at screen? What is the performance boost i have with cocos2D? I have how to share this 2 applications with you guys?! Without your UID?!

    Read the article

  • How do I reference an instance of a class using its tag?

    - by Matt Winters
    I have several instances of a UIControl class Foo being instantiated, one instance corresponding to each cell in a UITableView. The Class has: BOOL selected; UIImageView *imageView; UIImage *imageOne; UIImage *imageTwo; I've assigned each instance a tag: foo.tag = indexPath.row; I would now like to reference the UIImageView.image for a (or several) specific instance(s) by its tag to switch it to the other image. In my search I've seen things like classes being assigned tags using initWithTag (I assume they're assigning tags)... SomeClass *someClass = [[SomeClass alloc]initWithTag:1 ... [someArray addObject: [[SomeClass alloc]initWithTag:2 ... [someArray addObject: [[SomeClass alloc]initWithTag:3 ... ...but I haven't seen how they are later referenced by that tag. I have seen a reference to getChildByTag which had promise, but I can't find it in the documentation or examples (maybe not iphone). Does anyone know how reference the imageView.image within an instance using its tag? Thanks

    Read the article

  • Why is my view controllers view not quadratic?

    - by mystify
    I created an UIViewController subclass, and figured out that the default implementation of -loadView in UIViewController will ignore my frame size settings in a strange way. To simplify it and to make sure it's really not the fault of my code, I did a clean test with a plain instance of UIViewController directly, rather than making a subclass. The result is the same. I try to make an exactly quadratic view of 320 x 320, but the view appears like 320 x 200. iPhone OS 3.0, please check this out: UIViewController *ts = [[UIViewController alloc] initWithNibName:nil bundle:nil]; ts.view.frame = CGRectMake(0.0f, 0.0f, 320.0f, 320.0f); ts.view.backgroundColor = [UIColor cyanColor]; [self.view addSubview:ts.view]; like you can see, I do this: 1) Create a UIViewController instance 2) Set the frame of the view to a quadratic dimension of 320 x 320 3) Give it a color, so I can see it 4) Added it as a subview. Now the part, that's even more strange: When I make my own implementation of -loadView, i.e. if I put this code in there like this: - (void)loadView { UIView *v = [[UIView alloc] initWithFrame:CGRectMake(0.0f, 0.0f, 320.0f, 320.0f)]; v.backgroundColor = [UIColor cyanColor]; self.view = v; [v release]; } then it looks right. Now lets think about that: In the first example, I do pretty much exactly the same, just that I let UIViewController create the view on it's own, and then take it over in order to change it's frame. Right? So why do I get this strange error? Right now I see no other way of messing around like that to correct this wrong behavior. I did not activate anything like clipsToBounds and there's no other code touching this.

    Read the article

  • Obj-C Sending Messages Between Classes

    - by user544359
    I'm a newbie in iPhone Programming. I'm trying to send a message from one view controller to another. The idea is that viewControllerA takes information from the user and sends it to viewControllerB. viewControllerB is then supposed to display the information in a label. viewControllerA.h #import <UIKit/UIKit.h> @interface viewControllerA : UIViewController { int num; } -(IBAction)do; @end viewControllerA.m #import "viewControllerA.h" #import "viewControllerB.h" @implementation viewControllerA - (IBAction)do { //initializing int for example num = 2; viewControllerB *viewB = [[viewControllerB alloc] init]; [viewB display:num]; [viewB release]; //viewA is presented as a ModalViewController, so it dismisses itself to return to the //original view, i know it is not efficient [self dismissModalViewControllerAnimated:YES]; } - (void)dealloc { [super dealloc]; } @end viewControllerB.h #import <UIKit/UIKit.h> @interface viewControllerB : UIViewController { IBOutlet UILabel *label; } - (IBAction)openA; - (void)display:(NSInteger)myNum; @end viewControllerB.m #import "viewControllerB.h" #import "viewControllerA.h" @implementation viewControllerB - (IBAction)openA { //presents viewControllerA when a button is pressed viewControllerA *viewA = [[viewControllerA alloc] init]; [self presentModalViewController:viewA animated:YES]; } - (void)display:(NSInteger)myNum { NSLog(@"YES"); [label setText:[NSString stringWithFormat:@"%d", myNum]]; } @end YES is logged successfully, but the label's text does not change. I have made sure that all of my connections in Interface Builder are correct, in fact there are other (IBAction) methods in my program that change the text of this very label, and all of those other methods work perfectly... Any ideas, guys? You don't need to give me a full solution, any bits of information will help. Thanks.

    Read the article

  • iPad application crash in Apple review - cannot replicate in simulator, have crash log

    - by Mike
    I am clearly missing something obvious here and would really appreciate some input. I have tried repeatedly to submit an application to Apple (iPad in this case) that is crashing on their end when testing but I cannot replicated the situation on my end (obviously I only have the damned simulator to work with at this point). The crash log is as follows: Date/Time: 2010-04-01 05:39:47.226 -0700 OS Version: iPhone OS 3.2 (7B367) Report Version: 104 Exception Type: EXC_CRASH (SIGABRT) Exception Codes: 0x00000000, 0x00000000 Crashed Thread: 0 Thread 0 Crashed: 0 libSystem.B.dylib 0x000790a0 __kill + 8 1 libSystem.B.dylib 0x00079090 kill + 4 2 libSystem.B.dylib 0x00079082 raise + 10 3 libSystem.B.dylib 0x0008d20a abort + 50 4 libstdc++.6.dylib 0x00044a1c __gnu_cxx::__verbose_terminate_handler() + 376 5 libobjc.A.dylib 0x000057c4 _objc_terminate + 104 6 libstdc++.6.dylib 0x00042dee __cxxabiv1::__terminate(void (*)()) + 46 7 libstdc++.6.dylib 0x00042e42 std::terminate() + 10 8 libstdc++.6.dylib 0x00042f12 __cxa_throw + 78 9 libobjc.A.dylib 0x000046a4 objc_exception_throw + 64 10 CoreFoundation 0x00090c6e +[NSException raise:format:arguments:] + 74 11 CoreFoundation 0x00090d38 +[NSException raise:format:] + 28 12 Foundation 0x00002600 -[NSCFDictionary setObject:forKey:] + 184 13 iPadMosaic 0x00003282 -[iPadMosaicViewController getAlbumThumbs] (iPadMosaicViewController.m:468) 14 Foundation 0x000728fe __NSFireDelayedPerform + 314 15 CoreFoundation 0x00022d1c CFRunLoopRunSpecific + 2092 16 CoreFoundation 0x000224da CFRunLoopRunInMode + 42 17 GraphicsServices 0x000030d4 GSEventRunModal + 108 18 GraphicsServices 0x00003180 GSEventRun + 56 19 UIKit 0x000034c2 -[UIApplication _run] + 374 20 UIKit 0x000019ec UIApplicationMain + 636 21 iPadMosaic 0x00002234 main (main.m:14) 22 iPadMosaic 0x00002204 start + 32 My understanding here is that I am botching the Dictionary add somehow. The relevant lines of code are: for (NSDictionary *album in self.albumList) { // Get image for each album cover UIImage *albumCover; // Loop through photos to get URL of cover based on photo ID match NSString *coverURL = @""; for (NSDictionary *photo in self.photoList) { if ([[photo objectForKey:@"pid"] isEqualToString:[album objectForKey:@"cover_pid"]]) { coverURL = [photo objectForKey:@"src"]; } } NSURL *albumCoverURL = [NSURL URLWithString:coverURL]; NSData *albumCoverData = [NSData dataWithContentsOfURL:albumCoverURL]; albumCover = [UIImage imageWithData:albumCoverData]; if (albumCover == nil || albumCover == NULL) { //NSLog(@"No album cover for some reason"); albumCover = [UIImage imageNamed:@"noImage.png"]; } [[self.albumList objectAtIndex:albumCurrent] setObject:albumCover forKey:@"coverThumb"]; } This is part of a loop that runs over the existing dictionaries stored in an array. If retrieving the album cover fails for some reason the object is filled with a default image and then added. The last line of the code is what's showing up in the crash log. It runs fine in the simulator but crashes 100% in testing on device apparently. Can anyone tell me what I am missing here?

    Read the article

  • iPhone 3DES encryption key length issue

    - by Russell Hill
    Hi, I have been banging my head on a wall with this one. I need to code my iPhone application to encrypt a 4 digit "pin" using 3DES in ECB mode for transmission to a webservice which I believe is written in .NET. + (NSData *)TripleDESEncryptWithKey:(NSString *)key dataToEncrypt:(NSData*)encryptData { NSLog(@"kCCKeySize3DES=%d", kCCKeySize3DES); char keyBuffer[kCCKeySize3DES+1]; // room for terminator (unused) bzero( keyBuffer, sizeof(keyBuffer) ); // fill with zeroes (for padding) [key getCString: keyBuffer maxLength: sizeof(keyBuffer) encoding: NSUTF8StringEncoding]; // encrypts in-place, since this is a mutable data object size_t numBytesEncrypted = 0; size_t returnLength = ([encryptData length] + kCCBlockSize3DES) & ~(kCCBlockSize3DES - 1); // NSMutableData* returnBuffer = [NSMutableData dataWithLength:returnLength]; char* returnBuffer = malloc(returnLength * sizeof(uint8_t) ); CCCryptorStatus ccStatus = CCCrypt(kCCEncrypt, kCCAlgorithm3DES , kCCOptionECBMode, keyBuffer, kCCKeySize3DES, nil, [encryptData bytes], [encryptData length], returnBuffer, returnLength, &numBytesEncrypted); if (ccStatus == kCCParamError) NSLog(@"PARAM ERROR"); else if (ccStatus == kCCBufferTooSmall) NSLog(@"BUFFER TOO SMALL"); else if (ccStatus == kCCMemoryFailure) NSLog(@"MEMORY FAILURE"); else if (ccStatus == kCCAlignmentError) NSLog(@"ALIGNMENT"); else if (ccStatus == kCCDecodeError) NSLog(@"DECODE ERROR"); else if (ccStatus == kCCUnimplemented) NSLog(@"UNIMPLEMENTED"); if(ccStatus == kCCSuccess) { NSLog(@"TripleDESEncryptWithKey encrypted: %@", [NSData dataWithBytes:returnBuffer length:numBytesEncrypted]); return [NSData dataWithBytes:returnBuffer length:numBytesEncrypted]; } else return nil; } } I do get a value encrypted using the above code, however it does not match the value from the .NET web service. I believe the issue is that the encryption key I have been supplied by the web service developers is 48 characters long. I see that the iPhone SDK constant "kCCKeySize3DES" is 24. So I SUSPECT, but don't know, that the commoncrypto API call is only using the first 24 characters of the supplied key. Is this correct? Is there ANY way I can get this to generate the correct encrypted pin? I have output the data bytes from the encryption PRIOR to base64 encoding it and have attempted to match this against those generated from the .NET code (with the help of a .NET developer who sent the byte array output to me). Neither the non-base64 encoded byte array nor the final base64 encoded strings match.

    Read the article

  • IPhone/Objective-c RSA encryption

    - by Paul
    Hello, I have been google-ing and researching for an answer on how to do a simple RSA encryption using objective-c on an iphone. The main problem i have is that i have been supplied the Exponent and Modulus as an NSData object and i need to then convert them to a SecKeyRef object in order to perform the RSA encryption. Does anyone have any idea how to do that or have any useful hints? Many thanks!

    Read the article

  • iPhone NSDate - get time in milliseconds and store in coredata

    - by satyam
    I'm implementing iphone app with coredata functionality. I've an attribute in entity "NSDate" which stores the date and time when the record is added. I'm adding records at a faster rate. About 1 record per 25 milli seconds I want to store the date along with milli seconds so that I can retrieve the data in descending order. How can I do this?

    Read the article

  • iphone development-leopard or snow leopard?

    - by ying
    i am planning start my iphone development, and i have a iMac with tiger 10.4 OS version, planning to upgrade to Leopard 10.5.6 OS X, but i heard apple going to release the Snow Leopard in september, will development environment shift to snow leopard instead of leopard,and Leopard 10.5.7 no longer be used to development?is now a good timing to upgrade?

    Read the article

  • Create Audio file on iPhone/iPad from many other audio files (mixer)

    - by Brian
    I am trying to create something similar like Piano app on the iPhone. When people tap a key, it play a piano note. Basically, there will have only 7 notes (C) at the moment. Each note is a .caf file and its length is 5 seconds. I do not know if there is any way to save the song user played and export to mp3/caf format? The AVAudioRecord seems only record from the microphone input. Many thanks

    Read the article

  • MKMapView memory usage grows out of control with setRegion: calls

    - by Kurt
    Hi, I have a single MKMapView instance that I have programmatically added to a UIView. As part of the UI, the user can cycle through a list of addresses and the map view is updated to show the correct map for each address as the user goes through them. I create the map view once, and simply change what it displays with setRegion:animated:. The problem is that each time the map is changed to show a new address, the memory usage of my program increases by 200K-500K (as reported by Memory Monitor in Instruments). According to Object Allocations, it appears that a lot of 1.0K Mallocs are happening each time, and the Extended Detail pane for these 1.0K allocations shows that the Responsible Caller is convert_image_data and the Extended Detail pane shows that this is the result of [MKMapTileView drawLayer:inContext:]. So, seems likely to me that the memory usage is due to MKMapView not freeing memory it uses to redraw the map each time. In fact, when I don't display the map at all (by not even adding it as a subview of my main UIView) but still cycle through the addresses (which changes various UILabels and other displayed info) the memory usage for the app does NOT increase. If I add the map view but never update it with setRegion:, the memory also does NOT increase when changing to a new address. One more bit of info: if I go to a new address (and therefore ask the map to display the new address) the memory jumps as described above. However, if I go back to an address that was already displayed, the memory does not jump when the map redraws with the old address. Also, this happens on iPad (real device) with 3.2 and on iPhone (again, real device) with 3.1.2. Here's how I initialize the MKMapView (I only do this once): CGRect mapFrame; mapFrame.origin.y = 460; // yes, magic numbers. just for testing. mapFrame.origin.x = 0; mapFrame.size.height = 500; mapFrame.size.width = 768; mapView = [[MKMapView alloc] initWithFrame:mapFrame]; mapView.delegate = self; [self.view insertSubview:mapView atIndex:0]; And in response to the user selecting an address, I set the map like so: MKCoordinateRegion region; MKCoordinateSpan span; span.latitudeDelta=kStreetMapSpan; // 0.003 span.longitudeDelta=kStreetMapSpan; // 0.003 region.center = address.coords; // coords is CLLocationCoordinate2D region.span = span; mapView.region.span = span; [mapView setRegion:region animated:NO]; Any thoughts? I've scoured the net but haven't seen mention of this problem, and I've reached the limits of my Instruments knowledge. Thanks for any ideas.

    Read the article

  • Center content of UISCrollView when smaller

    - by hgpc
    I have an UIImageView inside a UIScrollView which I use for zooming and scrolling. If the image/content of the scroll view if bigger than the scroll view everything works fine. However, when the image becomes smaller than the scroll view, it sticks to the top left corner of the scroll view. I would like to keep it centered, like the Photos app. Any ideas or examples about keeping the content of the UIScrollView centered when smaller? I am working with iPhone 3.0. The following code almost works. The image returns to the top left corner if I pinch it after reaching the minimum zoom level. - (void)loadView { [super loadView]; // set up main scroll view imageScrollView = [[UIScrollView alloc] initWithFrame:[[self view] bounds]]; [imageScrollView setBackgroundColor:[UIColor blackColor]]; [imageScrollView setDelegate:self]; [imageScrollView setBouncesZoom:YES]; [[self view] addSubview:imageScrollView]; UIImageView *imageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"WeCanDoIt.png"]]; [imageView setTag:ZOOM_VIEW_TAG]; [imageScrollView setContentSize:[imageView frame].size]; [imageScrollView addSubview:imageView]; CGSize imageSize = imageView.image.size; [imageView release]; CGSize maxSize = imageScrollView.frame.size; CGFloat widthRatio = maxSize.width / imageSize.width; CGFloat heightRatio = maxSize.height / imageSize.height; CGFloat initialZoom = (widthRatio heightRatio) ? heightRatio : widthRatio; [imageScrollView setMinimumZoomScale:initialZoom]; [imageScrollView setZoomScale:1]; float topInset = (maxSize.height - imageSize.height) / 2.0; float sideInset = (maxSize.width - imageSize.width) / 2.0; if (topInset < 0.0) topInset = 0.0; if (sideInset < 0.0) sideInset = 0.0; [imageScrollView setContentInset:UIEdgeInsetsMake(topInset, sideInset, -topInset, -sideInset)]; } - (UIView *)viewForZoomingInScrollView:(UIScrollView *)scrollView { return [imageScrollView viewWithTag:ZOOM_VIEW_TAG]; } /************************************** NOTE **************************************/ /* The following delegate method works around a known bug in zoomToRect:animated: */ /* In the next release after 3.0 this workaround will no longer be necessary */ /**********************************************************************************/ - (void)scrollViewDidEndZooming:(UIScrollView *)scrollView withView:(UIView *)view atScale:(float)scale { [scrollView setZoomScale:scale+0.01 animated:NO]; [scrollView setZoomScale:scale animated:NO]; // END Bug workaround CGSize maxSize = imageScrollView.frame.size; CGSize viewSize = view.frame.size; float topInset = (maxSize.height - viewSize.height) / 2.0; float sideInset = (maxSize.width - viewSize.width) / 2.0; if (topInset < 0.0) topInset = 0.0; if (sideInset < 0.0) sideInset = 0.0; [imageScrollView setContentInset:UIEdgeInsetsMake(topInset, sideInset, -topInset, -sideInset)]; }

    Read the article

  • Using the PayPal API in an iPhone application

    - by jaynaiphone
    Hello I want to use Paypal in my iphone application, I have find the soapRequest to integrating the paypal API. My code is NSString *soapMessage = [NSString stringWithFormat: @"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" "<SOAP-ENV:Envelope xmlns:xsi= \"http://www.w3.org/2001/XMLSchema-instance\" xmlns:SOAP-ENC=\"http://schemas.xmlsoap.org/soap/encoding/\" xmlns:SOAP-ENV=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" SOAP-ENV:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\">\n" "<SOAP-ENV:Header>\n" "<RequesterCredentials xmlns=\"urn:ebay:api:PayPalAPI\">\n" "<Credentials xmlns=\"urn:ebay:apis:eBLBaseComponents\">\n" "<Username>api_username</Username>\n" "<Password>api_password</Password>\n" "<Signature/>\n" "<Subject/>\n" "</Credentials>\n" "</RequesterCredentials>\n" "</SOAP-ENV:Header>\n" "<SOAP-ENV:Body>\n" "<specific_api_name_Req xmlns=\"urn:ebay:api:PayPalAPI\">\n" "<specific_api_name_Request>\n" "<Version xmlns=urn:ebay:apis:eBLBaseComponents”>service_version</Version>\n" "<required_or_optional_fields xsi:type=”some_type_here”>\n" "</required_or_optional_fields>\n" "</specific_api_name_Request>\n" "</specific_api_name_Req>\n" "</SOAP-ENV:Body>\n" "</SOAP-ENV:Envelope>\n"]; NSLog(@"Soap message===%@",soapMessage); NSString *parameterString = [NSString stringWithFormat:@"USER=%@&PWD=%@&SIGNATURE=%@&VERSION=57.0&METHOD=SetMobileCheckout&AMT=%.2f&CURRENCYCODE=USD&DESC=%@&RETURNURL=%@", userName, password, signature, donationAmount, @"Some Charge", returnCallURL]; NSLog(parameterString); NSURL *url = [NSURL URLWithString:paypalUrlNVP]; NSMutableURLRequest *theRequest = [NSMutableURLRequest requestWithURL:url]; NSString *msgLength = [NSString stringWithFormat:@"%d", [parameterString length]]; [theRequest addValue: msgLength forHTTPHeaderField:@"Content-Length"]; [theRequest setHTTPMethod:@"POST"]; [theRequest setHTTPBody: [parameterString dataUsingEncoding:NSUTF8StringEncoding]]; NSURLConnection *theConnection = [[NSURLConnection alloc] initWithRequest:theRequest delegate:self]; if( theConnection ){ webData = [[NSMutableData data] retain]; // [self displayConnectingView]; }else{ NSLog(@"theConnection is NULL"); } But here I am not getting the value of paypalUrlNVP. How can i get it?? And if possible then please give some example of paypalAPI integration in iphone. I also want to use checkout functionality.I am new in this field so I have no idea about it. So, kindly give me whole sample code. Thanks in advance.

    Read the article

< Previous Page | 109 110 111 112 113 114 115 116 117 118 119 120  | Next Page >