Search Results

Search found 3754 results on 151 pages for 'ios simulator'.

Page 54/151 | < Previous Page | 50 51 52 53 54 55 56 57 58 59 60 61  | Next Page >

  • Modify audio pitch of recorded clip (m4v)

    - by devcube
    I'm writing an app in which I'm trying to change the pitch of the audio when I'm recording a movie (.m4v). Or by modifying the audio pitch of the movie afterwards. I want the end result to be a movie (.m4v) that has the original length (i.e. same visual as original) but with modified sound pitch, e.g. a "chipmunk voice". A realtime conversion is to prefer if possible. I've read alot about changing audio pitch in iOS but most examples focus on playback, i.e. playing the sound with a different pitch. In my app I'm recording a movie (.m4v / AVFileTypeQuickTimeMovie) and saving it using standard AVAssetWriter. When saving the movie I have access to the following elements where I've tried to manipulate the audio (e.g. modify the pitch): audio buffer (CMSampleBufferRef) audio input writer (AVAssetWriterAudioInput) audio input writer options (e.g. AVNumberOfChannelsKey, AVSampleRateKey, AVChannelLayoutKey) asset writer (AVAssetWriter) I've tried to hook into the above objects to modify the audio pitch, but without success. I've also tried with Dirac as described here: Real Time Pitch Change In iPhone Using Dirac And OpenAL with AL_PITCH as described here: Piping output from OpenAL into a buffer And the "BASS" library from un4seen: Change Pitch/Tempo In Realtime I haven't found success with any of the above libs, most likely because I don't really know how to use them, and where to hook them into the audio saving code. There seems to be alot of librarys that have similar effects but focuses on playback or custom recording code. I want to manipulate the audio stream I've already got (AVAssetWriterAudioInput) or modify the saved movie clip (.m4v). I want the video to be unmodifed visually, i.e. played at the same speed. But I want the audio to go faster (like a chipmunk) or slower (like a ... monster? :)). Do you have any suggestions how I can modify the pitch in either real time (when recording the movie) or afterwards by converting the entire movie (.m4v file)? Should I look further into Dirac, OpenAL, SoundTouch, BASS or some other library? I want to be able to share the movie to others with modified audio, that's the reason I can't rely on modifying the pitch for playback only. Any help is appreciated, thanks!

    Read the article

  • GLKit Memory Leak copywithZone

    - by TommyT39
    Running the instruments utility against the game I'm writing shows a bunch of memory leaks related to copy with Zone when I cycle through an array and draw some simple cube objects. Im not sure the best way to track this down as I'm new to OpenGL programming. My program is using ARC and is set to build for IOS 5. I am initializing GLKit to use OPenGl 2.0 and using the BafeEffect so I don't have to write my own shaders etc.. This shouldn't be rocket science. Im guessing that I must be not releasing something within the draw function. Below is the code to my draw function. Could you guys take a look and see if anything stands out as the problem? One other thing to note is that I'm using 15 different textures, the cubes can be 1 of 15 different ones. I have a property set on the cube class for the texture and I set it as I create the cube in there array. But I do load all 15 when my programs view did load starts.They are small .jps files that are less than 75k each and each cube uses the same texture all the way around so shouldn't be too big of an issue. Here is the code to my draw function: - (void)draw { GLKMatrix4 xRotationMatrix = GLKMatrix4MakeXRotation(rotation.x); GLKMatrix4 yRotationMatrix = GLKMatrix4MakeYRotation(rotation.y); GLKMatrix4 zRotationMatrix = GLKMatrix4MakeZRotation(rotation.z); GLKMatrix4 scaleMatrix = GLKMatrix4MakeScale(scale.x, scale.y, scale.z); GLKMatrix4 translateMatrix = GLKMatrix4MakeTranslation(position.x, position.y, position.z); GLKMatrix4 modelMatrix = GLKMatrix4Multiply(translateMatrix,GLKMatrix4Multiply(scaleMatrix,GLKMatrix4Multiply(zRotationMatrix, GLKMatrix4Multiply(yRotationMatrix, xRotationMatrix)))); GLKMatrix4 viewMatrix = GLKMatrix4MakeLookAt(0, 0, 1, 0, 0, -5, 0, 1, 0); effect.transform.modelviewMatrix = GLKMatrix4Multiply(viewMatrix, modelMatrix); effect.transform.projectionMatrix = GLKMatrix4MakePerspective(0.125*M_TAU, 1.0, 2, 0); effect.texture2d0.name = wallTexture.name; [effect prepareToDraw]; glEnable(GL_DEPTH_TEST); glEnable(GL_CULL_FACE); glEnableVertexAttribArray(GLKVertexAttribPosition); glVertexAttribPointer(GLKVertexAttribPosition, 3, GL_FLOAT, GL_FALSE, 0, triangleVertices); glEnableVertexAttribArray(GLKVertexAttribTexCoord0); glVertexAttribPointer(GLKVertexAttribTexCoord0, 2, GL_FLOAT, GL_FALSE, 0, textureCoordinates); glDrawArrays(GL_TRIANGLES, 0, 18); glDisableVertexAttribArray(GLKVertexAttribPosition); glDisableVertexAttribArray(GLKVertexAttribTexCoord0); }

    Read the article

  • Memory issues - Living vs. overall -> app is killed

    - by D33
    I'm trying to check my applications memory issues in Instruments. When I load the application I play some sounds and show some animations in UIImageViews. To save some memory I load the sounds only when I need it and when I stop playing it I free it from the memory. problem 1: My application is using about 5.5MB of Living memory. BUT The Overall section is growing after start to 20MB and then it's slowly growing (about 100kB/sec). But responsible Library is OpenAL (OAL::Buffer), dyld (_dyld_start)-I am not sure what this really is, and some other stuff like ft_mem_qrealloc, CGFontStrikeSetValue, … problem 2: When the overall section breaks about 30MB, application crashes (is killed). According to the facts I already read about overall memory, it means then my all allocations and deallocation is about 30MB. But I don't really see the problem. When I need some sound for example I load it to the memory and when I don't need it anymore I release it. But that means when I load 1MB sound, this operation increase overall memory usage with 2MB. Am I right? And when I load 10 sounds my app crashes just because the fact my overall is too high even living is still low??? I am very confused about it. Could someone please help me clear it up? (I am on iOS 5 and using ARC) SOME CODE: creating the sound OpenAL: MYOpenALSound *sound = [[MyOpenALSound alloc] initWithSoundFile:filename willRepeat:NO]; if(!sound) return; [soundDictionary addObject:sound]; playing: [sound play]; dispatch_after(dispatch_time(DISPATCH_TIME_NOW, ((sound.duration * sound.pitch) + 0.1) * NSEC_PER_SEC), dispatch_get_current_queue(), ^{ [soundDictionary removeObjectForKey:[NSNumber numberWithInt:soundID]]; }); } creating the sound with AVAudioPlayer: [musics replaceObjectAtIndex:ID_MUSIC_MAP withObject:[[Music alloc] initWithFilename:@"mapMusic.mp3" andWillRepeat:YES]]; pom = [musics objectAtIndex:musicID]; [pom playMusic]; and stop and free it: [musics replaceObjectAtIndex:ID_MUSIC_MAP withObject:[NSNull null]]; AND IMAGE ANIMATIONS: I load images from big PNG file (this is realated also to my other topic : Memory warning - UIImageView and its animations) I have few UIImageViews and by time I'm setting animation arrays to play Animations... UIImage *source = [[UIImage alloc] initWithCGImage:[[UIImage imageNamed:@"imageSource.png"] CGImage]]; cutRect = CGRectMake(0*dimForImg.width,1*dimForImg.height,dimForImg.width,dimForImg.height); image1 = [[UIImage alloc] initWithCGImage:CGImageCreateWithImageInRect([source CGImage], cutRect)]; cutRect = CGRectMake(1*dimForImg.width,1*dimForImg.height,dimForImg.width,dimForImg.height); ... image12 = [[UIImage alloc] initWithCGImage:CGImageCreateWithImageInRect([source CGImage], cutRect)]; NSArray *images = [[NSArray alloc] initWithObjects:image1, image2, image3, image4, image5, image6, image7, image8, image9, image10, image11, image12, image12, image12, nil]; and this array I just use simply like : myUIImageView.animationImages = images, ... duration -> startAnimating

    Read the article

  • What alternatives do I have for source control and does GIT does that?

    - by RubberDuck
    I work as a freelancer programmer for some clients and also create apps for myself. When I work for myself, obviously I work alone. I generally don't work in a linear way. My big problems today are: I have a lot of apps that use the same classes I have developed; In the past, I put all these common classes on a directory outside all projects and included them on my apps using absolute paths, but this method sucks because by accident (if you forget) you may change a path or the disk and all projects are broken. Then I decided to copy those classes to my projects every time. Because the majority of these classes do not change frequently, I am relatively ok, but when they change, I am in hell; When I change one of these classes I have to propagate the changes to all other apps using copies of them. I have also tried to create frameworks but thanks to Apple, I cannot create frameworks for iOS and have to create libraries and bundles and create a nightmare of paths from one to the other and to the project to make that sh!t works. So, I am done with frameworks/libraries on Xcode until Xcode is a decent IDE. So, I see I need something better to manage my source code. What I need is this (I never used GIT on Xcode. I have read Apple docs but I still have these points): does git locally on Xcode allows me to deal with assets or just code? Can I have the equivalent of a "framework" (code + assets) managed by git locally? Can an entire xcodeproj be managed as a unity? I mean, Suppose I have a xcodeproj created and want GIT to manage it. How do I enable git on a project that was created without it and start designating files for management. (I have enabled git on Xcode's preferences, but all source control menu is grayed out). Is git the best option? Do I have another? Remember that my main condition is that the files should stay on the local computer. Please save me (I am a bit dramatic today). Thanks.

    Read the article

  • iPad web app: Prevent input focus AFTER ajax call

    - by Mike Barwick
    So I've read around and can't for the life of me figure out of to solve my issue effectively. In short, I have a web app built for the iPad - which works as it should. However, I have an Ajax form which also submits as it should. But, after the callback and I clear/reset my form, the "iPad" automatically focuses on an input and opens the keyboard again. This is far from ideal. I managed to hack my way around it, but it's still not perfect. The code below is run on my ajax callback, which works - except there's still a flash of the keyboard quickly opening and closing. Note, my code won't work unless I use setTimeout. Also, from my understanding, document.activeElement.blur(); only works when there's a click event, so I triggered one via js. IN OTHER WORDS, HOW DO I PREVENT THE KEYBOARD FROM REOPENING AFTER AJAX CALL ON WEB APP? PS: Ajax call works fine and doesn't open the keyboard in Safari on the iPad, just web app mode. Here's my code: hideKeyboard: function () { // iOS web app only, iPad IS_IPAD = navigator.userAgent.match(/iPad/i) != null; if (IS_IPAD) { $(window).one('click', function () { document.activeElement.blur(); }); setTimeout(function () { $(window).trigger('click'); }, 500); } } Maybe it's related to how I'm clearing my forms, so here's that code. Note, all inputs have tabindex="-1" as well. clearForm: function () { // text, textarea, etc $('#campaign-form-wrap > form')[0].reset(); // checkboxes $('input[type="checkbox"]').removeAttr('checked'); $('#campaign-form-wrap > form span.custom.checkbox').removeClass('checked'); // radio inputs $('input[type="radio"]').removeAttr('checked'); $('#campaign-form-wrap > form span.custom.radio').removeClass('checked'); // selects $('form.custom .user-generated-field select').each(function () { var selection = $(this).find('option:first').text(), labelFor = $(this).attr('name'), label = $('[for="' + labelFor + '"]'); label.find('.selection-choice').html(selection); }); optin.hideKeyboard(); }

    Read the article

  • GKSession sendDataToAllPeers getting invalid parameter

    - by cb4
    This is my first post and I wanted to start it by thanking the many stackoverflow contributors who will never know how much they helped me out these past several days as I worked to complete my first iOS app. I am indebted to them and to this site for giving them a place to post. To 'pay off' some of that debt, I hope this will help others as I have been helped... So, my app uses the GKPeerPickerController to make a connection to a 2nd device. Once connected, the devices can send text messages to each other. The receiving peer has the message displayed in a UIAlertView. Everything was working fine. Then I decided to experiment with locations and added code to get the current location. I convert it into latitude & longitude in degrees, minutes, and seconds and put them into one NSString. I added a button to my storyboard called 'Send Location' which, when tapped, sends the location to the connected peer. This is where I ran into the problem. Both the send text and send location methods call the sendPacket method with a NSString. sendPacket converts the string to NSData and calls sendDataToAllPeers. When I learned how to capture the error, it was "Invalid parameter for - sendDataToAllPeers:withDataMode:error:". [.....pause.....] Well, this was going to be a question but in writing all this to explain the problem, the answer just dawned on me. Did a few tests and verified it now works. The issue was not in sendDataToAllPeers, it was in the conversion of the NSString (strToSend) to NSData: packet = [strToSend dataUsingEncoding:NSASCIIStringEncoding]; Specifically, it was the degree sign character (little circle, ASCII 176). NSASCIIStringEncoding only includes ASCII characters up to 127 so don't use any above that. I'm sure there was a quicker way to find the problem, but I don't know Objective-C or Xcode's debugging facility well enough yet. Whew! Several hours to discover that little tidbit. I did learn a lot, though, and that's always a good thing!

    Read the article

  • Weird order when painting triangle outlines using GL_LINE_STRIP

    - by RayDeeA
    I'm developing an app for iOS-Plaftorms using OpenGL. Currently I'm having a weird issue when painting a plane (terrain) which consists of multiple subplanes, where each subplane consists of 2 triangles forming a rect. I'm painting this terrain as a wireframe by using a call to glDrawElements and provide the parameters GL_Line_Strip and the precalculated indices. The problem is that the triangles get painted in the wrong order or are rather vertically mirrored. They do not get painted in the order how I specified the indices, which is confusing. This is the simplified code to generate the vertices: for(NSInteger y = - gridSegmentsY / 2; y < gridSegmentsY / 2; y ++) { for(NSInteger x = - gridSegmentsX / 2; x < gridSegmentsX / 2; x ++) { vertices[pos++] = x * 5; vertices[pos++] = y * 5; vertices[pos++] = 0; } } This is how I generate the indices including degenerated ones (To use as IBO). pos = 0; for(int y = 0; y < gridSegmentsY - 1; y ++) { if (y > 0) { // Degenerate begin: repeat first vertex indices[pos++] = (unsigned short)(y * gridSegmentsY); } for(int x = 0; x < gridSegmentsX; x++) { // One part of the strip indices[pos++] = (unsigned short)((y * gridSegmentsY) + x); indices[pos++] = (unsigned short)(((y + 1) * gridSegmentsY) + x); } if (y < gridSegmentsY - 2) { // Degenerate end: repeat last vertex indices[pos++] = (unsigned short)(((y + 1) * gridSegmentsY) + (gridSegmentsX - 1)); } } So in this part... indices[pos++] = (unsigned short)((y * gridSegmentsY) + x); indices[pos++] = (unsigned short)(((y + 1) * gridSegmentsY) + x); ...I'm setting the first index in the indices array to point to the current (x,y) and the next index to (x,y+1). I'm doin' this for all x's in the current strip, then I'm handling degenerated triangles and repeat this procedure for the next strip (y+1). This method is taken from http://www.learnopengles.com/android-lesson-eight-an-introduction-to-index-buffer-objects-ibos/ So I expect the resulting mesh to get painted like: a----b----c | /| /| | / | / | | / | / | |/ |/ | d----e----f | /| /| | / | / | | / | / | |/ |/ | g----h----i by painting it as described using: glDrawElements(GL_LINE_STRIP, indexCount, GL_UNSIGNED_SHORT, 0); ...since I expect GL_Line_Strip to paint first a line from (a-d), then from (d-b), then (b, e)... and so on (as specified in the indices calculation) But what actually gets painted is: *----*----* |\ |\ | | \ | \ | | \ | \ | | \| \| *----*----* |\ |\ | | \ | \ | | \ | \ | | \| \| *----*----* So the triangles are somehow painted in the wrong order and I need to know why? ;). Does somebody know? Does the problem lie in using GL_Line_Strip or is there a bug in my code? My eye is at (0.0f, 0.0f, 20.0f) and looks at (0,0,0). The mesh is painted along the x-axis & y-axis from left to right with z = 0, so the mesh should not be flipped or anything.

    Read the article

  • Implementing ZBar QR Code Reader in UIView

    - by Bobster4300
    I really need help here. I'm pretty new to iOS/Objective-C so sorry if the problem resolution is obvious or if my code is terrible. Be easy on me!! :-) I'm struggling to integrate ZBarSDK for reading QR Codes into an iPad app i'm building. If I use ZBarReaderController (of which there are plenty of tutorials and guides on implementing), it works fine. However I want to make the camera come up in a UIView as opposed to the fullscreen camera. Now I have gotten as far as making the camera view (readerView) come up in the UIView (ZBarReaderView) as expected, but I get an error when it scans a code. The error does not come up until a code is scanned making me believe this is either delegate related or something else. Here's the important parts of my code: (ZBarSDK.h is imported at the PCH file) SignInViewController.h #import <UIKit/UIKit.h> #import <AVFoundation/AVFoundation.h> @class AVCaptureSession, AVCaptureDevice; @interface SignInViewController : UIViewController < ZBarReaderDelegate > { ZBarReaderView *readerView; UITextView *resultText; } @property (nonatomic, retain) UIImagePickerController *imgPicker; @property (strong, nonatomic) IBOutlet UITextView *resultText; @property (strong, nonatomic) IBOutlet ZBarReaderView *readerView; -(IBAction)StartScan:(id) sender; SignInViewController.m #import "SignInViewController.h" @interface SignInViewController () @end @implementation SignInViewController @synthesize resultText, readerView; -(IBAction)StartScan:(id) sender { readerView = [ZBarReaderView new]; readerView.readerDelegate = self; readerView.tracksSymbols = NO; readerView.frame = CGRectMake(30,70,230,230); readerView.torchMode = 0; readerView.device = [self frontFacingCameraIfAvailable]; ZBarImageScanner *scanner = readerView.scanner; [scanner setSymbology: ZBAR_I25 config: ZBAR_CFG_ENABLE to: 0]; [self relocateReaderPopover:[self interfaceOrientation]]; [readerView start]; [self.view addSubview: readerView]; resultText.hidden=NO; } - (void) readerControllerDidFailToRead: (ZBarReaderController*) reader withRetry: (BOOL) retry{ NSLog(@"the image picker failing to read"); } - (void) imagePickerController: (UIImagePickerController*) reader didFinishPickingMediaWithInfo: (NSDictionary*) info { NSLog(@"the image picker is calling successfully %@",info); id<NSFastEnumeration> results = [info objectForKey: ZBarReaderControllerResults]; ZBarSymbol *symbol = nil; NSString *hiddenData; for(symbol in results) hiddenData=[NSString stringWithString:symbol.data]; NSLog(@"the symbols is the following %@",symbol.data); resultText.text=symbol.data; NSLog(@"BARCODE= %@",symbol.data); NSLog(@"SYMBOL : %@",hiddenData); resultText.text=hiddenData; } The error I get when a code is scanned: 2012-12-16 14:28:32.797 QRTestApp[7970:907] -[SignInViewController readerView:didReadSymbols:fromImage:]: unrecognized selector sent to instance 0x1e88b1c0 2012-12-16 14:28:32.799 QRTestApp[7970:907] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[SignInViewController readerView:didReadSymbols:fromImage:]: unrecognized selector sent to instance 0x1e88b1c0' I'm not too worried about what happens with the results just yet, just want to get over this error. Took me ages just to get the camera to come up in the UIView due to severe lack of tutorial or documentation on ZBarReaderView (for beginners anyway). Thanks all.

    Read the article

  • NSMutableArray memory leak when reloading objects

    - by Davin
    I am using Three20/TTThumbsviewcontroller to load photos. I am struggling since quite a some time now to fix memory leak in setting photosource. I am beginner in Object C & iOS memory management. Please have a look at following code and suggest any obvious mistakes or any errors in declaring and releasing variables. -- PhotoViewController.h @interface PhotoViewController : TTThumbsViewController <UIPopoverControllerDelegate,CategoryPickerDelegate,FilterPickerDelegate,UISearchBarDelegate>{ ...... NSMutableArray *_photoList; ...... @property(nonatomic,retain) NSMutableArray *photoList; -- PhotoViewController.m @implementation PhotoViewController .... @synthesize photoList; ..... - (void)LoadPhotoSource:(NSString *)query:(NSString *)title:(NSString* )stoneName{ NSLog(@"log- in loadPhotosource method"); if (photoList == nil) photoList = [[NSMutableArray alloc] init ]; [photoList removeAllObjects]; @try { sqlite3 *db; NSFileManager *fileMgr = [NSFileManager defaultManager]; NSString* documentsPath = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0]; NSString *dbPath = [documentsPath stringByAppendingPathComponent: @"DB.s3db"]; BOOL success = [fileMgr fileExistsAtPath:dbPath]; if(!success) { NSLog(@"Cannot locate database file '%@'.", dbPath); } if(!(sqlite3_open([dbPath UTF8String], &db) == SQLITE_OK)) { NSLog(@"An error has occured."); } NSString *_sql = query;//[NSString stringWithFormat:@"SELECT * FROM Products where CategoryId = %i",[categoryId integerValue]]; const char *sql = [_sql UTF8String]; sqlite3_stmt *sqlStatement; if(sqlite3_prepare(db, sql, -1, &sqlStatement, NULL) != SQLITE_OK) { NSLog(@"Problem with prepare statement"); } if ([stoneName length] != 0) { NSString *wildcardSearch = [NSString stringWithFormat:@"%@%%",[stoneName stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]]]; sqlite3_bind_text(sqlStatement, 1, [wildcardSearch UTF8String], -1, SQLITE_STATIC); } while (sqlite3_step(sqlStatement)==SQLITE_ROW) { NSString* urlSmallImage = @"Mahallati_NoImage.png"; NSString* urlThumbImage = @"Mahallati_NoImage.png"; NSString *designNo = [NSString stringWithUTF8String:(char *) sqlite3_column_text(sqlStatement,2)]; designNo = [designNo stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]]; NSString *desc = [NSString stringWithUTF8String:(char *) sqlite3_column_text(sqlStatement,7)]; desc = [desc stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]]; NSString *caption = designNo;//[designNo stringByAppendingString:desc]; caption = [caption stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]]; NSString *smallFilePath = [documentsPath stringByAppendingPathComponent: [NSString stringWithFormat:@"Small%@.JPG",designNo] ]; smallFilePath = [smallFilePath stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]]; if ([fileMgr fileExistsAtPath:smallFilePath]){ urlSmallImage = [NSString stringWithFormat:@"Small%@.JPG",designNo]; } NSString *thumbFilePath = [documentsPath stringByAppendingPathComponent: [NSString stringWithFormat:@"Thumb%@.JPG",designNo] ]; thumbFilePath = [thumbFilePath stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]]; if ([fileMgr fileExistsAtPath:thumbFilePath]){ urlThumbImage = [NSString stringWithFormat:@"Thumb%@.JPG",designNo]; } NSNumber *photoProductId = [NSNumber numberWithInt:(int)sqlite3_column_int(sqlStatement, 0)]; NSNumber *photoPrice = [NSNumber numberWithInt:(int)sqlite3_column_int(sqlStatement, 6)]; char *productNo1 = sqlite3_column_text(sqlStatement, 3); NSString* productNo; if (productNo1 == NULL) productNo = nil; else productNo = [NSString stringWithUTF8String:productNo1]; Photo *jphoto = [[[Photo alloc] initWithCaption:caption urlLarge:[NSString stringWithFormat:@"documents://%@",urlSmallImage] urlSmall:[NSString stringWithFormat:@"documents://%@",urlSmallImage] urlThumb:[NSString stringWithFormat:@"documents://%@",urlThumbImage] size:CGSizeMake(123, 123) productId:photoProductId price:photoPrice description:desc designNo:designNo productNo:productNo ] autorelease]; [photoList addObject:jphoto]; [jphoto release]; } } @catch (NSException *exception) { NSLog(@"An exception occured: %@", [exception reason]); } self.photoSource = [[[MockPhotoSource alloc] initWithType:MockPhotoSourceNormal title:[NSString stringWithFormat: @"%@",title] photos: photoList photos2:nil] autorelease]; } Memory leaks happen when calling above LoadPhotosource method again with different query... I feel its something wrong in declaring NSMutableArray (photoList), but can't figure out how to fix memory leak. Any suggestion is really appreciated.

    Read the article

  • How to balance this Pokémon simulator metagame by feedback?

    - by Dokkat
    This is a Pokémon simulator where you build a team of 6 pokémon and battle with someone. Unfortunately, some Pokémon are stronger than others and only a few of the hundredth species are practical. I'm trying to create a metagame where all of them are competitive. For this, I am tagging a Pokémon with a parameter (level) that changes it's strength and scales up/down depending on the it's performance. That is, if the system detects Mewtwo is overperforming, it should decrease it's level tag until Mewtwo is balanced. The question is: how can I identify if a Pokémon is causing an unbalance? The data I have is the historic of the battles (player 1, player 2, pokémon list, winner). The most basic solution I can think of is victory/loss counting.

    Read the article

  • how do you make a "concurrent queue safe" lazy loader (singleton manager) in objective-c

    - by Rich
    Hi, I made this class that turns any object into a singleton, but I know that it's not "concurrent queue safe." Could someone please explain to me how to do this, or better yet, show me the code. To be clear I want to know how to use this with operation queues and dispatch queues (NSOperationQueue and Grand Central Dispatch) on iOS. Thanks in advance, Rich EDIT: I had an idea for how to do it. If someone could confirm it for me I'll do it and post the code. The idea is that proxies make queues all on their own. So if I make a mutable proxy (like Apple does in key-value coding/observing) for any object that it's supposed to return, and always return the same proxy for the same object/identifier pair (using the same kind of lazy loading technique as I used to create the singletons), the proxies would automatically queue up the any messages to the singletons, and make it totally thread safe. IMHO this seems like a lot of work to do, so I don't want to do it if it's not gonna work, or if it's gonna slow my apps down to a crawl. Here's my non-thread safe code: RMSingletonCollector.h // // RMSingletonCollector.h // RMSingletonCollector // // Created by Rich Meade-Miller on 2/11/11. // Copyright 2011 Rich Meade-Miller. All rights reserved. // #import <Foundation/Foundation.h> #import "RMWeakObjectRef.h" struct RMInitializerData { // The method may take one argument. // required SEL designatedInitializer; // data to pass to the initializer or nil. id data; }; typedef struct RMInitializerData RMInitializerData; RMInitializerData RMInitializerDataMake(SEL initializer, id data); @interface NSObject (SingletonCollector) // Returns the selector and data to pass to it (if the selector takes an argument) for use when initializing the singleton. // If you override this DO NOT call super. + (RMInitializerData)designatedInitializerForIdentifier:(NSString *)identifier; @end @interface RMSingletonCollector : NSObject { } + (id)collectionObjectForType:(NSString *)className identifier:(NSString *)identifier; + (id<RMWeakObjectReference>)referenceForObjectOfType:(NSString *)className identifier:(NSString *)identifier; + (void)destroyCollection; + (void)destroyCollectionObjectForType:(NSString *)className identifier:(NSString *)identifier; @end // ==--==--==--==--==Notifications==--==--==--==--== extern NSString *const willDestroySingletonCollection; extern NSString *const willDestroySingletonCollectionObject; RMSingletonCollector.m // // RMSingletonCollector.m // RMSingletonCollector // // Created by Rich Meade-Miller on 2/11/11. // Copyright 2011 Rich Meade-Miller. All rights reserved. // #import "RMSingletonCollector.h" #import <objc/objc-runtime.h> NSString *const willDestroySingletonCollection = @"willDestroySingletonCollection"; NSString *const willDestroySingletonCollectionObject = @"willDestroySingletonCollectionObject"; RMInitializerData RMInitializerDataMake(SEL initializer, id data) { RMInitializerData newData; newData.designatedInitializer = initializer; newData.data = data; return newData; } @implementation NSObject (SingletonCollector) + (RMInitializerData)designatedInitializerForIdentifier:(NSString *)identifier { return RMInitializerDataMake(@selector(init), nil); } @end @interface RMSingletonCollector () + (NSMutableDictionary *)singletonCollection; + (void)setSingletonCollection:(NSMutableDictionary *)newSingletonCollection; @end @implementation RMSingletonCollector static NSMutableDictionary *singletonCollection = nil; + (NSMutableDictionary *)singletonCollection { if (singletonCollection != nil) { return singletonCollection; } NSMutableDictionary *collection = [[NSMutableDictionary alloc] initWithCapacity:1]; [self setSingletonCollection:collection]; [collection release]; return singletonCollection; } + (void)setSingletonCollection:(NSMutableDictionary *)newSingletonCollection { if (newSingletonCollection != singletonCollection) { [singletonCollection release]; singletonCollection = [newSingletonCollection retain]; } } + (id)collectionObjectForType:(NSString *)className identifier:(NSString *)identifier { id obj; NSString *key; if (identifier) { key = [className stringByAppendingFormat:@".%@", identifier]; } else { key = className; } if (obj = [[self singletonCollection] objectForKey:key]) { return obj; } // dynamic creation. // get a class for Class classForName = NSClassFromString(className); if (classForName) { obj = objc_msgSend(classForName, @selector(alloc)); // if the initializer takes an argument... RMInitializerData initializerData = [classForName designatedInitializerForIdentifier:identifier]; if (initializerData.data) { // pass it. obj = objc_msgSend(obj, initializerData.designatedInitializer, initializerData.data); } else { obj = objc_msgSend(obj, initializerData.designatedInitializer); } [singletonCollection setObject:obj forKey:key]; [obj release]; } else { // raise an exception if there is no class for the specified name. NSException *exception = [NSException exceptionWithName:@"com.RMDev.RMSingletonCollector.failed_to_find_class" reason:[NSString stringWithFormat:@"SingletonCollector couldn't find class for name: %@", [className description]] userInfo:nil]; [exception raise]; [exception release]; } return obj; } + (id<RMWeakObjectReference>)referenceForObjectOfType:(NSString *)className identifier:(NSString *)identifier { id obj = [self collectionObjectForType:className identifier:identifier]; RMWeakObjectRef *objectRef = [[RMWeakObjectRef alloc] initWithObject:obj identifier:identifier]; return [objectRef autorelease]; } + (void)destroyCollection { NSDictionary *userInfo = [singletonCollection copy]; [[NSNotificationCenter defaultCenter] postNotificationName:willDestroySingletonCollection object:self userInfo:userInfo]; [userInfo release]; // release the collection and set it to nil. [self setSingletonCollection:nil]; } + (void)destroyCollectionObjectForType:(NSString *)className identifier:(NSString *)identifier { NSString *key; if (identifier) { key = [className stringByAppendingFormat:@".%@", identifier]; } else { key = className; } [[NSNotificationCenter defaultCenter] postNotificationName:willDestroySingletonCollectionObject object:[singletonCollection objectForKey:key] userInfo:nil]; [singletonCollection removeObjectForKey:key]; } @end RMWeakObjectRef.h // // RMWeakObjectRef.h // RMSingletonCollector // // Created by Rich Meade-Miller on 2/12/11. // Copyright 2011 Rich Meade-Miller. All rights reserved. // // In order to offset the performance loss from always having to search the dictionary, I made a retainable, weak object reference class. #import <Foundation/Foundation.h> @protocol RMWeakObjectReference <NSObject> @property (nonatomic, assign, readonly) id objectRef; @property (nonatomic, retain, readonly) NSString *className; @property (nonatomic, retain, readonly) NSString *objectIdentifier; @end @interface RMWeakObjectRef : NSObject <RMWeakObjectReference> { id objectRef; NSString *className; NSString *objectIdentifier; } - (RMWeakObjectRef *)initWithObject:(id)object identifier:(NSString *)identifier; - (void)objectWillBeDestroyed:(NSNotification *)notification; @end RMWeakObjectRef.m // // RMWeakObjectRef.m // RMSingletonCollector // // Created by Rich Meade-Miller on 2/12/11. // Copyright 2011 Rich Meade-Miller. All rights reserved. // #import "RMWeakObjectRef.h" #import "RMSingletonCollector.h" @implementation RMWeakObjectRef @dynamic objectRef; @synthesize className, objectIdentifier; - (RMWeakObjectRef *)initWithObject:(id)object identifier:(NSString *)identifier { if (self = [super init]) { NSString *classNameForObject = NSStringFromClass([object class]); className = classNameForObject; objectIdentifier = identifier; objectRef = object; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(objectWillBeDestroyed:) name:willDestroySingletonCollectionObject object:object]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(objectWillBeDestroyed:) name:willDestroySingletonCollection object:[RMSingletonCollector class]]; } return self; } - (id)objectRef { if (objectRef) { return objectRef; } objectRef = [RMSingletonCollector collectionObjectForType:className identifier:objectIdentifier]; return objectRef; } - (void)objectWillBeDestroyed:(NSNotification *)notification { objectRef = nil; } - (void)dealloc { [[NSNotificationCenter defaultCenter] removeObserver:self]; [className release]; [super dealloc]; } @end

    Read the article

  • Is there an alternative to SDL 1.3 for a C++ game that should run on iOS and Android?

    - by futlib
    I've used SDL for many desktop games, always as the cross-platform glue for: Creating a window Processing input Rendering images Rendering fonts Playing sounds/music It has never disappointed me at those tasks. But when it comes to graphics, I prefer to work with the OpenGL API directly, even though all of our games are 2D. In the project I'm currently working on, I've made sure to only use the API subset supported by both OpenGL 1.3 and OpenGL 1.0, so making the thing run on Android should be easy, I thought. Turns out there is no official Android or iOS port of SDL yet. However, there's one in SDL 1.3, which is still in development. SDL 1.3 doesn't seem very appealing to me for three reasons: It's been in development for at least 4 years, and I have no idea when it will be done, not to mention stable. It's not ported to as many platforms as SDL 1.2. From what I've seen, it uses OpenGL for drawing, so I suppose the community will move away from directly using OpenGL. So I'm wondering if I should use a different library for our current project - it doesn't matter much if I need to port my existing code from SDL 1.2 to SDL 1.3 or to some other library. We're planning to release on Windows, Mac OS X, Linux, iOS and Android, so good support for these platforms is essential. Is there anything stable that does what I want?

    Read the article

  • Multiple errors while adding searching to app

    - by Thijs
    Hi, I'm fairly new at iOS programming, but I managed to make a (in my opinion quite nice) app for the app store. The main function for my next update will be a search option for the app. I followed a tutorial I found on the internet and adapted it to fit my app. I got back quite some errors, most of which I managed to fix. But now I'm completely stuck and don't know what to do next. I know it's a lot to ask, but if anyone could take a look at the code underneath, it would be greatly appreciated. Thanks! // // RootViewController.m // GGZ info // // Created by Thijs Beckers on 29-12-10. // Copyright 2010 __MyCompanyName__. All rights reserved. // #import "RootViewController.h" // Always import the next level view controller header(s) #import "CourseCodes.h" @implementation RootViewController @synthesize dataForCurrentLevel, tableViewData; #pragma mark - #pragma mark View lifecycle // OVERRIDE METHOD - (void)viewDidLoad { [super viewDidLoad]; // Go get the data for the app... // Create a custom string that points to the right location in the app bundle NSString *pathToPlist = [[NSBundle mainBundle] pathForResource:@"SCSCurriculum" ofType:@"plist"]; // Now, place the result into the dictionary property // Note that we must retain it to keep it around dataForCurrentLevel = [[NSDictionary dictionaryWithContentsOfFile:pathToPlist] retain]; // Place the top level keys (the program codes) in an array for the table view // Note that we must retain it to keep it around // NSDictionary has a really useful instance method - allKeys // The allKeys method returns an array with all of the keys found in (this level of) a dictionary tableViewData = [[[dataForCurrentLevel allKeys] sortedArrayUsingSelector:@selector(caseInsensitiveCompare:)] retain]; //Initialize the copy array. copyListOfItems = [[NSMutableArray alloc] init]; // Set the nav bar title self.title = @"GGZ info"; //Add the search bar self.tableView.tableHeaderView = searchBar; searchBar.autocorrectionType = UITextAutocorrectionTypeNo; searching = NO; letUserSelectRow = YES; } /* - (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]; } */ //RootViewController.m - (void) searchBarTextDidBeginEditing:(UISearchBar *)theSearchBar { searching = YES; letUserSelectRow = NO; self.tableView.scrollEnabled = NO; //Add the done button. self.navigationItem.rightBarButtonItem = [[[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone target:self action:@selector(doneSearching_Clicked:)] autorelease]; } - (NSIndexPath *)tableView :(UITableView *)theTableView willSelectRowAtIndexPath:(NSIndexPath *)indexPath { if(letUserSelectRow) return indexPath; else return nil; } //RootViewController.m - (void)searchBar:(UISearchBar *)theSearchBar textDidChange:(NSString *)searchText { //Remove all objects first. [copyListOfItems removeAllObjects]; if([searchText length] &gt; 0) { searching = YES; letUserSelectRow = YES; self.tableView.scrollEnabled = YES; [self searchTableView]; } else { searching = NO; letUserSelectRow = NO; self.tableView.scrollEnabled = NO; } [self.tableView reloadData]; } //RootViewController.m - (void) searchBarSearchButtonClicked:(UISearchBar *)theSearchBar { [self searchTableView]; } - (void) searchTableView { NSString *searchText = searchBar.text; NSMutableArray *searchArray = [[NSMutableArray alloc] init]; for (NSDictionary *dictionary in listOfItems) { NSArray *array = [dictionary objectForKey:@"Countries"]; [searchArray addObjectsFromArray:array]; } for (NSString *sTemp in searchArray) { NSRange titleResultsRange = [sTemp rangeOfString:searchText options:NSCaseInsensitiveSearch]; if (titleResultsRange.length &gt; 0) [copyListOfItems addObject:sTemp]; } [searchArray release]; searchArray = nil; } //RootViewController.m - (void) doneSearching_Clicked:(id)sender { searchBar.text = @""; [searchBar resignFirstResponder]; letUserSelectRow = YES; searching = NO; self.navigationItem.rightBarButtonItem = nil; self.tableView.scrollEnabled = YES; [self.tableView reloadData]; } //RootViewController.m - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { if (searching) return 1; else return [listOfItems count]; } // Customize the number of rows in the table view. - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { if (searching) return [copyListOfItems count]; else { //Number of rows it should expect should be based on the section NSDictionary *dictionary = [listOfItems objectAtIndex:section]; NSArray *array = [dictionary objectForKey:@"Countries"]; return [array count]; } } - (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section { if(searching) return @""; if(section == 0) return @"Countries to visit"; else return @"Countries visited"; } // 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] initWithFrame:CGRectZero reuseIdentifier:CellIdentifier] autorelease]; } // Set up the cell... if(searching) cell.text = [copyListOfItems objectAtIndex:indexPath.row]; else { //First get the dictionary object NSDictionary *dictionary = [listOfItems objectAtIndex:indexPath.section]; NSArray *array = [dictionary objectForKey:@"Countries"]; NSString *cellValue = [array objectAtIndex:indexPath.row]; cell.text = cellValue; } return cell; } - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { //Get the selected country NSString *selectedCountry = nil; if(searching) selectedCountry = [copyListOfItems objectAtIndex:indexPath.row]; else { NSDictionary *dictionary = [listOfItems objectAtIndex:indexPath.section]; NSArray *array = [dictionary objectForKey:@"Countries"]; selectedCountry = [array objectAtIndex:indexPath.row]; } //Initialize the detail view controller and display it. DetailViewController *dvController = [[DetailViewController alloc] initWithNibName:@"DetailView" bundle:[NSBundle mainBundle]]; dvController.selectedCountry = selectedCountry; [self.navigationController pushViewController:dvController animated:YES]; [dvController release]; dvController = nil; } //RootViewController.m - (void) searchBarTextDidBeginEditing:(UISearchBar *)theSearchBar { //Add the overlay view. if(ovController == nil) ovController = [[OverlayViewController alloc] initWithNibName:@"OverlayView" bundle:[NSBundle mainBundle]]; CGFloat yaxis = self.navigationController.navigationBar.frame.size.height; CGFloat width = self.view.frame.size.width; CGFloat height = self.view.frame.size.height; //Parameters x = origion on x-axis, y = origon on y-axis. CGRect frame = CGRectMake(0, yaxis, width, height); ovController.view.frame = frame; ovController.view.backgroundColor = [UIColor grayColor]; ovController.view.alpha = 0.5; ovController.rvController = self; [self.tableView insertSubview:ovController.view aboveSubview:self.parentViewController.view]; searching = YES; letUserSelectRow = NO; self.tableView.scrollEnabled = NO; //Add the done button. self.navigationItem.rightBarButtonItem = [[[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone target:self action:@selector(doneSearching_Clicked:)] autorelease]; } // Override to allow orientations other than the default portrait orientation. - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { // Return YES for supported orientations. return YES; } - (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 { [dataForCurrentLevel release]; [tableViewData release]; [super dealloc]; } #pragma mark - #pragma mark Table view methods // DATA SOURCE METHOD - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { return 1; } // DATA SOURCE METHOD - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { // How many rows should be displayed? return [tableViewData count]; } // DELEGATE METHOD - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { // Cell reuse block static NSString *CellIdentifier = @"Cell"; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; if (cell == nil) { cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease]; } // Configure the cell's contents - we want the program code, and a disclosure indicator cell.textLabel.text = [tableViewData objectAtIndex:indexPath.row]; cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator; return cell; } //RootViewController.m - (void)searchBar:(UISearchBar *)theSearchBar textDidChange:(NSString *)searchText { //Remove all objects first. [copyListOfItems removeAllObjects]; if([searchText length] &gt; 0) { [ovController.view removeFromSuperview]; searching = YES; letUserSelectRow = YES; self.tableView.scrollEnabled = YES; [self searchTableView]; } else { [self.tableView insertSubview:ovController.view aboveSubview:self.parentViewController.view]; searching = NO; letUserSelectRow = NO; self.tableView.scrollEnabled = NO; } [self.tableView reloadData]; } //RootViewController.m - (void) doneSearching_Clicked:(id)sender { searchBar.text = @""; [searchBar resignFirstResponder]; letUserSelectRow = YES; searching = NO; self.navigationItem.rightBarButtonItem = nil; self.tableView.scrollEnabled = YES; [ovController.view removeFromSuperview]; [ovController release]; ovController = nil; [self.tableView reloadData]; } // DELEGATE METHOD - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { // In any navigation-based application, you follow the same pattern: // 1. Create an instance of the next-level view controller // 2. Configure that instance, with settings and data if necessary // 3. Push it on to the navigation stack // In this situation, the next level view controller is another table view // Therefore, we really don't need a nib file (do you see a CourseCodes.xib? no, there isn't one) // So, a UITableViewController offers an initializer that programmatically creates a view // 1. Create the next level view controller // ======================================== CourseCodes *nextVC = [[CourseCodes alloc] initWithStyle:UITableViewStylePlain]; // 2. Configure it... // ================== // It needs data from the dictionary - the "value" for the current "key" (that was tapped) NSDictionary *nextLevelDictionary = [dataForCurrentLevel objectForKey:[tableViewData objectAtIndex:indexPath.row]]; nextVC.dataForCurrentLevel = nextLevelDictionary; // Set the view title nextVC.title = [tableViewData objectAtIndex:indexPath.row]; // 3. Push it on to the navigation stack // ===================================== [self.navigationController pushViewController:nextVC animated:YES]; // Memory manage it [nextVC release]; } /* // Override to support conditional editing of the table view. - (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath { // Return NO if you do not want the specified item to be editable. return YES; } */ /* // Override to support editing the table view. - (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath { if (editingStyle == UITableViewCellEditingStyleDelete) { // Delete the row from the data source. [tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationFade]; } else if (editingStyle == UITableViewCellEditingStyleInsert) { // Create a new instance of the appropriate class, insert it into the array, and add a new row to the table view. } } */ /* // Override to support rearranging the table view. - (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)fromIndexPath toIndexPath:(NSIndexPath *)toIndexPath { } */ /* // Override to support conditional rearranging of the table view. - (BOOL)tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath { // Return NO if you do not want the item to be re-orderable. return YES; } */ @end

    Read the article

  • chdir warning when opening .tar file on OS X

    - by denonth
    I need to unarchive a file to the /Developer folder. Install Qt for iOS SDK The Qt for iOS SDK has been configured to be installed in the default Xcode installation location /Developer. It is not possible to install the SDK into another location without first rebuilding it, as the install location is contained within the qmake executable, and that is built as part of Qt. To install the Qt for iOS SDK, open ‘Terminal’ and type the following from the command­-line: tar –xf qt­-everywhere-­ios­-4.8.0­-xxx.tar.gz –C /Developer (where xxx is an identifier which can be used to determine the build of the iOS SDK eg. arm7-­-nossl) This will install the Qt for iOS SDK into the following path: /Developer/Platforms/iPhoneOS.platform/Developer/usr/share/qt­-everywhere­-ios­-4.8.0 When I perform the operation I get the information: Lions-Mac:Documents User$ tar -xf qt-everywhere-ios-4.8.0-arm7-nossl.tar.gz -C /Developer tar: could not chdir to '/Developer' Any idea what is wrong?

    Read the article

  • From the Tips Box: Life after Babel Fish, Hidden Features in iOS apps, and Finding Clean Beaches with a Smartphone

    - by Jason Fitzpatrick
    Once a week we round up some of the great reader tips that come pouring in and share them with everyone. This week we’re looking at Bing’s absorbtion of Babelfish, hidden features in iOS apps, and how to find a clean beach with your smartphone. HTG Explains: What Is RSS and How Can I Benefit From Using It? HTG Explains: Why You Only Have to Wipe a Disk Once to Erase It HTG Explains: Learn How Websites Are Tracking You Online

    Read the article

  • WWDC : Apple dévoile Metal, une nouvelle bibliothèque graphique pour améliorer les performances de rendu CPU sur les périphériques iOS

    WWDC : Apple dévoile Metal, une nouvelle bibliothèque graphique Son but est d'améliorer les performances de rendu sur CPU pour les périphériques sous iOSDurant la conférence WWDC 2014 (Apple Worldwide Developers Conference), Apple a annoncé une nouvelle bibliothèque graphique bas niveau à l'image de Mantle, appelée Metal. Le but est de drastiquement améliorer les performances de rendu sur CPU, pour les périphériques sous iOS. À cette occasion, Apple a travaillé avec Epic Games afin de produire...

    Read the article

  • AppDays Paris : Windows Phone, iOS et Android à l'honneur de la conférence des développeurs d'applications mobiles en novembre

    AppDays : les développeurs d'applications mobiles ont leur conférence Windows Phone, iOS et Android à l'honneur le 9 novembre « Applification du web », montée en puissance des galeries d'applications mobiles, augmentation des performances des OS mobiles. Autant de signes qui montrent que l'avenir du développement ne passera peut-être pas que par les Smartphones et les tablettes, mais qu'il passera immanquablement par eux. Des applications très pro (comme celles de SAP, l'éditeur allemand qui a bien saisi l'importance de cette tendance de fond) aux jeux les plus réalistes (comme Infinite Flight, un vrai simulateur d...

    Read the article

  • Un quart de milliard de smartphones vendus au troisième trimestre, Android et iOS peinent à gagner des parts pendant que Windows Phone progresse

    Un quart de milliard de smartphones vendus au troisième trimestre, Android et iOS peinent à gagner des parts pendant que Windows Phone progresse Les rapports de vente de smartphones au troisième trimestre de l'année en cours se multiplient. Cette fois-ci, c'est l'entreprise indépendante d'analyse Canalys qui révèle à son tour une augmentation annuelle de 44% du marché. Cette proportion représente un quart de milliards de dispositifs écoulés en un trimestre sur la planète. Sans surprise,...

    Read the article

  • Caching with AVPlayer and AVAssetExportSession

    - by tba
    I would like to cache progressive-download videos using AVPlayer. How can I save an AVPlayer's item to disk? I'm trying to use AVAssetExportSession on the player's currentItem (which is fully loaded). This code is giving me "AVAssetExportSessionStatusFailed (The operation could not be completed)" : AVAsset *mediaAsset = self.player.currentItem.asset; AVAssetExportSession *es = [[AVAssetExportSession alloc] initWithAsset:mediaAsset presetName:AVAssetExportPresetLowQuality]; NSString *outPath = [NSTemporaryDirectory() stringByAppendingPathComponent:@"out.mp4"]; NSFileManager *fileManager = [NSFileManager defaultManager]; [fileManager removeItemAtPath:outPath error:NULL]; es.outputFileType = @"com.apple.quicktime-movie"; es.outputURL = [[[NSURL alloc] initFileURLWithPath:outPath] autorelease]; NSLog(@"exporting to %@",outPath); [es exportAsynchronouslyWithCompletionHandler:^{ NSString *status = @""; if( es.status == AVAssetExportSessionStatusUnknown ) status = @"AVAssetExportSessionStatusUnknown"; else if( es.status == AVAssetExportSessionStatusWaiting ) status = @"AVAssetExportSessionStatusWaiting"; else if( es.status == AVAssetExportSessionStatusExporting ) status = @"AVAssetExportSessionStatusExporting"; else if( es.status == AVAssetExportSessionStatusCompleted ) status = @"AVAssetExportSessionStatusCompleted"; else if( es.status == AVAssetExportSessionStatusFailed ) status = @"AVAssetExportSessionStatusFailed"; else if( es.status == AVAssetExportSessionStatusCancelled ) status = @"AVAssetExportSessionStatusCancelled"; NSLog(@"done exporting to %@ status %d = %@ (%@)",outPath,es.status, status,[[es error] localizedDescription]); }]; How can I export successfully? I'm looking into copying mediaAsset into an AVMutableComposition, but haven't had much luck with that either. Thanks! PS: Here are some questions from people trying to accomplish the same thing (but with MPMoviePlayerController): Cache Progressive downloaded content in MPMoviePlayerController Simultaneously stream and save a video? Caching videos to disk after successful preload by MPMoviePlayerController

    Read the article

  • Zebra (ZSDK_API) 1.1.5266 Issue in XCode 4.6

    - by Poisydon
    Basically I'm having this error after I import the Zebra library in Xcode 4.6 Undefined symbols for architecture armv7: "_OBJC_CLASS_$_Linea", referenced from: objc-class-ref in libZSDK_API.a(LineaBtPrinterConnection.o) (maybe you meant: _OBJC_CLASS_$_LineaBtPrinterConnection) ld: symbol(s) not found for architecture armv7 clang: error: linker command failed with exit code 1 (use -v to see invocation) was wondering if anyone have encountered this issue with this version (1.1.5266) of the ZSDK_API. if anyone knows how to fix this, please post your instructions. My Thanks.

    Read the article

  • Animating the offset of the scrollView in a UICollectionView/UITableView causes prematurely disappearing cells

    - by radutzan
    We have a UICollectionView with a custom layout very similar to UITableView (it scrolls vertically). The UICollectionView displays only 3 cells simultaneously, with one of them being the currently active cell: [ 1 ] [*2*] [ 3 ] (The active cell here is #2.) The cells are roughly 280 points high, so only the active cell is fully visible on the screen. The user doesn't directly scroll the view to navigate, instead, she swipes the active cell horizontally to advance to the next cell. We then do some fancy animations and scroll the UICollectionView so the next cell is in the "active" position, thus making it the active one, moving the old one away and bringing up the next cell in the queue: [ 2 ] [*3*] [ 4 ] The problem here is setting the UICollectionView's offset. We currently set it in a UIView animation block (self.collectionView.contentOffset = targetOffset;) along with three other animating properties, which mostly works great, but causes the first cell (the previously active one, in the latter case, #2) to vanish as soon as the animation starts running, even before the delay interval completes. This is definitely not ideal. I've thought of some solutions, but can't figure out the best one: Absurdly enlarge the UICollectionView's frame to fit five cells instead of three, thus forcing it to keep the cells in memory even if they are offscreen. I've tried this and it works, but it sounds like an awfully dirty hack. Take a snapshot of the rendered content of the vanishing cell, put it in a UIImageView, add the UIImageView as a subview of the scrollView just before the cell goes away in the exact same position of the old cell, removing it once the animation ends. Sounds less sucky than the previous option (memory-wise, at least), but still kinda hacky. I also don't know the best way to accomplish this, please point me in the right direction. Switch to UIScrollView's setContentOffset:animated:. We actually used to have this, and it fixed the disappearing cell issue, but running this in parallel with the other UIView animations apparently competes for the attention of the main thread, thus creating a terribly choppy animation on single-core devices (iPhone 3GS/4). It also doesn't allow us to change the duration or easing of the animation, so it feels out of sync with the rest. Still an option if we can find a way to make it work in harmony with the UIView block animations. Switch to UICollectionView's scrollToItemAtIndexPath:atScrollPosition:animated:. Haven't tried this, but it has a big downside: it only takes 3 possible constants (that apply to this case, at least) for the target scroll position: UICollectionViewScrollPositionTop, UICollectionViewScrollPositionCenteredVertically and UICollectionViewScrollPositionBottom. The active cell could vary its height, but it always has to be 35 points from the top of the window, and these options don't provide enough control to accomplish the design. It could also potentially be just as problematic as 3.1. Still an option because there might be a way to go around the scroll position thing that I don't know of, and it might not have the same issue with the main thread, which seems unlikely. Any help will be greatly appreciated. Please ask if you need clarification. Thanks a lot!

    Read the article

  • MPNowPlayingInfoCenter defaultCenter will not update or retrieve information

    - by Jayson Lane
    I'm working to update the MPNowPlayingInfoCenter and having a bit of trouble. I've tried quite a bit to the point where I'm at a loss. The following is my code: self.audioPlayer.allowsAirPlay = NO; Class playingInfoCenter = NSClassFromString(@"MPNowPlayingInfoCenter"); if (playingInfoCenter) { NSMutableDictionary *songInfo = [[NSMutableDictionary alloc] init]; MPMediaItemArtwork *albumArt = [[MPMediaItemArtwork alloc] initWithImage:[UIImage imageNamed:@"series_placeholder"]]; [songInfo setObject:thePodcast.title forKey:MPMediaItemPropertyTitle]; [songInfo setObject:thePodcast.author forKey:MPMediaItemPropertyArtist]; [songInfo setObject:@"NCC" forKey:MPMediaItemPropertyAlbumTitle]; [songInfo setObject:albumArt forKey:MPMediaItemPropertyArtwork]; [[MPNowPlayingInfoCenter defaultCenter] setNowPlayingInfo:songInfo]; } This isn't working, I've also tried: [[MPNowPlayingInfoCenter defaultCenter] setNowPlayingInfo:nil]; In an attempt to get it to remove the existing information from the iPod app (or whatever may have info there). In addition, just to see if I could find out the problem, I've tried retrieving the current information on app launch: NSDictionary *info = [[MPNowPlayingInfoCenter defaultCenter] nowPlayingInfo]; NSString *title = [info valueForKey:MPMediaItemPropertyTitle]; NSString *author = [info valueForKey:MPMediaItemPropertyArtist]; NSLog(@"Currently playing: %@ // %@", title, author); and I get Currently playing: (null) // (null) I've researched this quite a bit and the following articles explain it pretty thoroughly, however, I am still unable to get this working properly. Am I missing something? Would there be anything interfering with this? Is this a service something my app needs to register to access (didn't see this in any docs)? Apple's Docs Change lock screen background audio controls Now playing info ignored UPDATE: I've created a tutorial outlining how I was able to get this functioning properly: http://jaysonlane.net/tech-blog/2012/04/lock-screen-now-playing-with-mpnowplayinginfocenter/

    Read the article

  • Terminating app due to uncaught exception 'NSGenericException', reason: '*** Collection <CALayerArray: 0x66522e0> was mutated while being enumerated

    - by fahu
    some times my app crashed by showing * Collection was mutated while being enumerated . This is occurring in same line of code all the time.please help me on this issue. i stuck on this. the app is crashing at pushing view controller line of my code.but it is not frequent one. my error console Terminating app due to uncaught exception 'NSGenericException', reason: '* Collection CALayerArray: 0x1030c730 was mutated while being enumerated. "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" )' my code: - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { ServiceDetails *service=[[ServiceDetails alloc] initWithNibName:@"ServiceDetails" bundle:nil]; CompanyListingForm *list=[[CompanyListingForm alloc]initWithNibName:@"CompanyListingForm" bundle:nil]; [category_company_text resignFirstResponder]; if(viewHoldingTable) { [viewHoldingTable removeFromSuperview]; } if (category_clicked_flag==0) { if (location_or_cat_com==0) { NSMutableArray *get=[district_array objectAtIndex:indexPath.row]; locationid=[[get objectAtIndex:0]intValue]; [location_textfield resignFirstResponder]; location_textfield.text=[get objectAtIndex:1]; } else { if (draggingView) { [draggingView removeFromSuperview]; } if (viewHoldingTable) { [viewHoldingTable removeFromSuperview]; } NSMutableArray *get=[company_array objectAtIndex:indexPath.row]; category_company_text.text=[get objectAtIndex:1]; service.ida=[NSString stringWithFormat:@"%d",[[get objectAtIndex:0] intValue]]; service.idloc=[NSString stringWithFormat:@"%d",locationid]; [self.navigationController pushViewController:service animated:YES];//getting error at this point. //[emer release]; } } else { if (location_or_cat_com==0) { NSMutableArray *get=[district_array objectAtIndex:indexPath.row]; locationid=[[get objectAtIndex:0]intValue]; [location_textfield resignFirstResponder]; location_textfield.text=[get objectAtIndex:1]; } else { NSMutableArray *get=[category_array objectAtIndex:indexPath.row]; category_company_text.text=[get objectAtIndex:1]; int catid=[[get objectAtIndex:0]intValue]; list.IDForLoc=[NSString stringWithFormat:@"%d",locationid]; list.IDForCat=[NSString stringWithFormat:@"%d",catid]; list.companydetails=[get objectAtIndex:1]; [self.navigationController pushViewController:list animated:YES];//getting error at this point. } } [service release]; [list release]; }

    Read the article

  • Pinch gesture in QLPreviewController?

    - by Arne
    I am using the QLPreviewController in my project, but cannot use pinch gestures to zoom in. What do I need to set up first? This is how I create the view controller: - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { QLPreviewController *previewer = [[QLPreviewController alloc] init]; [previewer setDataSource:self]; [previewer setCurrentPreviewItemIndex:indexPath.row]; [[self navigationController] pushViewController:previewer animated:YES]; }

    Read the article

  • NSURLSession and amazon S3 uploads

    - by George Green
    I have an app which is currently uploading images to amazon S3. I have been trying to switch it from using NSURLConnection to NSURLSession so that the uploads can continue while the app is in the background! I seem to be hitting a bit of an issue. The NSURLRequest is created and passed to the NSURLSession but amazon sends back a 403 - forbidden response, if I pass the same request to a NSURLConnection it uploads the file perfectly. Here is the code that creates the response: NSString *requestURLString = [NSString stringWithFormat:@"http://%@.%@/%@/%@", BUCKET_NAME, AWS_HOST, DIRECTORY_NAME, filename]; NSURL *requestURL = [NSURL URLWithString:requestURLString]; NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:requestURL cachePolicy:NSURLRequestReloadIgnoringLocalAndRemoteCacheData timeoutInterval:60.0]; // Configure request [request setHTTPMethod:@"PUT"]; [request setValue:[NSString stringWithFormat:@"%@.%@", BUCKET_NAME, AWS_HOST] forHTTPHeaderField:@"Host"]; [request setValue:[self formattedDateString] forHTTPHeaderField:@"Date"]; [request setValue:@"public-read" forHTTPHeaderField:@"x-amz-acl"]; [request setHTTPBody:imageData]; And then this signs the response (I think this came from another SO answer): NSString *contentMd5 = [request valueForHTTPHeaderField:@"Content-MD5"]; NSString *contentType = [request valueForHTTPHeaderField:@"Content-Type"]; NSString *timestamp = [request valueForHTTPHeaderField:@"Date"]; if (nil == contentMd5) contentMd5 = @""; if (nil == contentType) contentType = @""; NSMutableString *canonicalizedAmzHeaders = [NSMutableString string]; NSArray *sortedHeaders = [[[request allHTTPHeaderFields] allKeys] sortedArrayUsingSelector:@selector(caseInsensitiveCompare:)]; for (id key in sortedHeaders) { NSString *keyName = [(NSString *)key lowercaseString]; if ([keyName hasPrefix:@"x-amz-"]){ [canonicalizedAmzHeaders appendFormat:@"%@:%@\n", keyName, [request valueForHTTPHeaderField:(NSString *)key]]; } } NSString *bucket = @""; NSString *path = request.URL.path; NSString *query = request.URL.query; NSString *host = [request valueForHTTPHeaderField:@"Host"]; if (![host isEqualToString:@"s3.amazonaws.com"]) { bucket = [host substringToIndex:[host rangeOfString:@".s3.amazonaws.com"].location]; } NSString* canonicalizedResource; if (nil == path || path.length < 1) { if ( nil == bucket || bucket.length < 1 ) { canonicalizedResource = @"/"; } else { canonicalizedResource = [NSString stringWithFormat:@"/%@/", bucket]; } } else { canonicalizedResource = [NSString stringWithFormat:@"/%@%@", bucket, path]; } if (query != nil && [query length] > 0) { canonicalizedResource = [canonicalizedResource stringByAppendingFormat:@"?%@", query]; } NSString* stringToSign = [NSString stringWithFormat:@"%@\n%@\n%@\n%@\n%@%@", [request HTTPMethod], contentMd5, contentType, timestamp, canonicalizedAmzHeaders, canonicalizedResource]; NSString *signature = [self signatureForString:stringToSign]; [request setValue:[NSString stringWithFormat:@"AWS %@:%@", self.S3AccessKey, signature] forHTTPHeaderField:@"Authorization"]; Then if I use this line of code: [NSURLConnection connectionWithRequest:request delegate:self]; It works and uploads the file, but if I use: NSURLSessionUploadTask *task = [self.session uploadTaskWithRequest:request fromFile:[NSURL fileURLWithPath:filePath]]; [task resume]; I get the forbidden error..!? Has anyone tried uploading to S3 with this and hit similar issues? I wonder if it is to do with the way the session pauses and resumes uploads, or it is doing something funny to the request..? One possible solution would be to upload the file to an interim server that I control and have that forward it to S3 when it is complete... but this is clearly not an ideal solution! Any help is much appreciated!! Thanks!

    Read the article

< Previous Page | 50 51 52 53 54 55 56 57 58 59 60 61  | Next Page >