Search Results

Search found 2735 results on 110 pages for 'xcode'.

Page 18/110 | < Previous Page | 14 15 16 17 18 19 20 21 22 23 24 25  | Next Page >

  • how to play an audio soundclip when a nib is loaded - welcome screen - xcode

    - by Pavan
    I would like to do the following two things: 1) I would like to play an audio file qhen a nib is loaded 2) After that i would like to switch views when the audio file has finished playing. This will be easy as i just need to call the event that initiates the change of view by using the delegate method -(void) audioPlayerDidFinishPlaying{ //code to change view } I dont know how to to play the audio file when a nib is loaded. Using the AVFoundation framework, I tried doing the following after setting up the audio player and the variables associated with it in the appropriate places i wrote the following: - (void)viewDidLoad { [super viewDidLoad]; NSString *soundFilePath = [[NSBundle mainBundle] pathForResource: @"sound" ofType: @"mp3"]; NSURL *fileURL = [[NSURL alloc] initFileURLWithPath: soundFilePath]; AVAudioPlayer *newPlayer = [[AVAudioPlayer alloc] initWithContentsOfURL: fileURL error:nil]; [fileURL release]; self.player = newPlayer; [newPlayer release]; [player prepareToPlay]; [player setDelegate: self]; [player play]; } Although this does not play the file as the viewdidload method gets called before the nib is shown so the audio is never played or heard. What do i need to do so that i can play the audio file AFTER the nib has loaded and is shown on the screen? can someone please help me as ive been working on this for 3 hours now. Thanks in advance.

    Read the article

  • XCode sqlite3 - SELECT always return SQLITE_DONE

    - by user573633
    Hi developers.... a noob here asking for help after a day of head-banging.... I am working on an app with sqlite3 database with one database and two tables. I have now come to a step where I want to select from the table with an argument. The code is here: -(NSMutableArray*) getGroupsPeopleWhoseGroupName:(NSString*)gn;{ NSMutableArray *groupedPeopleArray = [[NSMutableArray alloc] init]; const char *sql = "SELECT * FROM Contacts WHERE groupName='?'"; @try { NSArray * paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,NSUserDomainMask, YES); NSString *docsDir = [paths objectAtIndex:0]; NSString *theDBPath = [docsDir stringByAppendingPathComponent:@"ContactBook.sqlite"]; if (!(sqlite3_open([theDBPath UTF8String], &database) == SQLITE_OK)) { NSLog(@"An error opening database."); } sqlite3_stmt *st; NSLog(@"debug004 - sqlite3_stmt success."); if (sqlite3_prepare_v2(database, sql, -1, &st, NULL) != SQLITE_OK) { NSLog(@"Error, failed to prepare statement."); } //DB is ready for accessing, now start getting all the info. while (sqlite3_step(st) == SQLITE_ROW) { MyContacts * aContact = [[MyContacts alloc] init]; //get contactID from DB. aContact.contactID = sqlite3_column_int(st, 0); if (sqlite3_column_text(st, 1) != NULL) { aContact.firstName = [NSString stringWithUTF8String:(char *) sqlite3_column_text(st, 1)]; } else { aContact.firstName = @""; } // here retrieve other columns data .... //store these info retrieved into the newly created array. [groupedPeopleArray addObject:aContact]; [aContact release]; } if(sqlite3_finalize(st) != SQLITE_OK) { NSLog(@"Failed to finalize data statement."); } if (sqlite3_close(database) != SQLITE_OK) { NSLog(@"Failed to close database."); } } @catch (NSException *e) { NSLog(@"An exception occurred: %@", [e reason]); return nil; } return groupedPeopleArray;} MyContacts is the class where I put up all the record variables. My problem is sqlite3_step(st) always return SQLITE_DONE, so that it i can never get myContacts. (i verified this by checking the return value). What am I doing wrong here? Many thanks in advance!

    Read the article

  • Get String Instead of Source - Xcode Cocoa

    - by Kevin
    Hello everyone, I have a program that will scan the contents of a website, and display it in a textbox. The problem is that it shows the html source. For example if my html code was: <html> <body> <p>Hello</p> </body> </html> instead of just showing hello, it'll show the code above... How can I get my objective c program to just read the hello, and not the html source.. I was assuming that it was the encoding when reading the website, but I might be possibly wrong.. I would greatly appreciate it if someone could give me a reasonable answer.. Best Regards, Kevin

    Read the article

  • XCode: compiling doesn't always replace plist?

    - by Brian Postow
    I have an application and I will sometimes just change the plist, say to change the version number. Sometimes I'll actually make a change to the code, AND the version number....in the latter case, SOMETIMES the version number of the resulting app will change, in the former it will never change. The only way I've found that surely does it right is when I delete the .app before compiling. In case it matters, the resulting app is being put in a folder that isn't in the build folder, but I doubt that that's relevant. any thoughts?

    Read the article

  • Error while attempting to output data onto console in xcode

    - by Michael Amici
    I am trying to output general data (source code) from a website, but it just sits there. Can't figure out if its the interface or the code. Would someone double-check for me? #import "Lockerz_RedemptionViewController.h" @implementation Lockerz_RedemptionViewController -(IBAction)start: (id) sender { while (1) { NSMutableData *mydata = [[NSData alloc] initWithContentsOfURL:[NSURL URLWithString:@"http://ptzplace.lockerz.com/"]]; NSString *output = [[NSString alloc] initWithData:mydata encoding:NSASCIIStringEncoding]; NSLog(output); } }

    Read the article

  • Process for linking static ObjC libraries in XCode

    - by madmik3
    I'm trying to link to a static library and I keep getting linker errors. I've found a few sites that post examples but I have not been able to see what I am doing wrong. First I create a project that will link to my lib add existing files find my .xcodeproj file select "Copy items into destination groups folder"... Select my host project as Add To Targets. Then I add a direct dependency to my host app expand targets double click MyHost.app click + under direct dependencies select my lib Then I set build flags double click MyHost application icon in Groups and Files. click the build tab then I set the OtherLinerFlag to -ObjC then I set Header Search Paths to my header file location for my static library. I pass the compile stage but any classes in my static lib cause linker error: literal-pointer@_OBJC@_cls_refs@SomeClass in MyHost.o thanks!

    Read the article

  • xcode - defining integer variables

    - by Mike
    If I have #define myVariable 10 and later I use this as in [self doSomething:myVariable]; Supposing doSomethign method is like - (void) doSomething:(int)myNumber; I receive a warning telling me that a "]" is expected before the ";" why is that and how to solve this? thanks for any help.

    Read the article

  • Using XCode and instruments to improve iPhone app performance

    - by MrDatabase
    I've been experimenting with Instruments off and on for a while and and I still can't do the following (with any sensible results): determine or estimate the average runtime of a function that's called many times. For example if I'm driving my gameLoop at 60 Hz with a CADisplayLink I'd like to see how long the loop takes to run on average... 10 ms? 30 ms etc. I've come close with the "CPU activity" instrument but the results are inconsistent or don't make sense. The time profiler seems promising but all I can get is "% of runtime"... and I'd like an actual runtime.

    Read the article

  • How to edit an default Xcode template?

    - by HelloMoon
    When I create an NSObject subclass, I always get an empty implementation. There are some things I always put in my code like pragma marks and -dealloc methods. I prefer to just delete stuff that I don't need over writing it with typos from scratch every time I need it. I need -dealloc and -init almost always, but they don't ship with the default template. Is there a way to customize what's in there?

    Read the article

  • Xcode: Display Login View in applicationDidBecomeActive

    - by Patrick
    In my app I would like to show a login screen - which will be displayed when the app starts and when the app becomes active. For reference, I am using storyboards, ARC and it is a tabbed bar application. First off, I have this method which returns the topViewController. - (UIViewController *)topViewController:(UIViewController *)rootViewController { if (rootViewController.presentedViewController == nil) { return rootViewController; } if ([rootViewController.presentedViewController isMemberOfClass:[UINavigationController class]]) { UINavigationController *navigationController = (UINavigationController *)rootViewController.presentedViewController; UIViewController *lastViewController = [[navigationController viewControllers] lastObject]; return [self topViewController:lastViewController]; } UIViewController *presentedViewController = (UIViewController *)rootViewController.presentedViewController; return [self topViewController:presentedViewController]; } And I call this method here: - (void)applicationDidBecomeActive:(UIApplication *)application { if ( ... ) { // if the user needs to login PasswordViewController *passwordView = [[PasswordViewController alloc] init]; UIViewController *myView = [self topViewController:self.window.rootViewController]; [myView presentModalViewController:passwordView animated:NO]; } } To an extent this does work - I can call a method in viewDidAppear which shows an alert view to allow the user to log in. However, this is undesirable and I would like to have a login text box and other ui elements. If I do not call my login method, nothing happens and the screen stays black, even though I have put a label and other elements on the view. Does anyone know a way to resolve this? My passcode view is embedded in a Navigation Controller, but is detached from the main storyboard.

    Read the article

  • using string to read file - XCode

    - by Fernando
    The following does not work and gives me a SIGABRT when I run in the debugger: std::ifstream inFile; inFile.open("/Users/fernandonewyork/inputText.txt"); cout << inFile << endl; vector<string> inText; if (inFile) { string s4; while (inFile>>s4) { inText.push_back(s4); } } inFile.close(); The following does: std::ifstream inFile; inFile.open("/Users/fernandonewyork/inputText.txt"); cout << inFile << endl; vector<string> inText; if (inFile) { string s4("This is no lnger an empty string"); while (inFile>>s4) { inText.push_back(s4); } } inFile.close(); I was under the impression I was able to simply use s4 without having to worry about any space considerations, or is something else happening here? This is the full error I get from the top code: malloc: * error for object 0x100010a20: pointer being freed was not allocated * set a breakpoint in malloc_error_break to debug Program received signal: “SIGABRT”.

    Read the article

  • iPhone xcode - Activity Indicator with tab bar controller and multi table view controllers

    - by Frames84
    I've looked for a tutorial and can't seem to find one for a activity indicator in a table view nav bar. in my mainWindow.xib I have a Tab Bar Controller with 4 Tabs controllers each containing a table view. each load JSON feeds using the framework hosted at Google. In one of my View Controller I can add an activity indicator to the nav bar by using: UIActivityIndicatorView *activityIndcator = [[UIActivityIndicatorView alloc] initWithFrame:CGRectMake(0,0,20,20)]; [activityIndcator startAnimating]; UIBarButtonItem *activityItem = [[UIBarButtonItem alloc] initWithCustomView:activityIndcator]; self.navigationItem.rightBarButtonItem = activityItem; however and can turn it off by using: self.navigationItem.rightBarButtonItem.enabled = FALSE; But if i place this in my viewDidLoad event it shows all the time. I only want it to show when I select a row in my table view. so I added it at the top of didSelectRowAtIndexPath and the stop line after I load a feed. it shows but takes a second or two and only shows for about half a second. is the an event that firers before the didSelectRowAtIndexPath event a type of loading event? if not what is the standard menthord for implementing such functionality?

    Read the article

  • Xcode best audio practices

    - by Zachary Webert
    What is the best practice for creating an audio prompt within my app, which will append different portions of audio together to ask a question? ex. "What is" + "foo"? "What is" + "bar"? I have developed a "AudioQueue" object using audiotool box which uses AudioServicesPlaySystemSound() and it is working perfectly. Is there anything wrong with playing this type of audio through the alert system. If so what are my alternatives?? Thank you

    Read the article

  • Preprocess strings file during Xcode build

    - by stigi
    Hello, I know there's a way to preprocess my info.plist file, but is there a similar way to process strings files inside my Settings.bundle? My problem: I have an iPhone app and I want the the user to know about the currently installed version. I do this by displaying it in the apps settings. Now every time i change the bundle version in my info.plist i also have to change the version in the Root.strings in the Settings.bundle. I could run a script action that updates it, but it would be nice to use the preprocessor since I could do even more fun things with it. Thanks!

    Read the article

  • Three20 Library Cannot find its own headers Xcode iPhone

    - by DieLaughing
    import "Three20/Three20.h" Fails. Go download it and build a sample app. If that works, then make a new app from the templates provided, then watch as it fails spectacularly to find the right HEADER_SEARCH_PATH. 1) I've gone to the info page for the TARGET and not the PROJECT (Well, I tried both) and tried a bunch of different paths for the HEADER_SEARCH_PATH field. 2) I've tried dragging and dropping the dependent files from the finder and COPYING or just referencing both fails. (RANT: WTF?! Really? I wish public code libraries saved me time ONCE in my life.)

    Read the article

  • XCode enum woes

    - by Raconteur
    Hi gang, I thought I had this sorted, but I am still missing something. Very simply, I have a Settings class that hold a DAO (sitting on a plist). I want to have a couple of enums for the settings for convenience and readability, such as GamePlayType and DifficultyLevel. Right now I am defining them in the Settings.h file above the @interface line as such: typedef enum { EASY, NORMAL, HARD } DifficultyLevel; and typedef enum { SET_NUMBER_OF_MOVES, TO_COMPLETION } GamePlayType; If I access them from within the Settings class like: - (int)gridSizeForLOD { switch ([self difficultyLevel]) { case EASY: return GRID_SIZE_EASY; case NORMAL: return GRID_SIZE_NORMAL; case HARD: return GRID_SIZE_HARD; default: return GRID_SIZE_NORMAL; } } everything is fine. But, if I try to access them outside of the Settings class, let's say in my main view controller class, like this: if (([settings gameType] == SET_NUMBER_OF_MOVES) && (numMoves == [settings numMovesForLOD])) { [self showLoseScreen]; } I get errors (like EXC_BAD_ACCESS) or the condition always fails. Am I doing something incorrectly? Also, I should point out that I have this code for the call to gameType (which lives in the Settings class): - (GamePlayType)gameType { return [dao gameType]; } and the DAO implements gameType like this: - (int)gameType { return (settingsContent != nil) ? [[settingsContent objectForKey:@"Game Type"] intValue] : 0; } I know I have the DAO returning an int instead of a GamePlayType, but A) the problem I am describing arose there when I tried to use the "proper" data type, and B) I did not think it would matter since the enum is just a bunch of named ints, right? Any help, greatly appreciated. I really want to understand this thoroughly, and something is eluding me... Cheers, Chris

    Read the article

  • xcode scripting language

    - by PurplePilot
    i notice that Java has a number of ancillary scripting languages. Clojure and Groovy for example. My understanding is that these can be used when the full might and power of Java does not need to be applied and a speedy cludge can be hacked in Groovy/Clojure. But at the end of the day the scripting tools contribution gets compiled into the application Question 1) Is there a similar scripting in x-code? I was not so interested in Python or Ruby in this situation as they are languages in their own right added in, as indeed i think can happen in Java, but i was looking for a purpose built tools. Question 2) If there is such a tool would it count the application out vis-a-vis the new Apple guidelines as to what can be used to generate iXxx apps?

    Read the article

< Previous Page | 14 15 16 17 18 19 20 21 22 23 24 25  | Next Page >