Search Results

Search found 4899 results on 196 pages for 'ios newbie'.

Page 12/196 | < Previous Page | 8 9 10 11 12 13 14 15 16 17 18 19  | Next Page >

  • iOS layout; I'm not getting it

    - by Tbee
    Well, "not getting it" is too harsh; I've got it working in for what for me is a logical setup, but it does not seem to be what iOS deems logical. So I'm not getting something. Suppose I've got an app that shows two pieces of information; a date and a table. According to the MVC approach I've got three MVC at work here, one for the date, one for the table and one that takes both these MCVs and makes it into a screen, wiring them up. The master MVC knows how/where it wants to layout the two sub MVC's. Each detail MVC only takes care of its own childeren within the bounds that were specified by the master MVC. Something like: - (void)loadView { MVC* mvc1 = [[MVC1 alloc] initwithFrame:...] [self.view addSubview:mvc1.view]; MVC* mvc2 = [[MVC2 alloc] initwithFrame:...] [self.view addSubview:mvc2.view]; } If the above is logical (which is it for me) then I would expect any MVC class to have a constructor "initWithFrame". But an MVC does not, only view have this. Why? How would one correctly layout nested MVCs? (Naturally I do not have just these two, but the detail MVCs have sub MVCs again.)

    Read the article

  • Saving Email/Password to Keychain in iOS

    - by Jason
    I'm very new to iOS development so forgive me if this is a newbie question. I have a simple authentication mechanism for my app that takes a user's email address and password. I also have a switch that says 'Remember me'. If the user toggles that switch on, I'd like to preserve their email/password so those fields can be auto-populated in the future. I've gotten this to work with saving to a plist file but I know that's not the best idea since the password is unencrypted. I found some sample code for saving to the keychain, but to be honest, I'm a little lost. For the function below, I'm not sure how to call it and how to modify it to save the email address as well. I'm guessing to call it would be: saveString(@"passwordgoeshere"); Thank you for any help!!! + (void)saveString:(NSString *)inputString forKey:(NSString *)account { NSAssert(account != nil, @"Invalid account"); NSAssert(inputString != nil, @"Invalid string"); NSMutableDictionary *query = [NSMutableDictionary dictionary]; [query setObject:(id)kSecClassGenericPassword forKey:(id)kSecClass]; [query setObject:account forKey:(id)kSecAttrAccount]; [query setObject:(id)kSecAttrAccessibleWhenUnlocked forKey:(id)kSecAttrAccessible]; OSStatus error = SecItemCopyMatching((CFDictionaryRef)query, NULL); if (error == errSecSuccess) { // do update NSDictionary *attributesToUpdate = [NSDictionary dictionaryWithObject:[inputString dataUsingEncoding:NSUTF8StringEncoding] forKey:(id)kSecValueData]; error = SecItemUpdate((CFDictionaryRef)query, (CFDictionaryRef)attributesToUpdate); NSAssert1(error == errSecSuccess, @"SecItemUpdate failed: %d", error); } else if (error == errSecItemNotFound) { // do add [query setObject:[inputString dataUsingEncoding:NSUTF8StringEncoding] forKey:(id)kSecValueData]; error = SecItemAdd((CFDictionaryRef)query, NULL); NSAssert1(error == errSecSuccess, @"SecItemAdd failed: %d", error); } else { NSAssert1(NO, @"SecItemCopyMatching failed: %d", error); } }

    Read the article

  • Rest API Web Service - iOS

    - by zeekerg
    Its my first time to use web service in iOS. REST was my first choice and I use code igniter to form it. I have my Controller: require APPPATH.'/libraries/REST_Controller.php'; class Sample extends REST_Controller { function example_get() { $this->load->helper('arh'); $this->load->model('users'); $users_array = array(); $users = $this->users->get_all_users(); foreach($users as $user){ $new_array = array( 'id'=>$user->id , 'name'=>$user->name, 'age'=>$user->age, ); array_push( $users_array, $new_array); } $data['users'] = $users_array; if($data) { $this->response($data, 200); } } function user_put() { $this->load->model('users'); $this->users->insertAUser(); $message = array('message' => 'ADDED!'); $this->response($message, 200); } } , using my web browser, accessing the URL http://localhost:8888/restApi/index.php/sample/example/format/json really works fine and gives this output: {"users":[{"id":"1","name":"Porcopio","age":"99"},{"id":"2","name":"Name1","age":"24"},{"id":"3","name":"Porcopio","age":"99"},{"id":"4","name":"Porcopio","age":"99"},{"id":"5","name":"Luna","age":"99"}]} , this gives me a great output using RKRequest by RestKit in my app. The problem goes with the put method. This URL : http://localhost:8888/restApi/index.php/sample/user always give me an error like this: This XML file does not appear to have any style information associated with it. The document tree is shown below. <xml> <status/> <error>Unknown method.</error> This is my Users model <?php class Users extends CI_Model { function __construct() { parent::__construct(); } function get_all_users() { $this->load->database(); $query = $this->db->get('users'); return $query->result(); } function insertAUser(){ $this->load->database(); $data = array('name'=> "Sample Name", 'age'=>"99"); $this->db->insert('users', $data); } } ?> What is the work around for my _put method why am I not inserting anything? Thanks all!

    Read the article

  • Phonegap (Cordova) iOS button click

    - by JNM
    I am trying to create a very simple phone gap application for iOS. I am using query mobile. the problem is, that i can't get javascript event to fire on button click. Code i have now: <!DOCTYPE html> <html> <head> <title>Title</title> <meta name="viewport" content="width=device-width, minimum-scale=1, maximum-scale=1"> <meta charset="utf-8"> <link rel="stylesheet" type="text/css" href="js/jquery.mobile-1.2.0.css" /> <script type="text/javascript" charset="utf-8" src="cordova-1.8.1.js"></script> <script type="text/javascript" charset="utf-8" src="js/jquery-1.8.2.min.js"></script> <script type="text/javascript" charset="utf-8" src="js/jquery.mobile-1.2.0.min.js"></script> <script type="text/javascript"> document.addEventListener("deviceready", onDeviceReady, false); function onDeviceReady() { } function showAlert() { navigator.notification.alert("Cordova is working"); } </script> </head> <body> <div data-role="page" id="options" data-add-back-btn="true" data-back-btn-text="Atgal"> <div data-role="header" data-position="fixed"> <h1>Title</h1> </div> <div data-role="content"> <h1>Alert</h1> <p><a href="#" onclick="showAlert(); return false;" data-role="button">Show alert</a></p> </div> </div> </body> </html> I tried multiple solutions to fix my problem, but none of them works. When have button with # in href, it doesn't event change the color on click. When i add url, it changes color. But it never call javascript function. Another problem is, that document.addEventListener("deviceready", onDeviceReady, false); works only in the index page. If i press button in initial page which redirects to another page, OnDeviceReady function is never called. Anybody has any ideas?

    Read the article

  • GET request, iOS

    - by phnmnn
    I need to do this GET request: http://api.testmy.co.il/api/sync?BID=1049&ClientCode=3847&Discount=2.34&Service=0&Items=[{"Name":"Tax","Price":"2.11","Quantity":"1","SerialID":"1","Remarks":"","Toppings":""}]&Payments=[] In browser I get response: { "Success":true, "Atava":[], "Pending":[], "CallWaiter":false } But in iOS it not work. i try: NSString *requestedURL=[NSString stringWithFormat:@"http://api.testmy.co.il/api/sync?BID=%i&ClientCode=%i&Discount=2.34&Service=0&Items=[{\"Name\":\"Tax\",\"Price\":\"2.11\",\"Quantity\":\"1\",\"SerialID\":\"1\",\"Remarks\":\"\",\"Toppings\":\"\"}]&Payments=[]",BID,num]; NSURL *url = [NSURL URLWithString:requestedURL]; NSURLResponse *response; NSData *GETReply = [NSURLConnection sendSynchronousRequest:request returningResponse:&response error:nil]; NSString *theReply = [[NSString alloc] initWithBytes:[GETReply bytes] length:[GETReply length] encoding: NSASCIIStringEncoding]; NSLog(@"Reply: %@", theReply); OR NSString *requestedURL=[NSString stringWithFormat:@"http://api.testmy.co.il/api/sync?BID=%i&ClientCode=%i&Discount=2.34&Service=0&Items=[{'Name':'Tax','Price':'2.11','Quantity':'1','SerialID':'1','Remarks':'','Toppings':''}]&Payments=[]",BID,num]; OR NSMutableDictionary *params = [[NSMutableDictionary alloc] init]; [params setObject:@"Tax" forKey:@"Name"]; [params setObject:@"2.11" forKey:@"Price"]; [params setObject:@"1" forKey:@"Quantity"]; [params setObject:@"1" forKey:@"SerialID"]; [params setObject:@"" forKey:@"Remarks"]; [params setObject:@"" forKey:@"Toppings"]; NSData *jsonData = nil; NSString *jsonString = nil; if([NSJSONSerialization isValidJSONObject:params]) { jsonData = [NSJSONSerialization dataWithJSONObject:params options:0 error:nil]; jsonString = [[NSString alloc]initWithData:jsonData encoding:NSUTF8StringEncoding]; NSLog(@"%@",jsonString); } NSString *get=[NSString stringWithFormat: @"&Items=%@", jsonString]; NSData *getData = [get dataUsingEncoding:NSASCIIStringEncoding allowLossyConversion:YES]; NSMutableURLRequest *request = [[NSMutableURLRequest alloc] initWithURL:url]; [request setHTTPMethod:@"GET"]; [request setTimeoutInterval:8]; [request setHTTPBody:getData]; [request setValue:@"application/json;charset=UTF-8" forHTTPHeaderField:@"Content-Type"]; nothing doesn't work. How to fix it? Sorry for bad english.

    Read the article

  • iOS dynamic object creation

    - by Abdul Ahmad
    I've worked with Xcode and iOS on a few personal projects and have always used non-object-oriented designs for everything... just because I've been doing mostly learning/experimenting with things. Now I've been trying to implement some object oriented design into one game I've made previously. The idea is, I have a space ship that can shoot bullets. In the past I basically added the UIImageView to the storyboard and then connected it to the .h file and from there did things on it like move it around or whatever (using CGPointMake). The idea now is to make a method (and a whole other class soon) that will create a UIImageView programmatically, allocate it, add it to the superview etc... I've got this working so far, easy stuff, but the next part is a bit harder. Where do I store this local variable "bullet"? I've been saving it to an NSMutableArray and doing the following: (actually here are the methods that I have) -(void)movement { for (int i = 0; i < [array1 count]; i ++) { UIImageView *a = [array1 objectAtIndex:i]; a.center = CGPointMake(a.center.x + 2, a.center.y); if (a.center.x > 500) { [array1 removeObjectAtIndex:i]; [a removeFromSuperview]; } } } -(void)getBullet { UIImageView *bullet = [[UIImageView alloc] initWithFrame:CGRectMake(ship.center.x + 20, ship.center.y - 2, 15, 3)]; bullet.image = [UIImage imageNamed:@"bullet2.png"]; bullet.hidden = NO; [self.view addSubview:bullet]; [array1 addObject:bullet]; } (by the way, array1 is declared in the .h file) and theres a timer that controls the movement method timer = [NSTimer scheduledTimerWithTimeInterval:0.5 target:self selector:@selector(movement) userInfo:nil repeats:YES]; first question is: what is the correct way of doing this? Storing a bullet for example until it is removed from the superview, should I store it another way? and another question is, when I remove a UIImageView from the superview, does that remove it from memory so its not using up system resources? Thank you for the help! (will update if I Think of other questions

    Read the article

  • What characters are illegal in Cisco IOS username secret passwords?

    - by Alain O'Dea
    I am using username secret to add users with encrypted passwords to our switches and firewall. I have been battling with the same switches and firewall for a couple of hours trying to get securely generated hard passwords for all admins. Sometimes, the passwords would go into config, but wouldn't work for login. According to the documentation for enable secret a password must not begin with a number and ? has to be entered as Ctrl-V then ? to escape it. I followed that and still got passwords I could not use sometimes. There was no error when I ran username, but the password would be rejected on login by some, but not all of the switches. They are all WS-C2960-48PST-L. The passwords it didn't like contained back ticks "`" (that character under tilde ~ under Esc). The "misbehaving" switches are running: Cisco IOS Software, C2960 Software (C2960-LANBASEK9-M), Version 12.2(50)SE5, RELEASE SOFTWARE (fc1) The "working" switches are running: Cisco IOS Software, C2960 Software (C2960-LANBASEK9-M), Version 12.2(46)SE, RELEASE SOFTWARE (fc2). The "misbehaving" switches are running a newer IOS, so this suggests a regression introduced somewhere between 12.2(46)SE and 12.2(50)SE5. I was unable to find any evidence of this being intentional in the release notes for 12.2(50)SE. I would like to avoid this next time the passwords are changed :) What characters are illegal in Cisco IOS username secret passwords? Thank you for your help :)

    Read the article

  • Cordova - Scrolling with a fixed header and footer (ios)

    - by Samu Singh
    Using Cordova (phonegap) & bootstrap to make a mobile application, testing on IOS for now. Getting an issue with a header and footer bar that are fixed with scrollable content in the middle. When tapping to scroll, the header/footer bar moves down or up with the content but then snaps back to place as soon as the scrolling completes. If I use -webkit-overflow-scrolling: touch; it works as expected, but it makes it really awkward to scroll through the content, and if you scroll passed the end, it only scrolls the header or footer (with elastic overflow) until you stop for a second. here's my html for the header/footer bars: <div id="headerBar"> <div class="container-fluid" style="background-color: #1569C7"> <div class="row"> <div class="col-xs-3 text-left"> <button id="logoutButton" type="button" class="btn btn-default"> Log Out </button> <button type="button" class="btn btn-default" id="restoreQuestionFeedButton"> <span class="glyphicon glyphicon-chevron-left"></span> </button> </div> <div class="col-xs-6 text-center" style="height: 55px"> <strong id="usernameText"></strong> </div> <div class="col-xs-3 text-right"> <button id="oldCreatQuestionButton" type="button" class="btn btn-default"> <span class="glyphicon glyphicon-plus"></span> </button> </div> </div> </div> </div> <div id="footerBar"> <div class="container-fluid" style="padding: 0"> <div class="row text-center"> <button id="createQuestionButton" type="button" class="btn btn-default footerButton"> <span class="glyphicon glyphicon-plus"></span> <strong>Ask a new free question!</strong> </button> </div> </div> </div> And here is the related CSS: #headerBar { position: fixed; z-index: 100; top: 0; left: 0; width: 100%; background-color: #1569C7; } #footerBar { position: fixed; z-index: 100; bottom: 0; left: 0; width: 100%; background-color: #1569C7 !important; }

    Read the article

  • Is perfectionism a newbie's friend or enemy? [closed]

    - by Akromyk
    Possible Duplicate: Where do you draw the line for your perfectionism? I see that the development community is very focused on doing things the right way and personally I would like to do the same too, however, is it a good or bad idea for a newbie to focus on design principles, design patterns, and commenting code when getting started, or is it better to let creativity run wild and potentially write sloppy code. Where should a newbie draw the line?

    Read the article

  • -(void)... does not work/appeal (iOS)

    - by user1012535
    Hi I've got a problem with my -(void) in my Xcode project for iOS. First of all here is the code ViewController.h #import <UIKit/UIKit.h> @interface ViewController : UIViewController { IBOutlet UIWebView *webview; IBOutlet UIActivityIndicatorView *active; UIAlertView *alert_start; UIAlertView *alert_error; } -(IBAction)tele_button:(id)sender; -(IBAction)mail_button:(id)sender; -(IBAction)web_button:(id)sender; -(IBAction)news_button:(id)sender; @end ViewController.m #import "ViewController.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]; //Stop Bounce for WebView for (id subview in webview.subviews) if ([[subview class] isSubclassOfClass: [UIScrollView class]]) ((UIScrollView *)subview).bounces = NO; //First Start Alert [alert_start show]; NSLog(@"first alert"); NSString *start_alert = [[NSUserDefaults standardUserDefaults] objectForKey:@"alert_start"]; if(start_alert == nil) { [[NSUserDefaults standardUserDefaults] setValue:@"1" forKey:@"alert_start"]; [[NSUserDefaults standardUserDefaults] synchronize]; UIAlertView *alert_start = [[UIAlertView alloc] initWithTitle:@"iOptibelt" message:@"On some points this application need a internet connection." delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil]; [alert_start show]; [alert_start release]; } // Do any additional setup after loading the view, typically from a nib. [webview loadRequest:[NSURLRequest requestWithURL:[NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"home-de" ofType:@"html"]isDirectory:NO]]]; NSLog(@"webview fertig"); } -(void)webViewDidStartLoad:(UIWebView *) webview { [UIApplication sharedApplication].networkActivityIndicatorVisible = YES; [active startAnimating]; NSLog(@"lade"); } -(void)webViewDidFinishLoad:(UIWebView *) webview { [UIApplication sharedApplication].networkActivityIndicatorVisible = NO; [active stopAnimating]; NSLog(@"fertig"); } -(void)webView: (UIWebView *) webview didFailLoadWithError:(NSError *)error{ NSLog(@"lade error"); UIAlertView *alert_error = [[UIAlertView alloc] initWithTitle:@"Error" message:@"Can't connect. Please check your internet Connection" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil]; [alert_error show]; [alert_error release]; }; - (IBAction)tele_button:(id)sender{ NSLog(@"it's connected!"); //Local HTML Call Button NSURLRequest *theRequest = [NSURLRequest requestWithURL:[NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"phone" ofType:@"html"]isDirectory:NO]]; [webview loadRequest:theRequest]; } - (IBAction)mail_button:(id)sender{ NSLog(@"it's connected!"); //Mail App Mail Button [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"mailto://[email protected]"]]; } - (IBAction)web_button:(id)sender{ NSLog(@"it's connected!"); //Local HTML Button NSURLRequest *theRequest = [NSURLRequest requestWithURL:[NSURL URLWithString: @"http://optibelt.com"]]; [webview loadRequest:theRequest]; } - (IBAction)news_button:(id)sender{ NSLog(@"it's connected!"); //local Home Button NSURLRequest *theRequest = [NSURLRequest requestWithURL:[NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"home-de" ofType:@"html"]isDirectory:NO]]; [webview loadRequest:theRequest]; } - (void)viewDidUnload { [super viewDidUnload]; // Release any retained subviews of the main view. // e.g. self.myOutlet = nil; } - (void)viewWillAppear:(BOOL)animated { [super viewWillAppear:animated]; } - (void)viewDidAppear:(BOOL)animated { [super viewDidAppear:animated]; } - (void)viewWillDisappear:(BOOL)animated { [super viewWillDisappear:animated]; } - (void)viewDidDisappear:(BOOL)animated { [super viewDidDisappear:animated]; } - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { // Return YES for supported orientations return (interfaceOrientation != UIInterfaceOrientationPortraitUpsideDown); } @end At last my 3. -(void) does not work and i ve no more idea what could be the problem.... -(void)webViewDidStartLoad:(UIWebView *) webview { [UIApplication sharedApplication].networkActivityIndicatorVisible = YES; [active startAnimating]; NSLog(@"lade"); } -(void)webViewDidFinishLoad:(UIWebView *) webview { [UIApplication sharedApplication].networkActivityIndicatorVisible = NO; [active stopAnimating]; NSLog(@"fertig"); } -(void)webView: (UIWebView *) webview didFailLoadWithError:(NSError *)error{ NSLog(@"lade error"); UIAlertView *alert_error = [[UIAlertView alloc] initWithTitle:@"Error" message:@"Can't connect. Please check your internet Connection" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil]; [alert_error show]; [alert_error release];

    Read the article

  • iOS6 Simulator MKMapKit "Couldn't find default.styleproto in framework"

    - by abellina
    Running my app with the iOS6 simulator I am getting the following printed in the XCode console prior to viewDidLoad getting called: Couldn't find default.styleproto in framework Has anyone else encountered this, and if so have you found a reason why? My guess is that it has to do with the iOS6 Apple Maps, but who knows! EDIT I should add that I don't get this warning in the iOS 5.1 simulator.

    Read the article

  • Application tried to present modally an active controller ios

    - by Matthew
    I was trying to set the ViewController with a parent view controller before it shows show that it can provide call backs, I done this using PrepareForSegue - (void) prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { if ([segue.identifier isEqualToString:@"newQuarter"]) { [segue.destinationViewController setParentViewController:self]; } } It crashed giving me the error message: Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Application tried to present modally an active controller. So I tried using another method and set up a new view controller on the button touches up, - (IBAction) buttonClicked { NewViewController *newController = [[NewViewController alloc] init]; [newController setParentViewController:self]; [self presentViewController:newController animated:YES completion:nil]; } but with no luck it is still giving me the same error message, can anyone please advice? Thanks!

    Read the article

  • White view when launch iOS app in simulator

    - by user820511
    I have been working for 4 months on an app, its pretty complex and works fine. Now suddenly, I added a new class and did some changes to the MainWindow.xib with all my views there and now I just get a plain white view when I launch it with simulator. I even stripped it down completely to nothing but the appdelegate and one simple plain view with a button. So basically I've got an app with nothing but an appDelegate managing a tabBar, launching with one simple view, no frameworks no nothing and I still get a white app. There must be an option somewhere that I must have activated for the running of app in simulator but I can't figure it out. Thank you

    Read the article

  • IOS - Performance Issues with SVProgressHUD

    - by ScottOBot
    I have a section of code that is producing pour performance and not working as expected. it utilizes the SVProgressHUD from the following github repository at https://github.com/samvermette/SVProgressHUD. I have an area of code where I need to use [NSURLConnection sendSynchronousRequest:request returningResponse:&response error:&error]. I want to have a progress hud displayed before the synchronous request and then dismissed after the request has finished. Here is the code in question: //Display the progress HUB [SVProgressHUD showWithStatus:@"Signing Up..." maskType:SVProgressHUDMaskTypeClear]; NSError* error; NSURLResponse *response = nil; [self setUserCredentials]; // create json object for a users session NSDictionary* session = [NSDictionary dictionaryWithObjectsAndKeys: firstName, @"first_name", lastName, @"last_name", email, @"email", password, @"password", nil]; NSData *jsonSession = [NSJSONSerialization dataWithJSONObject:session options:NSJSONWritingPrettyPrinted error:&error]; NSString *url = [NSString stringWithFormat:@"%@api/v1/users.json", CoffeeURL]; NSURL *URL = [NSURL URLWithString:url]; NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:URL cachePolicy:NSURLRequestUseProtocolCachePolicy timeoutInterval:30.0]; [request setHTTPMethod:@"POST"]; [request setValue:@"application/json" forHTTPHeaderField:@"Accept"]; [request setValue:@"application/json" forHTTPHeaderField:@"Content-Type"]; [request setValue:[NSString stringWithFormat:@"%d", [jsonSession length]] forHTTPHeaderField:@"Content-Length"]; [request setHTTPBody:jsonSession]; NSData *data = [NSURLConnection sendSynchronousRequest:request returningResponse:&response error:&error]; NSString *dataString = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding]; NSDictionary *JSONResponse = [NSJSONSerialization JSONObjectWithData:[dataString dataUsingEncoding:NSUTF8StringEncoding] options:NSJSONReadingMutableContainers error:&error]; NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *)response; NSInteger statusCode = httpResponse.statusCode; NSLog(@"Status: %d", statusCode); if (JSONResponse != nil && statusCode == 200) { //Dismiss progress HUB here [SVProgressHUD dismiss]; return YES; } else { [SVProgressHUD dismiss]; return NO; } For some reason the synchronous request blocks the HUB from being displayed. It displays immediately after the synchronous request happens, unfortunatly this is also when it is dismissed. The behaviour displayed to the user is that the app hangs, waits for the synchronous request to finish, quickly flashes the HUB and then becomes responsive again. How can I fix this issue? I want the SVProgressHUB to be displayed during this hang time, how can I do this?

    Read the article

  • Pin animatesDrop mapView-iOS

    - by user1724168
    I have implemented code as seen below. I would like to add animation with dropping effect. However, once I type pinView.animatesDrop does not recognize! I could not able to figure out what I am doing wrong? - (MKAnnotationView *)mapView:(MKMapView *)mV viewForAnnotation:(id <MKAnnotation>)annotation { MKAnnotationView *pinView=nil; if(![annotation isKindOfClass:[Annotation class]]) // Don't mess user location return nil; static NSString *defaultPinID = @"StandardIdentifier"; pinView = (MKAnnotationView *)[self.mapView dequeueReusableAnnotationViewWithIdentifier:defaultPinID]; if (pinView == nil){ pinView = [[MKAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:defaultPinID]; } // Build our annotation if ([annotation isKindOfClass:[Annotation class]]) { Annotation *a = (Annotation *)annotation; pinView.image = [ZSPinAnnotation pinAnnotationWithColor:a.color];// ZSPinAnnotation Being Used pinView.annotation = a; pinView.enabled = YES; pinView.centerOffset=CGPointMake(6.5,-16); pinView.calloutOffset = CGPointMake(-11,0); //pinView.animatesDrop = YES; } pinView.canShowCallout = YES; UIButton *rightButton = [UIButton buttonWithType:UIButtonTypeDetailDisclosure]; [rightButton setTitle:annotation.title forState:UIControlStateNormal]; [pinView setRightCalloutAccessoryView:rightButton]; pinView.leftCalloutAccessoryView = [[UIView alloc] init]; pinView.leftCalloutAccessoryView=nil; /*UIButton *leftButton = [UIButton buttonWithType:UIButtonTypeInfoLight]; [leftButton setTitle:annotation.title forState:UIControlStateNormal]; [pinView setLeftCalloutAccessoryView:leftButton];*/ return pinView; }

    Read the article

  • PJSIP Custom Registration Header (iOS)

    - by Daniel Redington
    I am attempting to setup SIP communication with an internal server (using the PJSIP library), however, this server requires a custom header field with a specified header value for the REGISTRATION call. For example's sake we'll call this required header "MyHeader". From what I've found, the pjsua_acc_add() function will add an account and register it to the server using a config struct. The parameter "reg_hdr_list" of the config struct has the description "The optional custom SIP headers to be put in the registration request." Which sounds like exactly what I need, however doesn't seem to have any effect on the call itself. Here's what I have so far: pjsua_acc_config cfg; pjsua_acc_config_default(&cfg); //...Some other config stuff related to the server... pjsip_hdr test; test.name = pj_str("MyHeader"); test.sname = pj_str("MyHdr"); test.type = PJSIP_H_OTHER; test.prev = cfg.reg_hdr_list.prev; test.next = cfg.reg_hdr_list.next; cfg.reg_hdr_list = test; pj_status_t status; status = pjsua_acc_add(&cfg, PJ_TRUE, &acc_id); From the server side, there are no extra header fields or anything. And the struct that is used to define the header (pjsua_hdr) has no "value" or equivalent field, so even if it did create the header, how does it set the value? Here's the refrence for the header list definition: Link And the reference for the header struct: Link Any help would be greatly appreciated!

    Read the article

  • plot negative and positive values in same Y-axis in coreplot ios

    - by user3774439
    I have an issue in converting axis labels to int or float values. This is my Y-Axis. It contains temperature values contains -50, 33, 117, 200. CPTXYAxis *y = axisSet.yAxis; y.labelingPolicy = CPTAxisLabelingPolicyNone; y.orthogonalCoordinateDecimal = CPTDecimalFromUnsignedInteger(1); y.majorGridLineStyle = majorGridLineStyle; y.minorGridLineStyle = minorGridLineStyle; y.minorTicksPerInterval = 0.0; y.labelOffset = 0.0; y.title = @""; y.titleOffset = 0.0; NSMutableSet *yLabels = [NSMutableSet setWithCapacity:4]; NSMutableSet *yLocations = [NSMutableSet setWithCapacity:4]; NSArray *yAxisLabels = [NSArray arrayWithObjects:@"-50", @"33", @"117", @"200", nil]; NSNumberFormatter * nFormatter = [[NSNumberFormatter alloc] init]; [nFormatter setNumberStyle:NSNumberFormatterDecimalStyle]; for ( NSUInteger i = 0; i < [yAxisLabels count]; i++ ) { NSLog(@"%@",[yAxisLabels objectAtIndex:i]); CPTAxisLabel *label = [[CPTAxisLabel alloc] initWithText:[NSString stringWithFormat:@"%@",[yAxisLabels objectAtIndex:i]] textStyle:axisTextStyle]; label.tickLocation = CPTDecimalFromUnsignedInteger(i); label.offset = y.majorTickLength; if (label) { [yLabels addObject:label]; [yLocations addObject:[NSDecimalNumber numberWithUnsignedInteger:i]]; } label = nil; } y.axisLabels = yLabels; y.majorTickLocations = yLocations; y.labelFormatter = nFormatter; Now, my issue is.. I am getting data from the BLE device as temperature values as strings like 50, 60.3, etc... Now I want plot these values from BLE device with the Y-axis values. i am unable convert these Y-axis labels to temperature values. Could you please help me guys...I have tried many time still no luck. Please help me UPDATE:: This is the way I am creating scatterplot: -(void)createScatterPlotsWithIdentifier:(NSString *)identifier color:(CPTColor *)color forGraph:(CPTGraph *)graph forXYPlotSpace:(CPTXYPlotSpace *)plotSpace{ CPTScatterPlot *scatterPlot = [[CPTScatterPlot alloc] init]; scatterPlot.dataSource = self; scatterPlot.identifier = identifier; //Plot a graph with in the plotspace [plotSpace scaleToFitPlots:[NSArray arrayWithObjects:scatterPlot, nil]]; plotSpace.xRange = [CPTPlotRange plotRangeWithLocation:CPTDecimalFromUnsignedInteger(0) length:CPTDecimalFromUnsignedInteger(30)]; plotSpace.yRange = [CPTPlotRange plotRangeWithLocation:CPTDecimalFromUnsignedInteger(-50) length:CPTDecimalFromUnsignedInteger(250)]; CPTMutablePlotRange *xRange = [[self getCoreplotSpace].xRange mutableCopy]; [xRange expandRangeByFactor:CPTDecimalFromCGFloat(-1)]; [self getCoreplotSpace].xRange = xRange; CPTMutableLineStyle *scatterLineStyle = [scatterPlot.dataLineStyle mutableCopy]; scatterLineStyle.lineWidth = 1; scatterLineStyle.lineColor = color; scatterPlot.dataLineStyle = scatterLineStyle; CPTMutableLineStyle *scatterSymbolLineStyle = [CPTMutableLineStyle lineStyle]; scatterSymbolLineStyle.lineColor = color; CPTPlotSymbol *scatterSymbol = [CPTPlotSymbol ellipsePlotSymbol]; scatterSymbol.fill = [CPTFill fillWithColor:color]; scatterSymbol.lineStyle = scatterSymbolLineStyle; scatterSymbol.size = CGSizeMake(2.0f, 2.0f); scatterPlot.plotSymbol = scatterSymbol; [graph addPlot:scatterPlot toPlotSpace:plotSpace]; } Configuring the Y-axis like this: NSMutableSet *yLabels = [NSMutableSet setWithCapacity:4]; NSMutableSet *yLocations = [NSMutableSet setWithCapacity:4]; NSArray *yAxisLabels = [NSArray arrayWithObjects:@"-50", @"33", @"117", @"200", nil]; NSArray *customTickLocations = [NSArray arrayWithObjects:[NSDecimalNumber numberWithUnsignedInt:-50], [NSDecimalNumber numberWithInt:33], [NSDecimalNumber numberWithInt:117], [NSDecimalNumber numberWithInt:200],nil]; for ( NSUInteger i = 0; i < [yAxisLabels count]; i++ ) { NSLog(@"%@",[yAxisLabels objectAtIndex:i]); CPTAxisLabel *label = [[CPTAxisLabel alloc] initWithText:[NSString stringWithFormat:@"%@",[yAxisLabels objectAtIndex:i]] textStyle:axisTextStyle]; label.tickLocation = CPTDecimalFromInteger([[customTickLocations objectAtIndex:i] integerValue]); label.offset = y.majorTickLength; if (label) { [yLabels addObject:label]; [yLocations addObject:[NSString stringWithFormat:@"%d",[[customTickLocations objectAtIndex:i] integerValue]]]; } label = nil; } y.axisLabels = yLabels; y.majorTickLocations = [NSSet setWithArray:customTickLocations]; Eric, I set the range as you said in CreateSctterPlot method. But In horizontal line on graph are not coming. Could you please help me what I am wrong. Thanks

    Read the article

  • [IOS SDK] retrieving scores from game center

    - by Sam
    I got this code from apple's developer site. How do i process the score information to be viewed in a like a UITableView or something? (void) retrieveTopTenScores { GKLeaderboard *leaderboardRequest = [[GKLeaderboard alloc] init]; if (leaderboardRequest != nil) { leaderboardRequest.playerScope = GKLeaderboardPlayerScopeGlobal; leaderboardRequest.timeScope = GKLeaderboardTimeScopeAllTime; leaderboardRequest.range = NSMakeRange(1,10); [leaderboardRequest loadScoresWithCompletionHandler: ^(NSArray *scores, NSError *error) { if (error != nil) { // handle the error. } if (scores != nil) { // process the score information. } }]; } }

    Read the article

  • iOS: FilterUsingPredicate on custom objects

    - by AppleDeveloper
    I have a custom class extending NSObject. I am maintaining NSMutableArray of this class objects. Here is the situation, customObject { NSString *name; int ID; .....and many other properties; } customObjectsArray { customObject1, customObject2, ...etc } Now I am trying to use filterUsingPredicate to remove objects that has nil names, like below but it returns very few or none objects while I know that there are hundreds of objects that has name not nil or empty. Could someone please tell me what could be wrong here. [customObjectsArray filterUsingPredicate:[NSPredicate predicateWithFormat:@"name != nil]];

    Read the article

  • Intersection of Inner Polygons of MKPolygon being colored - iOS

    - by Josh Glick
    I am trying to create a fog of war style map where areas I have visited are uncovered and the rest of the map is "hidden". I am using a MKPolygonOverlay that covers the whole map and create inner polygons around all the locations I have visited. However in areas where these inner polygons overlap, that portion of the overlay is still being drawn. As a new user I can't post pictures but here is a link to the image: http://dl.dropbox.com/u/13815916/Screen%20Shot%202012-06-29%20at%204.40.20%20AM.png

    Read the article

  • Handling credit cards and IOS

    - by Susan Jackie
    I am using NSUrlConnection asyncronous request to transmit credit card information to a secure third party server. I do the following: I get the credit card number, cvv, etc from the uitextfields. Encode the credit card information into a json format. Set as httpd body of the nsurlconnection request as follows: NSURL * url = [[NSURL URLWithString: "https://www.example.com"]; NSMutableURLRequest * request = [[NSMutableURLRequest alloc] initWithURL: url]; [request setHTTPMethod: @"POST"]; [request setValue:@"application/json" forHTTPHeaderField:@"Accept"]; [request setValue:@"application/json" forHTTPHeaderField:@"Content-Type"]; [request setHTTPBody: [NSJSONSerialization dataWithJSONObject: params options: kNilOptions error: &parseError]]; Send this information via asynchronous request to a secure third party server: [NSURLConnection sendAsynchronousRequest:request queue: queue completionHandler:^(NSURLResponse *response, NSData *data, NSError * requestError) { What should I be considering to send user credit card information to a third party server using nsurlconnection asynchronous request?

    Read the article

  • Crash on iOS when system purges memory and closes a UIViewController

    - by Amiramix
    My application is crashing when one of the views is purged from memory because of low-memory condition. At least this is what I understand from the crashlog. It happens on numerous screens but only when opening a Facebook dialog (using the Facebook SDK). Basically, looks like the system sometimes runs out of memory when we need to present a Facebook dialog (e.g. to let user post something on the Facebook timeline). Date/Time: 2012-03-14 19:47:33.819 +0000 OS Version: iPhone OS 5.1 (9B176) Report Version: 104 Exception Type: EXC_BAD_ACCESS (SIGSEGV) Exception Codes: KERN_INVALID_ADDRESS at 0x30000008 Crashed Thread: 0 Thread 0 name: Dispatch queue: com.apple.main-thread Thread 0 Crashed: 0 libobjc.A.dylib 0x30f2bf78 objc_msgSend + 16 1 MyApp 0x00003c0e -LTBaseViewController viewDidUnload (LTBaseViewController.m:145) 2 MyApp 0x00004ea2 -LTBaseTableViewController viewDidUnload (LTBaseTableViewController.m:90) 3 UIKit 0x33766bd8 -[UIViewController unloadViewForced:] + 244 4 UIKit 0x338ae492 -[UIViewController purgeMemoryForReason:] + 58 5 Foundation 0x3071a4f8 __57-NSNotificationCenter addObserver:selector:name:object:_block_invoke_0 + 12 6 CoreFoundation 0x30e95540 ___CFXNotificationPost_block_invoke_0 + 64 7 CoreFoundation 0x30e21090 _CFXNotificationPost + 1400 8 Foundation 0x3068e3e4 -NSNotificationCenter postNotificationName:object:userInfo: + 60 9 Foundation 0x3068fc14 -NSNotificationCenter postNotificationName:object: + 24 10 UIKit 0x3387926a -UIApplication _performMemoryWarning + 74 11 UIKit 0x33879364 -UIApplication _receivedMemoryNotification + 168 12 libdispatch.dylib 0x36a12252 _dispatch_source_invoke + 510 13 libdispatch.dylib 0x36a0fb1e _dispatch_queue_invoke$VARIANT$up + 42 14 libdispatch.dylib 0x36a0fe64 _dispatch_main_queue_callback_4CF$VARIANT$up + 152 15 CoreFoundation 0x30e9c2a6 __CFRunLoopRun + 1262 16 CoreFoundation 0x30e1f49e CFRunLoopRunSpecific + 294 17 CoreFoundation 0x30e1f366 CFRunLoopRunInMode + 98 18 GraphicsServices 0x33fb6432 GSEventRunModal + 130 19 UIKit 0x336f5e76 UIApplicationMain + 1074 20 MyApp 0x00004818 main (main.m:16) 21 MyApp 0x000023b4 0x1000 + 5044 I checked and there are almost no memory leaks, e.g. when testing the app for an hour the total memory leaked was around 2-3Kb caused by some string-copying libraries. So I don't believe this is caused by the application. I guess that when the phone is not restarted for some time there are applications running in the background and when using Facebook SDK the memory becomes a problem and the system tries to recover the memory from random applications, including my application. My question is, how can I prevent this crash from happening? How should I handle unloadViewForced on a view controller to make the app more robust in low-memory conditions? And lastly, am I right that this crashlog suggests the crash occurred because the system tried to free memory and my application didn't handle it properly? Any help greatly appreciated.

    Read the article

  • Downloading PKPass in an iOS custom app from my server

    - by taurus
    I've setup a server which returns a PKPass. If I copy the URL to the browser, a pass is shown (both in my Mac and in my iPhone). The code I'm using to download the pass is the following one: NSData *data = [[NSData alloc] initWithContentsOfURL:[NSURL URLWithString:kAPIPass]]; if (nil != data) { PKPass *pass = [[PKPass alloc] initWithData:data error:nil]; PKAddPassesViewController *pkvc = [[PKAddPassesViewController alloc] initWithPass:pass]; pkvc.delegate = self; [self presentViewController:pkvc animated:YES completion:^{ // Do any cleanup here } ]; } Anyway, when I run this code I have the following error: * Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Only support RGBA or the White color space, this method is a hack.' I don't know what is the bug... The pass seems ok when I download it with Safari and even the code seems ok (there are just 3 simple rows...) Someone experienced with Passkit could help me? EDIT: the weird thing is that the exact same code is working in a fresh new project

    Read the article

  • CorePlot linker errors after upgrading iOS SDK

    - by JustinXXVII
    This seems like it's happened before but somehow ended up working itself out. It's happened again and I can't seem to get this fixed. I use the CorePlot Cocoa Touch framework. Everything was fine until I upgraded to the new 4.3 beta. Now my project won't compile, and is giving me linker errors for unknown symbols having to do with CorePlot. I've become a pro at adding the framework to my project, and I've checked and rechecked the instructions trying to do it again. Is there a button I can click or anything to just make this work again? I've used these instructions to try to re-add the framework, to no avail EDIT: By the way, this compiles just fine for simulator and runs graphs no problem. Compiling for the device gives me the linker errors, as follows: "_OBJC_CLASS_$_CPPlotRange", referenced from: objc-class-ref in GraphStatsWindow.o objc-class-ref in iPadGraphView.o objc-class-ref in GraphTrendView.o "_OBJC_CLASS_$_CPXYGraph", referenced from: objc-class-ref in GraphStatsWindow.o objc-class-ref in iPadGraphView.o objc-class-ref in GraphTrendView.o "_OBJC_CLASS_$_CPTextStyle", referenced from: objc-class-ref in GraphStatsWindow.o objc-class-ref in iPadGraphView.o objc-class-ref in GraphTrendView.o "_OBJC_CLASS_$_CPLineStyle", referenced from: objc-class-ref in GraphStatsWindow.o objc-class-ref in iPadGraphView.o objc-class-ref in GraphTrendView.o "_OBJC_CLASS_$_CPScatterPlot", referenced from: objc-class-ref in GraphStatsWindow.o objc-class-ref in iPadGraphView.o objc-class-ref in GraphTrendView.o "_OBJC_CLASS_$_CPAxisLabel", referenced from: objc-class-ref in GraphStatsWindow.o objc-class-ref in iPadGraphView.o objc-class-ref in GraphTrendView.o "_OBJC_CLASS_$_CPPlotSymbol", referenced from: objc-class-ref in GraphStatsWindow.o objc-class-ref in iPadGraphView.o objc-class-ref in GraphTrendView.o "_OBJC_CLASS_$_CPColor", referenced from: objc-class-ref in GraphStatsWindow.o objc-class-ref in iPadGraphView.o objc-class-ref in GraphTrendView.o "_OBJC_CLASS_$_CPFill", referenced from: objc-class-ref in GraphStatsWindow.o objc-class-ref in iPadGraphView.o objc-class-ref in GraphTrendView.o "_CPDecimalFromFloat", referenced from: -[GraphStatsWindow setNewGraph] in GraphStatsWindow.o -[iPadGraphView viewDidLoad] in iPadGraphView.o -[GraphTrendView setNewGraph] in GraphTrendView.o "_kCPPlainWhiteTheme", referenced from: -[GraphStatsWindow setNewGraph] in GraphStatsWindow.o -[iPadGraphView viewDidLoad] in iPadGraphView.o -[GraphTrendView setNewGraph] in GraphTrendView.o "_OBJC_CLASS_$_CPTheme", referenced from: objc-class-ref in GraphStatsWindow.o objc-class-ref in iPadGraphView.o objc-class-ref in GraphTrendView.o ld: symbol(s) not found for architecture armv7

    Read the article

  • Novocaine - How to loop file playback? (iOS)

    - by lppier
    I'm using Novocaine by alexbw Novocaine for my audio project. I'm playing around with the example code here for file reading. The file plays back with no problem. I would like to loop this recording with the gap between the loops - any suggestion as to how I can do so? Thanks. Pier. // AUDIO FILE READING OHHH YEAHHHH // ======================================== NSArray *pathComponents = [NSArray arrayWithObjects: [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) lastObject], @"testrecording.wav", nil]; NSURL *inputFileURL = [NSURL fileURLWithPathComponents:pathComponents]; NSLog(@"URL: %@", inputFileURL); fileReader = [[AudioFileReader alloc] initWithAudioFileURL:inputFileURL samplingRate:audioManager.samplingRate numChannels:audioManager.numOutputChannels]; [fileReader play]; [fileReader setCurrentTime:0.0]; //float duration = fileReader.getDuration; [audioManager setOutputBlock:^(float *data, UInt32 numFrames, UInt32 numChannels) { [fileReader retrieveFreshAudio:data numFrames:numFrames numChannels:numChannels]; NSLog(@"Time: %f", [fileReader getCurrentTime]); }];

    Read the article

< Previous Page | 8 9 10 11 12 13 14 15 16 17 18 19  | Next Page >