Search Results

Search found 9025 results on 361 pages for 'quad core'.

Page 56/361 | < Previous Page | 52 53 54 55 56 57 58 59 60 61 62 63  | Next Page >

  • Unit Testing Model Classes that inherit from NSManagedObject

    - by Matt Baker
    So...I'm trying to get unit tests set up in my iPhone App but I'm having some issues. I'm trying to test my model classes but they inherit directly from NSManagedObject. I'm sure this is a problem but I don't know how to get around it. Everything is building and running as expected but I get this error when calling any method on the class I'm testing: Unknown.m:0:0 unrecognized selector sent to instance 0xc2b120 If I follow this structure (http://chanson.livejournal.com/115621.html) to create my object in my tests I end up with another error entirely but it still doesn't help me. Basically my question is this: how can I test a class that inherits from NSManagedObject?

    Read the article

  • How to configure the framesize using AudioUnit.framework on iOS

    - by Piperoman
    I have an audio app i need to capture mic samples to encode into mp3 with ffmpeg First configure the audio: /** * We need to specifie our format on which we want to work. * We use Linear PCM cause its uncompressed and we work on raw data. * for more informations check. * * We want 16 bits, 2 bytes (short bytes) per packet/frames at 8khz */ AudioStreamBasicDescription audioFormat; audioFormat.mSampleRate = SAMPLE_RATE; audioFormat.mFormatID = kAudioFormatLinearPCM; audioFormat.mFormatFlags = kAudioFormatFlagIsPacked | kAudioFormatFlagIsSignedInteger; audioFormat.mFramesPerPacket = 1; audioFormat.mChannelsPerFrame = 1; audioFormat.mBitsPerChannel = audioFormat.mChannelsPerFrame*sizeof(SInt16)*8; audioFormat.mBytesPerPacket = audioFormat.mChannelsPerFrame*sizeof(SInt16); audioFormat.mBytesPerFrame = audioFormat.mChannelsPerFrame*sizeof(SInt16); The recording callback is: static OSStatus recordingCallback(void *inRefCon, AudioUnitRenderActionFlags *ioActionFlags, const AudioTimeStamp *inTimeStamp, UInt32 inBusNumber, UInt32 inNumberFrames, AudioBufferList *ioData) { NSLog(@"Log record: %lu", inBusNumber); NSLog(@"Log record: %lu", inNumberFrames); NSLog(@"Log record: %lu", (UInt32)inTimeStamp); // the data gets rendered here AudioBuffer buffer; // a variable where we check the status OSStatus status; /** This is the reference to the object who owns the callback. */ AudioProcessor *audioProcessor = (__bridge AudioProcessor*) inRefCon; /** on this point we define the number of channels, which is mono for the iphone. the number of frames is usally 512 or 1024. */ buffer.mDataByteSize = inNumberFrames * sizeof(SInt16); // sample size buffer.mNumberChannels = 1; // one channel buffer.mData = malloc( inNumberFrames * sizeof(SInt16) ); // buffer size // we put our buffer into a bufferlist array for rendering AudioBufferList bufferList; bufferList.mNumberBuffers = 1; bufferList.mBuffers[0] = buffer; // render input and check for error status = AudioUnitRender([audioProcessor audioUnit], ioActionFlags, inTimeStamp, inBusNumber, inNumberFrames, &bufferList); [audioProcessor hasError:status:__FILE__:__LINE__]; // process the bufferlist in the audio processor [audioProcessor processBuffer:&bufferList]; // clean up the buffer free(bufferList.mBuffers[0].mData); //NSLog(@"RECORD"); return noErr; } With data: inBusNumber = 1 inNumberFrames = 1024 inTimeStamp = 80444304 // All the time same inTimeStamp, this is strange However, the framesize that i need to encode mp3 is 1152. How can i configure it? If i do buffering, that implies a delay, but i would like to avoid this because is a real time app. If i use this configuration, each buffer i get trash trailing samples, 1152 - 1024 = 128 bad samples. All samples are SInt16.

    Read the article

  • Display shift when adding rows to UITableView

    - by Kamchatka
    Hello, I have a UITableView displaying an underlying NSFetchedResultsController. When the fetchedResultsController is updated, - (void)controller:(NSFetchedResultsController *)controller didChangeObject:(id)anObject atIndexPath:(NSIndexPath *)indexPath forChangeType:(NSFetchedResultsChangeType)type newIndexPath:(NSIndexPath *)newIndexPath { is called. And the following is executed: case NSFetchedResultsChangeInsert: [tableView insertRowsAtIndexPaths:[NSArray arrayWithObject:shiftedIndexPath] withRowAnimation:UITableViewRowAnimationFade]; break; The cellForRowAtIndexPath is only called for the new line (which is logical) The problem is however that all the values displayed in the rows of the table view are shifted down. The first row displays its title. The second rows displays the first row's title. The third row the second row's title etc. If I repeat that, the third row will display the second's row title, the fourth the third row's title etc. I don't understand what can happen, especially because cellForRowAtIndexPath is only called for the new line (which is logical) and not for all these lines. Additionally, if I click on these lines which have the wrong title, it opens the right document (didSelectRowAtIndexPath works correctly with the indexPath) Any clue of what could happen? Thanks!

    Read the article

  • Rendering a Long Document on iPad

    - by benjismith
    I'm implementing a document viewer with highlighting/annotation capabilities for a custom document format on iPad. The documents are kind of long (100 to 200 pages, if printed on paper) and I've had a hard time finding the right approach. Here are the requirments: 1) Basic rich-text styling: control of left/right margins. Control of font name, size, foreground/background color, and line spacing. Bold, italics, underline, etc. 2) Selection and highlighting of arbitrary text regions (not limited to paragraph boundaries, like in Safari/UIWebView). 3) Customization of the Cut/Copy/Paste popup (what is that thing called anyhow? UIActionBar?) This is one of the essential requirements of the app. My first implementation was based on UIWebView. I just rendered the document as HTML with CSS for text styling. But I couldn't get the kind of text selection behavior I wanted (across paragraph boundaries) and the UIActionBar can't be customized from within UIWebView. So I started working on a javascript approach, faking the device text-selection behavior using JQuery to trap touch events and dynamically modifying the DOM to change the background color of selected regions of text. I built a fake UIActionBar control as a hidden DIV, positioning it and unhiding it whenever there was an active selection region. Not too shabby. The main problem is that it's SLOOOOOOOW. Scrolling through the document is nice and quick, but dynamically changing the DOM is not very snappy. Plus, I couldn't figure out how to recreate the magnifier loupe, so my fake text-selection GUI doesn't look quite the same as the native implementation. Also, I haven't yet implemented the communication bridge between the javascript layer and the objective-c layer (where the rest of the app lives), but it was shaping up to be a huge hassle. So I've been looking at CoreText, but there are precious few examples on the web. I spent a little time with this simple little demo: http://github.com/jonasschnelli/I7CoreTextExample/ It shows how to use CoreText to draw an NSAttributedText string into a UIView. But it has its own problems: It doesn't implement text-selection behavior, and it doesn't present a UIActionBar, so I don't have any idea how to make that happen. And, more importantly, it tries to draw the entire document all at once, with significant performance degradations for long documents. My documents can have thousands of paragraphs, and less than 1% of the document is ever on screen at a time. On the plus side, these documents already contain precise formatting information. I know the exact page-position of every line of text, so I don't need a layout engine. Does anyone know how to implement this sort of view using CoreText? I understand that a full-fledged implementation is overkill for a question like this, but I'm looking for a good CoreText example with a few basic requirements: 1) Precise layout & formatting control (using the formatting metrics and text styles I've already calculated). 2) Arbitrary selection of text. 3) Customization of the UIActionBar. 4) Efficient recycling of resources for off-screen objects. I'd be happy to implement my own recycling when text elements scroll off-screen, but wouldn't that require re-implementing UIScrollView? I'm brand-new to iPhone development, and still getting used to Objective-C, but I've been working in other languages (Java, C#, flex/actionscript, etc) for more than ten years, so I feel confident in my ability to get the work done, if only I had a better feel for the iPhone SDK and the common coding patterns for stuff like this. Is it just me, or does the SDK documentation really suck? Anyhow, thanks for your help!

    Read the article

  • NSMutableArray of NSString in CoreData(iPhone

    - by azia
    I have a class, which describe an object for parsing XML. This class contains NSStrings and NSMutableArrays of NSStrings.I want to store parsed data using CoreData. How should I write CoreData model to store such objects if there is no such data type like NSMutableArray? Is there any way?

    Read the article

  • Releasing instance if service not enabled?

    - by fuzzygoat
    I would just like to check if I have this right, I am creating an instance of CCLocationManager and then checking if location services are enabled. If it is not enabled I then report an error, release the instance and carry on, does that look/sound right? locationManager = [[CLLocationManager alloc] init]; BOOL supportsService = [locationManager locationServicesEnabled]; if(supportsService) { [locationManager setDelegate:self]; [locationManager setDistanceFilter:kCLDistanceFilterNone]; [locationManager setDesiredAccuracy:kCLLocationAccuracyBest]; [locationManager startUpdatingLocation]; } else { NSLog(@"Location services not enabled."); [locationManager release]; } ... ... ... more code cheers gary

    Read the article

  • Batch faulting in a to-many relationship for a collection of objects

    - by indragie
    Scenario: Let's say I have an entity called Author that has a to-many relationship called books to the Book entity (inverse relationship author). If I have an existing collection of Author objects, I want to fault in the books relationship for all of them in a single fetch request. Code This is what I've tried so far: NSArray *authors = ... // array of `Author` objects NSFetchRequest *fetchRequest = [NSFetchRequest fetchRequestWithEntityName:@"Book"]; fetchRequest.returnsObjectsAsFaults = NO; fetchRequest.predicate = [NSPredicate predicateWithFormat:@"author IN %@", authors]; Executing this fetch request does not result in the books relationship of the objects in the authors array being faulted in (inspected via logging). I've also tried doing the fetch request the other way around: NSArray *authors = ... // array of `Author` objects NSFetchRequest *fetchRequest = [NSFetchRequest fetchRequestWithEntityName:@"Author"]; fetchRequest.returnsObjectsAsFaults = NO; fetchRequest.predicate = [NSPredicate predicateWithFormat:@"SELF IN %@", authors]; fetchRequest.relationshipKeypathsForPrefetching = @[@"books"]; This doesn't fire the faults either. What's the appropriate way of going about doing this?

    Read the article

  • iPhone Audio Delay Line

    - by garylgsimpson
    I am looking into developing an audio delay line - external microphone to line out on the iPhone. Is there any sample code anyone could recommend? I have already been playing with SpeakHere and AurioTouch. AurioTouch is helpful although complex to sift through.

    Read the article

  • CATransaction: Layer Changes But Does Not Animate

    - by macinjosh
    I'm trying to animate part of UI in an iPad app when the user taps a button. I have this code in my action method. It works in the sense that the UI changes how I expect but it does not animate the changes. It simply immediately changes. I must be missing something: - (IBAction)someAction:(id)sender { UIViewController *aViewController = <# Get an existing UIViewController #>; UIView *viewToAnimate = aViewController.view; CALayer *layerToAnimate = viewToAnimate.layer; [CATransaction begin]; [CATransaction setAnimationDuration:1.0f]; CATransform3D rotateTransform = CATransform3DMakeRotation(0.3, 0, 0, 1); CATransform3D scaleTransform = CATransform3DMakeScale(0.10, 0.10, 0.10); CATransform3D positionTransform = CATransform3DMakeTranslation(24, 423, 0); CATransform3D combinedTransform = CATransform3DConcat(rotateTransform, scaleTransform); combinedTransform = CATransform3DConcat(combinedTransform, positionTransform); layerToAnimate.transform = combinedTransform; [CATransaction commit]; // rest of method... } I've tried simplifying the animation to just change the opacity (for example) and it still will not animate. The opacity just changes instantly. That leads me to believe something is not setup properly. Any clues would be helpful!

    Read the article

  • How to set a reference from one object to another?

    - by Tzur Gazit
    Hi, Imagine the obvious model of employees and departments, where each employee must refer to a single department, and each department may have none to many employees. For Employee I have a pointer to Department, and I set its value to the address of the object of the relevant Department. When I try to save the Employee I get an error: 2010-04-07 10:05:22.491 CoreData2[1112:207] * Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '* -[NSCFDictionary setObject:forKey:]: attempt to insert nil value (key: Department)' I tried, just for testing, to make the reference from Employee to Department optional, but I get the same result. I'm having my first steps in CoreData so please be as clear and simple as you can. Thanks, Tzur.

    Read the article

  • iPhone game audio and background music

    - by Boon
    Have a few questions related to adding sounds to my game, specifically intro music (for splash), background music (loop) and button event sounds. Hope you can share your knowledge on this. 1) Should I use compressed sounds or uncompressed sounds? Or perhaps a combination of the two? Are there any limitations on the iPhone hardware that I should be aware of -- for example, the ability to play multiple compressed sounds? 2) What's the best audio format for my purpose? 3) For background music, I am thinking of using AVAudioPlayer. For button event sounds, I am thinking of using AudioServicesPlaySystemSound, what do you think? 4) Any other issues I should be aware of? Thank you!

    Read the article

  • Reverting CoreData data

    - by ndg
    I have an NSTableView which is populated via a CoreData-backed NSArrayController. Users are able to edit any field they choose within the NSTableView. When they select the rows that they have modified and press a button, the data is sent to a third-party webservice. Provided the webservice accepts the updated values, I want to commit those values to my persistent store. If, however, the webservice returns an error (or simply fails to return), I want the edited fields to revert to their original values. To complicate matters, I have a number of other editable controls, backed by CoreData, which do not need to resort to this behaviour. I believe the solution to this problem revolves around the creation of a secondary Managed Object context, which I would use only for values edited within that particularly NSTableView. But I'm confused as to how the two MOC would interact with each other. What's the best solution to this problem?

    Read the article

  • predicate subquery to return items by matching tags

    - by user3411663
    I have a many-to-many relationship between two entities; Item and Tag. I'm trying to create a predicate to take the selectedItem and return a ranking of items based on how many similar tags they have. So far I've tried: NSPredicate *predicate = [NSPredicate predicateWithFormat:@"SUBQUERY(itemToTag, $item, $item in %@).@count > 0", selectedItem.itemToTag]; Any other iterations that have failed. It currently only returns the selectedItem in the list. I've found little on Subquery. Is there a guru out there that can help me refine this? Thanks in advance for the help!

    Read the article

  • EXC_BAD_ACCESS when trying to release an ABRecordRef

    - by synic
    I've got the following class that is a wrapper around an ABPerson (ABRecordRef): @interface Recipient : NSObject { ABRecordRef person; } - (id)initWithPerson:(ABRecordRef)person; @end @implementation - (id)initWithPerson:(ABRecordRef)_person { if(self = [super init]) person = CFRetain(_person); return self; } - (void)dealloc { if(person) CFRelease(person); [super dealloc]; } @end I've left some of the methods out, but they aren't relevant to this question. Everything works fine, except I get an EXC_BAD_ACCESS on the if(person) CFRelease(person); line. Why does this happen? I'm not calling CFRelease or CFRetain at all anywhere else in my app.

    Read the article

  • animate rotation

    - by Mike
    I'm trying to animate a rotation using CATransform3DMakeRotation, but the problem is once the animation is finished, the image goes back to its initial position, i.e back to zero. But I'd like to keep it where it finished rotating. How would I do that? edit What I'm trying to do is to create the same compass which comes with the new iPhone. Basically the locationmanager gives me new headings every few seconds (or several per second). Using the new heading and the timestamp, I was trying to get a smooth animation of the image but not getting anywhere. The only thing which seems to work is applying the transform directly, e.g. compassimage.layer.transform = CATransform3DMakeRotation(newHeading.trueHeading *M_PI/180,0,0,1.0): but that's not animated...

    Read the article

  • Optimal pixel format for drawing on iPhone?

    - by Felixyz
    Pretty simple question: when doing some pretty intense drawing with CoreGraphics on the iPhone, how can I specify the pixel format to get optimal performance? Is the format that I get from the context via UIGraphicsGetCurrentContext per definition the best one? I know that RGB565 is supposed to be the fastest to use in OpenGL. Does that go for CoreGraphics as well? General advice?

    Read the article

  • Disable animation when moving CALayers

    - by Sean Clark Hess
    The following code animates the movement, even though I didn't use beginAnimations:context. How do I get it to move without animating? This is a new iphone view project, and these are the only updates to it. // Implement viewDidLoad to do additional setup after loading the view, typically from a nib. - (void)viewDidLoad { [super viewDidLoad]; sublayer = [CALayer new]; sublayer.backgroundColor = [[UIColor redColor] CGColor]; sublayer.frame = CGRectMake(0, 0, 100, 100); [self.view.layer addSublayer:sublayer]; } - (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event { sublayer.position = [[touches anyObject] locationInView:self.view]; }

    Read the article

  • Drawing path by Bezier curves

    - by OgreSwamp
    Hello. I have a task - draw smooth curve input: set of points (they added in realtime) current solution: I use each 4 points to draw qubic Bezier curve (1 - strart, 2 and 3rd - control points, 4- end). End point of each curve is start point for the next one. problem: at the curves connection I often have "fracture" (angle) Can you tell me, how to connect my points more smooth? Thanks!

    Read the article

  • coredata using old file version on device

    - by Martin KS
    This is a follow on from my previous problems here. Resetting the simulator solved all my troubles before, and I've gone on to complete my App. I now have the exact same problem when installing the app onto my iPhone device. It picks up an old version of my database, which doesn't have the second entity in it, and crashes when I try to access the second entity: 2010-04-22 23:52:18.860 albumCloud[135:207] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '+entityForName: could not locate an NSManagedObjectModel for entity name 'Image'' 2010-04-22 23:52:18.874 albumCloud[135:207] Stack: ( 843263261, 825818644, 820669213, 20277, 844154820, 16985, 14633, 844473760, 844851728, 862896011, 843011267, 843009055, 860901832, 843738160, 843731504, 11547, 11500 ) terminate called after throwing an instance of 'NSException' I have two questions: 1) How on earth do I delete my app thoroughly enough from my phone that it removes the old data? (I've so far tried regular app deletion, deleting and then holding home and power for a reboot, cursing at and threatening the app while running it... everything) 2) How do I prevent this happening when my application is in the App store, and I for some reason decide that I want to add another entity to the store, or another attribute to the existing entities? is there an "if x doesn't exist then create it" method?

    Read the article

  • NSPredicate cause update editing to return NSFetchedResultsChangeDelete not NSFetchedResultsChangeUp

    - by Matthew Weiss
    I have predicate inside of - (NSFetchedResultsController *)fetchedResultsController in a standard way starting from the CoreDataBook example. NSPredicate *predicate = [NSPredicate predicateWithFormat:@"state=%@ && date = %@ && date < %@", @"1",fromDate,toDate]; [fetchRequest setPredicate:predicate]; This works fine however when editing an item, it returns with NSFetchedResultsChangeDelete not Update. When the main view returns, it is missing the item. If I restart the simulator the delete was not saved and the correct editing result is shown the the predicate working correctly. case NSFetchedResultsChangeDelete: [tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationFade]; break; I can confirm the behavior by commenting out the two predicate lines ONLY and then all works as it should correctly returning with the full set after editing and calling NSFetchedResultsChangeUpdate instead of NSFetchedResultsChangeDelete. I have read http://matteocaldari.it/2009/11/multiple-contexts-controllers-delegates-and-coredata-bug who reports similar behavior but I have not found a work around to my problem. I can

    Read the article

  • Does the type in this KVC validation method matter?

    - by dontWatchMyProfile
    For example, in the docs a KVC-style validation method is implemented like this: -(BOOL)validateAge:(id *)ioValue error:(NSError **)outError They used id* as the type for ioValue. Since that's not part of the method signature, I wonder if it would hurt to do something like: -(BOOL)validateAge:(NSNumber *)ioValue error:(NSError **)outError Is this still fine with KVC?

    Read the article

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