Search Results

Search found 560 results on 23 pages for 'nsdictionary'.

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

  • Can I change an NSDictionaries key?

    - by Mark Reid
    I have an NSDictionary object that is populated by NSMutableStrings for its keys and objects. I have been able to change the key by changing the original NSMutableString with the setString: method. They key however remains the same regardless of the contents of the string used to set the key initially. My question is, is the key protected from being changed meaning it will always be the same unless I remove it and add another to the dictionary? Thanks.

    Read the article

  • didFinishLaunchingWithOptions not called

    - by user1256477
    I'm having trouble enabling push notifications. with this code I try to enable the notification: - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { [[UIApplication sharedApplication] registerForRemoteNotificationTypes:(UIRemoteNotificationType)(UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeSound | UIRemoteNotificationTypeAlert)]; return YES; } It doesnt work, so I added a breakpoint in the line [[UIApplication sharedApplication] registerForRemoteNotificationTypes:(UIRemoteNotificationType)(UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeSound | UIRemoteNotificationTypeAlert)]; But it seems this part of the code is never execute. why is this not working?

    Read the article

  • Sane(r) way to get character-encoding of CLI?

    - by danyowdee
    Hi all! I was writing a CLI-Tool for Mac OS X (10.5+) that has to deal with command-line arguments which are very likely to contain non-ASCII characters. For further processing, I convert these arguments using +[NSString stringWithCString:encoding:]. My problem is, that I couldn't find good information on how to determine the character-encoding used by the shell in which said cli-tool is running in. What I came up with as a solution is the following: NSDictionary *environment = [[NSProcessInfo processInfo] environment]; NSString *ianaName = [[environment objectForKey:@"LANG"] pathExtension]; NSStringEncoding encoding = CFStringConvertEncodingToNSStringEncoding( CFStringConvertIANACharSetNameToEncoding( (CFStringRef)ianaName ) ); NSString *someArgument = [NSString stringWithCString:argv[someIndex] encoding:encoding]; I find that a little crude, however -- which makes me think that I missed out something obvious...but what? Is there a saner/cleaner way of achieving essentially the same? Thanks in advance D

    Read the article

  • UITableView crashes when trying to scroll

    - by Ondrej
    Hi, I have a problem with data in UITableView. I have UIViewController, that contains UITableView outlet and few more things I am using and ... It works :) ... it works lovely, but ... I've created an RSS reader class that is using delegates to deploy the data to the table ... and once again, If I'll just create dummy data in the main controller everything works! problem is with this line: rss.delegate = self; Preview looks a little bit broken than here are those RSS reader files on Google code: (Link to the header file on GoogleCode) (Link to the implementation file on Google code) viewDidLoad function of my controller: IGDataRss20 *rss = [[[IGDataRss20 alloc] init] autorelease]; rss.delegate = self; [rss initWithContentsOfUrl:@"http://rss.cnn.com/rss/cnn_topstories.rss"]; and my delegate methods: - (void)parsingEnded:(NSArray *)result { super.data = [[NSMutableArray alloc] initWithArray:result]; NSLog(@"My Items: %d", [super.data count]); [super.table reloadData]; NSLog(@"Parsing ended"); } (void)parsingError:(NSString *)message { NSLog(@"MyMessage: %@", message); } (void)parsingStarted:(NSXMLParser *)parser { NSLog(@"Parsing started"); } Just to clarify, NSLog(@"Parsing ended"); is being executed and I have 10 items in the array. Ok, here's my RSS reader header file: @class IGDataRss20; @protocol IGDataRss20Delegate @optional (void)parsingStarted:(NSXMLParser *)parser; (void)parsingError:(NSString *)message; (void)parsingEnded:(NSArray *)result; @end @interface IGDataRss20 : NSObject { NSXMLParser *rssParser; NSMutableArray *data; NSMutableDictionary *currentItem; NSString *currentElement; id <IGDataRss20Delegate> delegate; } @property (nonatomic, retain) NSMutableArray *data; @property (nonatomic, assign) id delegate; (void)initWithContentsOfUrl:(NSString *)rssUrl; (void)initWithContentsOfData:(NSData *)inputData; @end And this RSS reader implementation file: #import "IGDataRss20.h" @implementation IGDataRss20 @synthesize data, delegate; (void)initWithContentsOfUrl:(NSString *)rssUrl { self.data = [[NSMutableArray alloc] init]; NSURL *xmlURL = [NSURL URLWithString:rssUrl]; rssParser = [[NSXMLParser alloc] initWithContentsOfURL:xmlURL]; [rssParser setDelegate:self]; [rssParser setShouldProcessNamespaces:NO]; [rssParser setShouldReportNamespacePrefixes:NO]; [rssParser setShouldResolveExternalEntities:NO]; [rssParser parse]; } (void)initWithContentsOfData:(NSData *)inputData { self.data = [[NSMutableArray alloc] init]; rssParser = [[NSXMLParser alloc] initWithData:inputData]; [rssParser setDelegate:self]; [rssParser setShouldProcessNamespaces:NO]; [rssParser setShouldReportNamespacePrefixes:NO]; [rssParser setShouldResolveExternalEntities:NO]; [rssParser parse]; } (void)parserDidStartDocument:(NSXMLParser *)parser { [[self delegate] parsingStarted:parser]; } (void)parser:(NSXMLParser *)parser parseErrorOccurred:(NSError *)parseError { NSString * errorString = [NSString stringWithFormat:@"Unable to parse RSS feed (Error code %i )", [parseError code]]; NSLog(@"Error parsing XML: %@", errorString); if ([parseError code] == 31) NSLog(@"Error code 31 is usually caused by encoding problem."); [[self delegate] parsingError:errorString]; } (void)parser:(NSXMLParser *)parser didStartElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName attributes:(NSDictionary *)attributeDict { currentElement = [elementName copy]; if ([elementName isEqualToString:@"item"]) currentItem = [[NSMutableDictionary alloc] init]; } (void)parser:(NSXMLParser *)parser didEndElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName { if ([elementName isEqualToString:@"item"]) { [data addObject:(NSDictionary *)[currentItem copy]]; } } (void)parser:(NSXMLParser *)parser foundCharacters:(NSString *)string { if (![currentItem objectForKey:currentElement]) [currentItem setObject:[[[NSMutableString alloc] init] autorelease] forKey:currentElement]; [[currentItem objectForKey:currentElement] appendString:string]; } (void)parserDidEndDocument:(NSXMLParser *)parser { //NSLog(@"RSS array has %d items: %@", [data count], data); [[self delegate] parsingEnded:(NSArray *)self.data]; } (void)dealloc { [data, delegate release]; [super dealloc]; } @end Hope someone will be able to help me as I am becoming to be quite desperate, and I thought I am not already such a greenhorn :) Thanks, Ondrej

    Read the article

  • UIPageControl bug: showing one bullet first and then showing everything

    - by user313551
    I have some strange behavior using a UIPageControl: First it appears showing only one bullet, then when I move the scroll view all the bullets appear correctly. Is there something I'm missing before I add it as a subview? Here is my code imageScrollView.h : @interface ImageScrollView : UIView <UIScrollViewDelegate> { NSMutableDictionary *photos; BOOL *pageControlIsChangingPage; UIPageControl *pageControl; } @property (nonatomic, copy) NSMutableDictionary *photos; @property (nonatomic, copy) UIPageControl *pageControl; @end Here is the code for imageScrollView.m: #import "ImageScrollView.h" @implementation ImageScrollView @synthesize photos, pageControl; - (id)initWithFrame:(CGRect)frame { if ((self = [super initWithFrame:frame])) { // Initialization code NSLog(@"%@",pageControl); } return self; } - (void) drawRect:(CGRect)rect { [self removeAllSubviews]; UIScrollView *scroller = [[UIScrollView alloc] initWithFrame:CGRectMake(0,0,self.frame.size.width,self.frame.size.height)]; [scroller setDelegate:self]; [scroller setBackgroundColor:[UIColor grayColor]]; [scroller setShowsHorizontalScrollIndicator:NO]; [scroller setPagingEnabled:YES]; NSUInteger nimages = 0; CGFloat cx= 0; for (NSDictionary *myDictionaryObject in photos) { if (![myDictionaryObject isKindOfClass:[NSNull class]]) { NSString *photo =[NSString stringWithFormat:@"http://www.techbase.com.mx/blog/%@", [myDictionaryObject objectForKey:@"filepath"]]; NSDictionary *data = [myDictionaryObject objectForKey:@"data"]; UIView *imageContainer = [[UIView alloc] initWithFrame:CGRectMake(0, 0, self.frame.size.width, self.frame.size.height - 30)]; TTImageView *imageView = [[TTImageView alloc] initWithFrame:CGRectMake(0, 0, self.frame.size.width, self.frame.size.height - 30)]; imageView.urlPath=photo; [imageContainer addSubview:imageView]; UILabel *caption = [[UILabel alloc] initWithFrame:CGRectMake(0,imageView.frame.size.height,imageView.frame.size.width,10)]; [caption setText:[NSString stringWithFormat:@"%@",[data objectForKey:@"description"]]]; [caption setBackgroundColor:[UIColor grayColor]]; [caption setTextColor:[UIColor whiteColor]]; [caption setLineBreakMode:UILineBreakModeWordWrap]; [caption setNumberOfLines:0]; [caption sizeToFit]; [caption setFont:[UIFont fontWithName:@"Georgia" size:10.0]]; [imageContainer addSubview:caption]; CGRect rect = imageContainer.frame; rect.size.height = imageContainer.size.height; rect.size.width = imageContainer.size.width; rect.origin.x = ((scroller.frame.size.width - scroller.size.width) / 2) + cx; rect.origin.y = ((scroller.frame.size.height - scroller.size.height) / 2); imageContainer.frame=rect; [scroller addSubview:imageContainer]; [imageView release]; [imageContainer release]; [caption release]; nimages++; cx +=scroller.frame.size.width; } } [scroller setContentSize:CGSizeMake(nimages * self.frame.size.width, self.frame.size.height)]; [self addSubview:scroller]; pageControl = [[UIPageControl alloc] initWithFrame:CGRectMake(self.frame.size.width/2, self.frame.size.height -20, (self.frame.size.width/nimages)/2, 20)]; pageControl.numberOfPages=nimages; [self addSubview:pageControl]; [scroller release]; } -(void)dealloc { [pageControl release]; [super dealloc]; } -(void)scrollViewDidScroll:(UIScrollView *)_scrollView{ if(pageControlIsChangingPage){ return; } CGFloat pageWidth = _scrollView.frame.size.width; int page = floor((_scrollView.contentOffset.x - pageWidth /2) / pageWidth) + 1; pageControl.currentPage = page; } -(void)scrollViewDidEndDecelerating:(UIScrollView *)_scrollView{ pageControlIsChangingPage = NO; } @end

    Read the article

  • Is Fast Enumeration messing with my text output?

    - by Dan Ray
    Here I am iterating through an array of NSDictionary objects (inside the parsed JSON response of the EXCELLENT MapQuest directions API). I want to build up an HTML string to put into a UIWebView. My code says: for (NSDictionary *leg in legs ) { NSString *thisLeg = [NSString stringWithFormat:@"<br>%@ - %@", [leg valueForKey:@"narrative"], [leg valueForKey:@"distance"]]; NSLog(@"This leg's string is %@", thisLeg); [directionsOutput appendString:thisLeg]; } The content of directionsOutput (which is an NSMutableString) contains ALL the values for [leg valueForKey:@"narrative"], wrapped up in parens, followed by a hyphen, followed by all the parenthesized values for [leg valueForKey:@"distance"]. So I put in that NSLog call... and I get the same thing there! It appears that the for() is somehow batching up our output values as we iterate, and putting out the output only once. How do I make it not do this but instead do what I actually want, which is an iterative output as I iterate? Here's what NSLog gets. Yes, I know I need to figure out NSNumberFormatter. ;-) This leg's string is ( "Start out going NORTH on INFINITE LOOP.", "Turn LEFT to stay on INFINITE LOOP.", "Turn RIGHT onto N DE ANZA BLVD.", "Merge onto I-280 S toward SAN JOSE.", "Merge onto CA-87 S via EXIT 3A.", "Take the exit on the LEFT.", "Merge onto CA-85 S via EXIT 1A on the LEFT toward GILROY.", "Merge onto US-101 S via EXIT 1A on the LEFT toward LOS ANGELES.", "Take the CA-152 E/10TH ST exit, EXIT 356.", "Turn LEFT onto CA-152/E 10TH ST/PACHECO PASS HWY. Continue to follow CA-152/PACHECO PASS HWY.", "Turn SLIGHT RIGHT.", "Turn SLIGHT RIGHT onto PACHECO PASS HWY/CA-152 E. Continue to follow CA-152 E.", "Merge onto I-5 S toward LOS ANGELES.", "Take the CA-46 exit, EXIT 278, toward LOST HILLS/WASCO.", "Turn LEFT onto CA-46/PASO ROBLES HWY. Continue to follow CA-46.", "Merge onto CA-99 S toward BAKERSFIELD.", "Merge onto CA-58 E via EXIT 24 toward TEHACHAPI/MOJAVE.", "Merge onto I-15 N via the exit on the LEFT toward I-40/LAS VEGAS.", "Keep RIGHT to take I-40 E via EXIT 140A toward NEEDLES (Passing through ARIZONA, NEW MEXICO, TEXAS, OKLAHOMA, and ARKANSAS, then crossing into TENNESSEE).", "Merge onto I-40 E via EXIT 12C on the LEFT toward NASHVILLE (Crossing into NORTH CAROLINA).", "Merge onto I-40 BR E/US-421 S via EXIT 188 on the LEFT toward WINSTON-SALEM.", "Take the CLOVERDALE AVE exit, EXIT 4.", "Turn LEFT onto CLOVERDALE AVE SW.", "Turn SLIGHT LEFT onto N HAWTHORNE RD.", "Turn RIGHT onto W NORTHWEST BLVD.", "1047 W NORTHWEST BLVD is on the LEFT." ) - ( 0.0020000000949949026, 0.07800000160932541, 0.14000000059604645, 7.827000141143799, 5.0329999923706055, 0.15299999713897705, 5.050000190734863, 20.871000289916992, 0.3050000071525574, 2.802999973297119, 0.10199999809265137, 37.78000259399414, 124.50700378417969, 0.3970000147819519, 25.264001846313477, 20.475000381469727, 125.8580093383789, 4.538000106811523, 1693.0350341796875, 628.8970336914062, 3.7990000247955322, 0.19099999964237213, 0.4099999964237213, 0.257999986410141, 0.5170000195503235, 0 )

    Read the article

  • UIView, UIScrollView and UITextFields problem calling Method

    - by Jeff Groby
    I have a view with several embedded UITextFields, this UIView is subordinated to a UIScrollView in IB. Each text field is supposed to invoke a method called updateText defined in the viewcontroller implementation file when the user is done editing the field. For some reason, the method updateText never gets invoked. Anyone have any ideas how to go about fixing this? The method fired off just fine when the UIScrollView was not present in the project but the keyboard would cover the text fields during input, which was annoying. Now my textfields move up above the keyboard when it appears, but won't fire off the method when done editing. Here is my implementation file: #import "MileMarkerViewController.h" @implementation MileMarkerViewController @synthesize scrollView,milemarkerLogDate,milemarkerDesc,milemarkerOdobeg,milemarkerOdoend,milemarkerBusiness,milemarkerPersonal,milemarker; - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil { if (self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]) { // Initialization code } return self; } - (BOOL) textFieldShouldReturn: (UITextField*) theTextField { return [theTextField resignFirstResponder]; } - (void)viewDidLoad { [super viewDidLoad]; [[NSNotificationCenter defaultCenter] addObserver: self selector: @selector(keyboardWasShown:) name: UIKeyboardDidShowNotification object: nil]; [[NSNotificationCenter defaultCenter] addObserver: self selector: @selector(keyboardWasHidden:) name: UIKeyboardDidHideNotification object: nil]; keyboardShown = NO; // 1 [scrollView setContentSize: CGSizeMake( 320, 480)]; // 2 } - (void)keyboardWasShown:(NSNotification*)aNotification { if (keyboardShown) return; NSDictionary* info = [aNotification userInfo]; // Get the size of the keyboard. NSValue* aValue = [info objectForKey:UIKeyboardBoundsUserInfoKey]; CGSize keyboardSize = [aValue CGRectValue].size; // Resize the scroll view (which is the root view of the window) CGRect viewFrame = [scrollView frame]; viewFrame.size.height -= keyboardSize.height; scrollView.frame = viewFrame; // Scroll the active text field into view. CGRect textFieldRect = [activeField frame]; [scrollView scrollRectToVisible:textFieldRect animated:YES]; keyboardShown = YES; } - (void)keyboardWasHidden:(NSNotification*)aNotification { NSDictionary* info = [aNotification userInfo]; // Get the size of the keyboard. NSValue* aValue = [info objectForKey:UIKeyboardBoundsUserInfoKey]; CGSize keyboardSize = [aValue CGRectValue].size; // Reset the height of the scroll view to its original value CGRect viewFrame = [scrollView frame]; viewFrame.size.height += keyboardSize.height; [scrollView scrollRectToVisible:CGRectMake(0, 0, 1, 1) animated:YES]; scrollView.frame = viewFrame; keyboardShown = NO; } - (void)textFieldDidBeginEditing:(UITextField *)textField { activeField = textField; } - (void)textFieldDidEndEditing:(UITextField *)textField { activeField = nil; } - (IBAction)updateText:(id) sender { NSLog(@"You just entered: %@",self.milemarkerLogDate.text); self.milemarker.logdate = self.milemarkerLogDate.text; self.milemarker.desc = self.milemarkerDesc.text; self.milemarker.odobeg = self.milemarkerOdobeg.text; self.milemarker.odoend = self.milemarkerOdoend.text; self.milemarker.business = self.milemarkerBusiness.text; self.milemarker.personal = self.milemarkerPersonal.text; NSLog(@"Original textfield is set to: %@",self.milemarker.logdate); [self.milemarker updateText]; } - (void)didReceiveMemoryWarning { // Releases the view if it doesn't have a superview. [super didReceiveMemoryWarning]; // Release any cached data, images, etc that aren't in use. } - (void)dealloc { [super dealloc]; } @end

    Read the article

  • UITextView doesn't not resize when keyboard appear if loaded from a tab bar cotroller

    - by elio.d
    I have a simple view controller (SecondViewController) used to manage a UITextview (I'm building a simple editor) this is the code of the SecondViewController.h @interface SecondViewController : UIViewController { IBOutlet UITextView *textView; } @property (nonatomic,retain) IBOutlet UITextView *textView; @end and this is the SecondViewController.m // // EditorViewController.m // Editor // // Created by elio d'antoni on 13/01/11. // Copyright 2011 none. All rights reserved. // @implementation SecondViewController @synthesize textView; /* // Implement loadView to create a view hierarchy programmatically, without using a nib. - (void)loadView { } */ // Implement viewDidLoad to do additional setup after loading the view, typically from a nib. - (void)viewDidLoad { [super viewDidLoad]; self.view.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"uiViewBg.png"]]; textView.layer.borderWidth=1; textView.layer.cornerRadius=5; textView.layer.borderColor=[[UIColor darkGrayColor] CGColor]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillAppear:) name:UIKeyboardWillShowNotification object:nil]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillDisappear:) name:UIKeyboardWillHideNotification object:nil]; } -(void) matchAnimationTo:(NSDictionary *) userInfo { NSLog(@"match animation method"); [UIView setAnimationDuration:[[userInfo objectForKey:UIKeyboardAnimationDurationUserInfoKey] doubleValue]]; [UIView setAnimationCurve:[[userInfo objectForKey:UIKeyboardAnimationCurveUserInfoKey] intValue]]; } -(CGFloat) keyboardEndingFrameHeight:(NSDictionary *) userInfo { NSLog(@"keyboardEndingFrameHeight method"); CGRect keyboardEndingUncorrectedFrame = [[ userInfo objectForKey:UIKeyboardFrameEndUserInfoKey ] CGRectValue]; CGRect keyboardEndingFrame = [self.view convertRect:keyboardEndingUncorrectedFrame fromView:nil]; return keyboardEndingFrame.size.height; } -(CGRect) adjustFrameHeightBy:(CGFloat) change multipliedBy:(NSInteger) direction { NSLog(@"adjust method"); return CGRectMake(20, 57, self.textView.frame.size.width, self.textView.frame.size.height + change * direction); } -(void)keyboardWillAppear:(NSNotification *)notification { NSLog(@"keyboard appear"); [UIView beginAnimations:nil context:NULL]; [self matchAnimationTo:[notification userInfo]]; self.textView.frame = [self adjustFrameHeightBy:[self keyboardEndingFrameHeight: [notification userInfo]] multipliedBy:-1]; [UIView commitAnimations]; } -(void)keyboardWillDisappear:(NSNotification *) notification { NSLog(@"keyboard disappear"); [UIView beginAnimations:nil context:NULL]; [self matchAnimationTo:[notification userInfo]]; self.textView.frame = [self adjustFrameHeightBy:[self keyboardEndingFrameHeight: [notification userInfo]] multipliedBy:1]; [UIView commitAnimations]; } // Override to allow orientations other than the default portrait orientation. - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { return YES; } (void)didReceiveMemoryWarning { // Releases the view if it doesn't have a superview. [super didReceiveMemoryWarning]; // Release any cached data, images, etc that aren't in use. } (void)viewDidUnload { // Release any retained subviews of the main view. // e.g. self.myOutlet = nil; } (void)dealloc { [super dealloc]; } @end the problem is that if load the view controller from a tab bar controller the textView doesn't resize when the keyboard appear, but the SAME code works if loaded as a single view based app. I hope I was clear enough. I used the tabBar template provided by xcode no modifications.

    Read the article

  • CoreData, transient atribute and EXC_BAD_ACCESS.

    - by Lukasz
    I'm trying to build simple file browser and i'm stuck. I defined classes, build window, add controllers, views.. Everything works but only ONE time. Selecting again Folder in NSTableView or trying to get data from Folder.files causing silent EXC_BAD_ACCESS (code=13, address0x0) from main. Info about files i keep outside of CoreData, in simple class, I don't want to save them: #import <Foundation/Foundation.h> @interface TPDrawersFileInfo : NSObject @property (nonatomic, retain) NSString * filename; @property (nonatomic, retain) NSString * extension; @property (nonatomic, retain) NSDate * creation; @property (nonatomic, retain) NSDate * modified; @property (nonatomic, retain) NSNumber * isFile; @property (nonatomic, retain) NSNumber * size; @property (nonatomic, retain) NSNumber * label; +(TPDrawersFileInfo *) initWithURL: (NSURL *) url; @end @implementation TPDrawersFileInfo +(TPDrawersFileInfo *) initWithURL: (NSURL *) url { TPDrawersFileInfo * new = [[TPDrawersFileInfo alloc] init]; if (new!=nil) { NSFileManager * fileManager = [NSFileManager defaultManager]; NSError * error; NSDictionary * infoDict = [fileManager attributesOfItemAtPath: [url path] error:&error]; id labelValue = nil; [url getResourceValue:&labelValue forKey:NSURLLabelNumberKey error:&error]; new.label = labelValue; new.size = [infoDict objectForKey: @"NSFileSize"]; new.modified = [infoDict objectForKey: @"NSFileModificationDate"]; new.creation = [infoDict objectForKey: @"NSFileCreationDate"]; new.isFile = [NSNumber numberWithBool:[[infoDict objectForKey:@"NSFileType"] isEqualToString:@"NSFileTypeRegular"]]; new.extension = [url pathExtension]; new.filename = [[url lastPathComponent] stringByDeletingPathExtension]; } return new; } Next I have class Folder, which is NSManagesObject subclass // Managed Object class to keep info about folder content @interface Folder : NSManagedObject { NSArray * _files; } @property (nonatomic, retain) NSArray * files; // Array with TPDrawersFileInfo objects @property (nonatomic, retain) NSString * url; // url of folder -(void) reload; //if url changed, load file info again. @end @implementation Folder @synthesize files = _files; @dynamic url; -(void)awakeFromInsert { [self addObserver:self forKeyPath:@"url" options:NSKeyValueObservingOptionNew context:@"url"]; } -(void)awakeFromFetch { [self addObserver:self forKeyPath:@"url" options:NSKeyValueObservingOptionNew context:@"url"]; } -(void)prepareForDeletion { [self removeObserver:self forKeyPath:@"url"]; } -(void) observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context { if (context == @"url") { [self reload]; } } -(void) reload { NSMutableArray * result = [NSMutableArray array]; NSError * error = nil; NSFileManager * fileManager = [NSFileManager defaultManager]; NSString * percented = [self.url stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]; NSArray * listDir = [fileManager contentsOfDirectoryAtURL: [NSURL URLWithString: percented] includingPropertiesForKeys: [NSArray arrayWithObject: NSURLCreationDateKey ] options:NSDirectoryEnumerationSkipsHiddenFiles error:&error]; if (error!=nil) {NSLog(@"Error <%@> reading <%@> content", error, self.url);} for (id fileURL in listDir) { TPDrawersFileInfo * fi = [TPDrawersFileInfo initWithURL:fileURL]; [result addObject: fi]; } _files = [NSArray arrayWithArray:result]; } @end In app delegate i defined @interface TPAppDelegate : NSObject <NSApplicationDelegate> { IBOutlet NSArrayController * foldersController; Folder * currentFolder; } - (IBAction)chooseDirectory:(id)sender; // choose folder and - (Folder * ) getFolderObjectForPath: path { //gives Folder object if already exist or nil if not ..... } - (IBAction)chooseDirectory:(id)sender { //Opens panel, asking for url NSOpenPanel * panel = [NSOpenPanel openPanel]; [panel setCanChooseDirectories:YES]; [panel setCanChooseFiles:NO]; [panel setMessage:@"Choose folder to show:"]; NSURL * currentDirectory; if ([panel runModal] == NSOKButton) { currentDirectory = [[panel URLs] objectAtIndex:0]; } Folder * folderObject = [self getFolderObjectForPath:[currentDirectory path]]; if (folderObject) { //if exist: currentFolder = folderObject; } else { // create new one Folder * newFolder = [NSEntityDescription insertNewObjectForEntityForName:@"Folder" inManagedObjectContext:self.managedObjectContext]; [newFolder setValue:[currentDirectory path] forKey:@"url"]; [foldersController addObject:newFolder]; currentFolder = newFolder; } [foldersController setSelectedObjects:[NSArray arrayWithObject:currentFolder]]; } Please help ;)

    Read the article

  • Ipad UIImagePickerController and UIPopoverController error

    - by nishantcm
    Hi, I am using this code to open a popover with imagepicker -(IBAction)photosAction:(id)sender { // dismiss any left over popovers here UIImagePickerController* picker = [[UIImagePickerController alloc] init]; picker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary; picker.delegate = self; UIPopoverController *popover = [[UIPopoverController alloc] initWithContentViewController:picker]; self.popoverController = popover; popoverController.delegate = self; [popoverController presentPopoverFromBarButtonItem:sender permittedArrowDirections:UIPopoverArrowDirectionUp animated:YES]; [picker release]; But this results in this error request for member 'popoverController' in something not a structure or union and this error 'popoverController' undeclared (first use in this function). Also I want to dismiss the popover when the image is selected. What code should I put in the following function to dismiss the popover once the image is selected. (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info { Thanks for the help!

    Read the article

  • Iphone SDK - adding UITableView to UIView

    - by Shashi
    Hi, I am trying to learn how to use different views, for this sample test app, i have a login page, upon successful logon, the user is redirected to a table view and then upon selection of an item in the table view, the user is directed to a third page showing details of the item. the first page works just fine, but the problem occurs when i go to the second page, the table shown doesn't have title and i cannot add title or toolbar or anything other than the content of the tables themselves. and when i click on the item, needless to say nothing happens. no errors as well. i am fairly new to programming and have always worked on Java but never on C(although i have some basic knowledge of C) and Objective C is new to me. Here is the code. import @interface NavigationTestAppDelegate : NSObject { UIWindow *window; UIViewController *viewController; IBOutlet UITextField *username; IBOutlet UITextField *password; IBOutlet UILabel *loginError; //UINavigationController *navigationController; } @property (nonatomic, retain) IBOutlet UIViewController *viewController; @property (nonatomic, retain) IBOutlet UIWindow *window; @property (nonatomic, retain) IBOutlet UITextField *username; @property (nonatomic, retain) IBOutlet UITextField *password; @property (nonatomic, retain) IBOutlet UILabel *loginError; -(IBAction) login; -(IBAction) hideKeyboard: (id) sender; @end import "NavigationTestAppDelegate.h" import "RootViewController.h" @implementation NavigationTestAppDelegate @synthesize window; @synthesize viewController; @synthesize username; @synthesize password; @synthesize loginError; pragma mark - pragma mark Application lifecycle -(IBAction) hideKeyboard: (id) sender{ [sender resignFirstResponder]; } (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { // Override point for customization after app launch //RootViewController *rootViewController = [[RootViewController alloc] init]; //[window addSubview:[navigationController view]]; [window addSubview:[viewController view]]; [window makeKeyAndVisible]; return YES; } -(IBAction) login { RootViewController *rootViewController = [[RootViewController alloc] init]; //NSString *user = [[NSString alloc] username. if([username.text isEqualToString:@"test"]&&[password.text isEqualToString:@"test"]){ [window addSubview:[rootViewController view]]; //[window addSubview:[navigationController view]]; [window makeKeyAndVisible]; //rootViewController.awakeFromNib; } else { loginError.text = @"LOGIN ERROR"; [window addSubview:[viewController view]]; [window makeKeyAndVisible]; } } (void)applicationWillTerminate:(UIApplication *)application { // Save data if appropriate } pragma mark - pragma mark Memory management (void)dealloc { //[navigationController release]; [viewController release]; [window release]; [super dealloc]; } @end import @interface RootViewController : UITableViewController { IBOutlet NSMutableArray *views; } @property (nonatomic, retain) IBOutlet NSMutableArray * views; @end // // RootViewController.m // NavigationTest // // Created by guest on 4/23/10. // Copyright MyCompanyName 2010. All rights reserved. // import "RootViewController.h" import "OpportunityOne.h" @implementation RootViewController @synthesize views; //@synthesize navigationViewController; pragma mark - pragma mark View lifecycle (void)viewDidLoad { views = [ [NSMutableArray alloc] init]; OpportunityOne *opportunityOneController; for (int i=1; i<=20; i++) { opportunityOneController = [[OpportunityOne alloc] init]; opportunityOneController.title = [[NSString alloc] initWithFormat:@"Opportunity %i",i]; [views addObject:[NSDictionary dictionaryWithObjectsAndKeys: [[NSString alloc] initWithFormat:@"Opportunity %i",i], @ "title", opportunityOneController, @"controller", nil]]; self.title=@"GPS"; } /*UIBarButtonItem *temporaryBarButtonItem = [[UIBarButtonItem alloc] init]; temporaryBarButtonItem.title = @"Back"; self.navigationItem.backBarButtonItem = temporaryBarButtonItem; [temporaryBarButtonItem release]; */ //self.title =@"Global Platform for Sales"; [super viewDidLoad]; //[temporaryBarButtonItem release]; //[opportunityOneController release]; // Uncomment the following line to display an Edit button in the navigation bar for this view controller. // self.navigationItem.rightBarButtonItem = self.editButtonItem; } pragma mark - pragma mark Table view data source // Customize the number of sections in the table view. - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { return 1; } // Customize the number of rows in the table view. - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { return [views count]; } // Customize the appearance of table view cells. - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier = @"Cell"; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; if (cell == nil) { cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease]; } // Configure the cell. cell.textLabel.text = [[views objectAtIndex:indexPath.row] objectForKey:@"title"]; return cell; } pragma mark - pragma mark Table view delegate (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { //UIViewController *targetViewController = [[views objectAtIndex:indexPath.row] objectForKey:@"controller"]; UIViewController *targetViewController = [[views objectAtIndex:indexPath.row] objectForKey:@"controller"]; [[self navigationController] pushViewController:targetViewController animated:YES]; } pragma mark - pragma mark Memory management (void)didReceiveMemoryWarning { // Releases the view if it doesn't have a superview. [super didReceiveMemoryWarning]; // Relinquish ownership any cached data, images, etc that aren't in use. } (void)viewDidUnload { // Relinquish ownership of anything that can be recreated in viewDidLoad or on demand. // For example: self.myOutlet = nil; } (void)dealloc { [views release]; [super dealloc]; } @end Wow, i was finding it real hard to post the code. i apologize for the bad formatting, but i just couldn't get past the formatting rules for this text editor. Thanks, Shashi

    Read the article

  • Save image to camera roll with UIImageWriteToSavedPhotosAlbum

    - by Momeks
    Hi , i try to save a photo with a button to camera roll after user capture a picture with Camera , but i dont know why my picture doesn't save at photo library !! here is my code : -(IBAction)savePhoto{ UIImageWriteToSavedPhotosAlbum(img.image,nil, nil, nil); } -(IBAction)takePic { ipc = [[UIImagePickerController alloc]init]; ipc.delegate = self; ipc.sourceType = UIImagePickerControllerSourceTypeCamera; [self presentModalViewController:ipc animated:YES]; } - (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info { img.image = [[info objectForKey:UIImagePickerControllerOriginalImage]retain]; [[picker parentViewController]dismissModalViewControllerAnimated:YES]; [picker release]; } ipc is UIImagePickerController and img is UIIMageView what's my problem ?

    Read the article

  • self.view.frame.size in viewDidLoad and didRotateFromInterfaceOrientation are different

    - by tokentoken
    I created iphone view-based project, and added UINavigationController by code. - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { TestViewController *vc = [[TestViewController alloc]init]; navController = [[UINavigationController alloc]initWithRootViewController:vc]; [window addSubview:navController.view]; [window makeKeyAndVisible]; return YES; } After that, I checked self.view.frame.size.height in viewDidLoad and didRotateFromInterfaceOrientation, and they're different. (they're 460 and 416) I suppose the height of NavigationBar is not included in viewDidLoad, but should I add it manually (add 44)?

    Read the article

  • Why the CLLocationManager delegate is not getting called in iPhone SDK 4.0 ???

    - by Biranchi
    Hi, This is the code that I have in my AppDelegate Class - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { CLLocationManager *locationManager = [[CLLocationManager alloc] init]; locationManager.delegate = self; locationManager.distanceFilter = 1000; // 1 Km locationManager.desiredAccuracy = kCLLocationAccuracyKilometer; [locationManager startUpdatingLocation]; } And this is the delegate method i have in my AppDelegate Class //This is the delegate method for CoreLocation - (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation { //printf("AppDelegate latitude %+.6f, longitude %+.6f\n", newLocation.coordinate.latitude, newLocation.coordinate.longitude); } Its working in 3.0, 3.1, 3.1.3 , but its not working in 4.0 simulator and device both. What is the reason ?? I am getting frustrated ...... Thanks....

    Read the article

  • Update Query using the Objective C Wrapper for sqlite

    - by user271753
    Hey I am using the http://th30z.netsons.org/2008/11/objective-c-sqlite-wrapper/ wrapper . My code is this : - (IBAction)UpdateButtonPressed:(id)sender { Sqlite *sqlite = [[Sqlite alloc] init]; NSString *writableDBPath = [[NSBundle mainBundle]pathForResource:@"Money"ofType:@"sqlite"]; if (![sqlite open:writableDBPath]) return; NSArray *query = [sqlite executeQuery:@"UPDATE UserAccess SET Answer ='Positano';"]; NSDictionary *dict = [query objectAtIndex:2]; NSString *itemValue = [dict objectForKey:@"Answer"]; NSLog(@"%@",itemValue); } Answer is the Column name , UserAccess the table name . the column is at 3rd place in the table What am I doing wrong why is it crashing ???

    Read the article

  • How to push a modal view from didFinishPickingMediaWithInfo

    - by Andiih
    I've got an imagePickerController which allows the user to take or select an image. In - (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info; I would like to trigger opening another modal view to capture the caption. I have a call for that purpose... -(void) getcaption:(id) obj { textInput * ti = [[textInput alloc] initWithContent:@"" header:@"Caption for photo" source:2]; ti.delegate = self; [self presentModalViewController:ti animated:YES]; [ti release]; } The question is how to call getcaption without triggering a spiral of #6663 0x324abb18 in -[UIView(Hierarchy) _makeSubtreePerformSelector:withObject:withObject:copySublayers:] () At the moment I do [self performSelector:@selector(getcaption:) withObject:nil afterDelay:(NSTimeInterval)1]; in didFinishPickingMediaWithInfo which is nasty, and only 95% reliable

    Read the article

  • Problem with fetching dictionary objects in array from plist iphone sdk

    - by neha
    Hi all, What is the datatype you use to fetch items whose type is dictionary in plist i.e. nsmutabledictionary or nsdictionary? Because I'm using following code to retrieve dictionary objects from an array of dictionaries in plist. NSMutableDictionary *_myDict = [contentArray objectAtIndex:0]; NSLog(@"MYDICT : %@",_myDict); NSString *myKey = (NSString *)[_myDict valueForKey:@"Contents"] ; [[cell lblFeed] setText:[NSString stringWithFormat:@"%@",myKey]]; Here, on first line it's showing me objc_msgsend. ContentArray is an nsarray and it's contents are showing 2 objects that are there in plist. In plist they are dictionary objects. Then why this error? Can anybody please help? Thanx in advance.

    Read the article

  • Problem in In-App purchase-consumable model

    - by kunal-dutta
    I have created a nonconsumable in app purchase item and now I want to create a consumable in-app purchase by which a user to buy it every time he uses it,and also I want to create a subscription model In-App purchase. Everything works as expected except when I buy the item more than one time, iPhone pop ups a message saying "You've already purchased the item. Do You want to buy it again?". Is It possible to disable this dialog and proceed to the actual purchase?And what will have to change in following code with different model:- in InApp purchase manager.m: @implementation InAppPurchaseManager //@synthesize purchasableObjects; //@synthesize storeObserver; @synthesize proUpgradeProduct; @synthesize productsRequest; //BOOL featureAPurchased; //BOOL featureBPurchased; //static InAppPurchaseManager* _sharedStoreManager; // self (void)dealloc { //[_sharedStoreManager release]; //[storeObserver release]; [super dealloc]; } (void)requestProUpgradeProductData { NSSet *productIdentifiers = [NSSet setWithObject:@"com.vigyaapan.iWorkOut1" ]; productsRequest = [[SKProductsRequest alloc] initWithProductIdentifiers:productIdentifiers]; productsRequest.delegate = self; [productsRequest start]; // we will release the request object in the delegate callback } pragma mark - pragma mark SKProductsRequestDelegate methods (void)productsRequest:(SKProductsRequest *)request didReceiveResponse:(SKProductsResponse *)response { //NSArray *products = response.products; //proUpgradeProduct = [products count] == 1 ? [[products firstObject] retain]: nil; if (proUpgradeProduct) { NSLog(@"Product title: %@", proUpgradeProduct.localizedTitle); NSLog(@"Product description: %@", proUpgradeProduct.localizedDescription); NSLog(@"Product price: %@", proUpgradeProduct.price); NSLog(@"Product id:%@", proUpgradeProduct.productIdentifier); } /*for (NSString invalidProductId in response.invalidProductIdentifiers) { NSLog(@"Invalid product id: %@" , invalidProductId); }/ //finally release the reqest we alloc/init’ed in requestProUpgradeProductData [productsRequest release]; [[NSNotificationCenter defaultCenter] postNotificationName:kInAppPurchaseManagerProductsFetchedNotification object:self userInfo:nil]; } pragma - pragma Public methods /* call this method once on startup*/ (void)loadStore { /* restarts any purchases if they were interrupted last time the app was open*/ [[SKPaymentQueue defaultQueue] addTransactionObserver:self]; /* get the product description (defined in early sections)*/ [self requestProUpgradeProductData]; } /* call this before making a purchase*/ (BOOL)canMakePurchases { return [SKPaymentQueue canMakePayments]; } /* kick off the upgrade transaction*/ (void)purchaseProUpgrade { SKPayment *payment = [SKPayment paymentWithProductIdentifier:@"9820091347"]; [[SKPaymentQueue defaultQueue] addPayment:payment]; } pragma - pragma Purchase helpers /* saves a record of the transaction by storing the receipt to disk*/ (void)recordTransaction:(SKPaymentTransaction )transaction { if ([transaction.payment.productIdentifier isEqualToString:kInAppPurchaseProUpgradeProductId]) { / save the transaction receipt to disk*/ [[NSUserDefaults standardUserDefaults] setValue:transaction.transactionReceipt forKey:@"proUpgradeTransactionReceipt" ]; [[NSUserDefaults standardUserDefaults] synchronize]; } } /* enable pro features*/ (void)provideContent:(NSString )productId { if ([productId isEqualToString:kInAppPurchaseProUpgradeProductId]) { / enable the pro features*/ [[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"isProUpgradePurchased" ]; [[NSUserDefaults standardUserDefaults] synchronize]; } } (void)finishTransaction:(SKPaymentTransaction )transaction wasSuccessful:(BOOL)wasSuccessful { // / remove the transaction from the payment queue.*/ [[SKPaymentQueue defaultQueue] finishTransaction:transaction]; NSDictionary *userInfo = [NSDictionary dictionaryWithObjectsAndKeys:transaction, @"transaction" , nil]; if (wasSuccessful) { /* send out a notification that we’ve finished the transaction*/ [[NSNotificationCenter defaultCenter]postNotificationName:kInAppPurchaseManagerTransactionSucceededNotification object:self userInfo:userInfo]; } else { /* send out a notification for the failed transaction*/ [[NSNotificationCenter defaultCenter] postNotificationName:kInAppPurchaseManagerTransactionFailedNotification object:self userInfo:userInfo]; } } (void)completeTransaction:(SKPaymentTransaction *)transaction { [self recordTransaction:transaction]; [self provideContent:transaction.payment.productIdentifier]; [self finishTransaction:transaction wasSuccessful:YES]; } (void)restoreTransaction:(SKPaymentTransaction *)transaction { [self recordTransaction:transaction.originalTransaction]; [self provideContent:transaction.originalTransaction.payment.productIdentifier]; [self finishTransaction:transaction wasSuccessful:YES]; } (void)failedTransaction:(SKPaymentTransaction )transaction { if (transaction.error.code != SKErrorPaymentCancelled) { / error!/ [self finishTransaction:transaction wasSuccessful:NO]; } else { / this is fine, the user just cancelled, so don’t notify*/ [[SKPaymentQueue defaultQueue] finishTransaction:transaction]; } } (void)paymentQueue:(SKPaymentQueue *)queue updatedTransactions:(NSArray *)transactions { for (SKPaymentTransaction *transaction in transactions) { switch (transaction.transactionState) { case SKPaymentTransactionStatePurchased: [self completeTransaction:transaction]; break; case SKPaymentTransactionStateFailed: [self failedTransaction:transaction]; break; case SKPaymentTransactionStateRestored: [self restoreTransaction:transaction]; break; default: break; } } } @end in SKProduct.m:- @implementation SKProduct (LocalizedPrice) - (NSString *)localizedPrice { NSNumberFormatter *numberFormatter = [[NSNumberFormatter alloc] init]; [numberFormatter setFormatterBehavior:NSNumberFormatterBehavior10_4]; [numberFormatter setNumberStyle:NSNumberFormatterCurrencyStyle]; [numberFormatter setLocale:self.priceLocale]; NSString *formattedString = [numberFormatter stringFromNumber:self.price]; [numberFormatter release]; return formattedString; }

    Read the article

  • Trouble getting search results using MGTwitterEngine

    - by cannyboy
    I'm using a version of Matt Gemmell's MGTwitterEngine, and I'm trying to get some results from the getSearchResultsForQuery method. // do a search [_engine getSearchResultsForQuery:@"#quote"]; // delegate method for handling result - (void)searchResultsReceived:(NSArray *)searchResults forRequest:(NSString *)connectionIdentifier { if ([searchResults count] > 0) { NSDictionary *singleResult = [searchResults objectAtIndex:1]; NSString *text = [singleResult valueForKey:@"text"]; NSLog(@"Text at Index one: \n %@", text); } } However, I never appear to get the result. In the console, I get: Request 7E4C3097-88D6-45F1-90D2-AD8205FBAAC5 failed with error: Error Domain=HTTP Code=400 "Operation could not be completed. (HTTP error 400.)" Is there a way around this? Am I implementing the delegate method right? (Also, I had difficulty installing the YAJL stuff for the engine, and wonder if that has something to do with it)

    Read the article

  • UIImagePickerController Causes my app to crash!

    - by Flafla2
    In my app, a user can select an image, change the picture of a UIImageView to the new imge, and save the image to NSUserDefaults using NSKeyedArchiver. When the user selects the image the app immediately crashes! Here is my code - - (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info { [picker dismissModalViewControllerAnimated:YES]; if ([[NSUserDefaults standardUserDefaults] integerForKey:@"PictureKey"] == 1) { UIImage *previmage = [info objectForKey:@"UIImagePickerControllerOriginalImage"]; [prevbutton setImage:previmage]; NSData *previmagedata = [NSKeyedArchiver archivedDataWithRootObject:previmage]; [[NSUserDefaults standardUserDefaults] setObject:previmagedata forKey:@"PrevImage"]; } else if ([[NSUserDefaults standardUserDefaults] integerForKey:@"PictureKey"] == 2) { UIImage *nextimage = [info objectForKey:@"UIImagePickerControllerOriginalImage"]; [nextbutton setImage:nextimage]; NSData *nextimagedata = [NSKeyedArchiver archivedDataWithRootObject:nextimage]; [[NSUserDefaults standardUserDefaults] setObject:nextimagedata forKey:@"NextImage"]; }else { UIImage *optionsimage = [info objectForKey:@"UIImagePickerControllerOriginalImage"]; [moreoptionsbutton setImage:optionsimage]; NSData *optimagedata = [NSKeyedArchiver archivedDataWithRootObject:optionsimage]; [[NSUserDefaults standardUserDefaults] setObject:optimagedata forKey:@"OptionsImage"]; } } Thanks in advance!

    Read the article

  • Cannot get Google Analytics API to register page views on iPhone

    - by Sebastien
    I would like to gather usage statistics for my iPhone app using Google Analytics so I'm trying to configure it using the following tutorial: http://code.google.com/intl/fr-FR/apis/analytics/docs/tracking/mobileAppsTracking.html I think I did everything they indicate in the documentation, and I get no error on the iPhone side, but I don't see any visits in Google Analytics. - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions{ [self initGoogleAnalytics]; //... } -(void)initGoogleAnalytics{ [[GANTracker sharedTracker] startTrackerWithAccountID:[[NSBundle mainBundle] objectForInfoDictionaryKey:@"GoogleAnalyticsCode"] dispatchPeriod:-1 delegate:nil NSError *error; if(![[GANTracker sharedTracker] trackPageview:@"/home" withError:&error]){ NSLog(@"%@", [error localizedDescription], nil); } [[GANTracker sharedTracker] dispatch]; } Any idea why this is not working?

    Read the article

  • Creating a multi-page PDF doc

    - by codemercenary
    Hi, has anyone already created a PDF document in an iPad app. i see that there are new functions in the UIKit to do this, but I can't find any code example for this. BOOL UIGraphicsBeginPDFContextToFile ( NSString *path, CGRect bounds, NSDictionary *documentInfo ); void UIGraphicsBeginPDFPage ( void ); I found an example that is supposed to work on the iPhone, but this gives me errors: Fri Apr 30 11:55:32 wks104.hs.local PDF[1963] <Error>: CGFont/Freetype: The function `create_subset' is currently unimplemented. Fri Apr 30 11:55:32 wks104.hs.local PDF[1963] <Error>: invalid Type1 font: unable to stream font. Fri Apr 30 11:55:32 wks104.hs.local PDF[1963] <Error>: FT_Load_Glyph failed: error 6. Fri Apr 30 11:55:32 wks104.hs.local PDF[1963] <Error>: FT_Load_Glyph failed: error 6. Fri Apr 30 11:55:32 wks104.hs.local PDF[1963] <Error>: FT_Load_Glyph failed: error 6. Fri Apr 30 11:55:32 wks104.hs.local PDF[1963] <Error>: FT_Load_Glyph failed: error 6.

    Read the article

  • How to crop Image in iPhone?

    - by aman-gupta
    Hi, In my application I m using following codes to crop the captured image :- -(void)imagePickerController:(UIImagePickerController *) picker didFinishPickingMediaWithInfo:(NSDictionary *)info { #ifdef _DEBUG NSLog(@"frmSkinImage-imagePickerController-Start"); #endif imageView.image = [info objectForKey:@"UIImagePickerControllerOriginalImage"]; //======================================= UIImage *image =imageView.image; CGRect cropRect = CGRectMake(100, 100, 125,128); CGImageRef imageRef = CGImageCreateWithImageInRect([image CGImage], cropRect); [imageView setImage:[UIImage imageWithCGImage:imageRef]]; CGImageRelease(imageRef); //=================================================== //imgglobal = [info objectForKey:@"UIImagePickerControllerOriginalImage"]; // for saving image to photo album //UIImageWriteToSavedPhotosAlbum(imageView.image, self, @selector(image:didFinishSavingWithError:contextInfo:), self); [picker dismissModalViewControllerAnimated:YES]; #ifdef _DEBUG NSLog(@"frmSkinImage-imagePickerController-End"); #endif } But my problem is that when I use camera to take photo to crop the captured image it rotates the image to 90 degree towards right and in case I use Photo library it works perfectly. So Can u filter my above codes to know where I m wrong. Please help me out its urgent Thanks In Advance

    Read the article

  • Taking video from video camera and displaying it with MPMoviePlayerController IPhone SDK

    - by Daniel
    Has anyone tried taking a video from the camera and then using the video player provided to play it? When you take the video in portrait mode, sometimes the movie will play (when the player puts it in landscape mode) and when it puts it in portrait mode you cannot view the movie all you hear is sound,sometimes in landscape mode is flickers and does not play right, has anyone encountered this and found a way to fix it? My code to play the video looks like this: - (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info { NSURL *urls=[info objectForKey:@"UIImagePickerControllerMediaURL"] ; moviePlayer = [[MPMoviePlayerController alloc] initWithContentURL:[info urls]]; if (moviePlayer) { [moviePlayer play]; } } I checked settings on the docs nothing seems like it would fix this...Thanks

    Read the article

  • Assessing elements in plist iphone sdk

    - by quky
    ok i have a plist like this ` <dict> <key>Rows</key> <array> <dict> <key>WireSize</key> <string>16 AWG</string> <key>Children</key> <array> <dict> <key>Cooper 60°C (140°F)</key> <string>0</string> </dict> <dict> <key>Cooper 75°C (167°F)</key> <string>0</string> </dict> <dict> <key>Cooper 90°C (194°F)</key> <string>14</string> </dict> <dict> <key>Aluminum 60°C (140°F)</key> <string>0</string> </dict> <dict> <key>Aluminum 75°C (167°F)</key> <string>0</string> </dict> <dict> <key>Aluminum 90°C (194°F)</key> <string>0</string> </dict> </array> </dict> <dict> <key>WireSize</key> <string>16 AWG</string> <key>Children</key> <array> <dict> <key>Cooper 60°C (140°F)</key> <string>0</string> </dict> <dict> <key>Cooper 75°C (167°F)</key> <string>0</string> </dict> <dict> <key>Cooper 90°C (194°F)</key> <string>14</string> </dict> <dict> <key>Aluminum 60°C (140°F)</key> <string>0</string> </dict> <dict> <key>Aluminum 75°C (167°F)</key> <string>0</string> </dict> <dict> <key>Aluminum 90°C (194°F)</key> <string>0</string> </dict> </array> </dict> </array> ` and been trying to read the values from it but not success i am using this code enter NSBundle *bundle = [NSBundle mainBundle]; NSString *plistPath = [bundle pathForResource:@"Table 310-16" ofType:@"plist"]; NSDictionary *dictionary = [[NSDictionary alloc] initWithContentsOfFile:plistPath]; for (id key in dictionary) { NSArray *array = [dictionary objectForKey:key]; NSLog(@"key: %@, value: %@", key, [array objectAtIndex:0]); } here and the results are key: Rows, value: { Children = ( { "Cooper 60\U00b0C (140\U00b0F)" = 0; }, { "Cooper 75\U00b0C (167\U00b0F)" = 0; }, { "Cooper 90\U00b0C (194\U00b0F)" = 14; }, { "Aluminum 60\U00b0C (140\U00b0F)" = 0; }, { "Aluminum 75\U00b0C (167\U00b0F)" = 0; }, { "Aluminum 90\U00b0C (194\U00b0F)" = 0; } ); WireSize = "16 AWG"; } but still don't know how to get and specific value for example Aluminum 60°C (140°F) or 14 or 16 AWG any help would be appresiated HP

    Read the article

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