Search Results

Search found 71 results on 3 pages for 'moc'.

Page 1/3 | 1 2 3  | Next Page >

  • Qt moc failure without an error message

    - by Robert Parker
    So I'm pretty new to Qt, and I've just inherited a project from someone else who is also new to Qt. He isn't around this week btw. We are using Visual Studio 2008, and have the latest version of Qt installed(4.6.2). The project builds on my coworker's machine fine, and I can get the project from svn and build it directly. But under any other circumstances it refuses to build on my machine, and it doesn't give me much of an explanation why. Even if I just do a 'build clean' and then a 'build' it doesn't work. Any slight modification will make it fail. When I try to build the entire project I get the error message: 1Moc'ing MatrixTypeInterface.h... 1moc: Cannot create .\GeneratedFiles\Debug\moc_MatrixTypeInterface.cpp;.\GeneratedFiles\Debug\moc_matrixtypeinterface.cpp 1Project : error PRJ0019: A tool returned an error code from "Moc'ing MatrixTypeInterface.h..." The moc tool doesn't give any sort of error message as to why it isn't working, and I wasted most of yesterday trying to figure out why. I got the command that VS was using to call moc, and I entered in the command line myself. It didn't write anything to the screen. Any ideas?

    Read the article

  • Qt moc not error

    - by Robert Parker
    So I'm pretty new to Qt, and I've just inherited a project from someone else who is also new to Qt. He isn't around this week btw. We are using Visual Studio 2008, and have the latest version of Qt installed(4.6.2). The project builds on my coworker's machine fine, and I can get the project from svn and build it directly. But under any other circumstances it refuses to build on my machine, and it doesn't give me much of an explanation why. Even if I just do a 'build clean' and then a 'build' it doesn't work. Any slight modification will make it fail. When I try to build the entire project I get the error message: 1Moc'ing MatrixTypeInterface.h... 1moc: Cannot create .\GeneratedFiles\Debug\moc_MatrixTypeInterface.cpp;.\GeneratedFiles\Debug\moc_matrixtypeinterface.cpp 1Project : error PRJ0019: A tool returned an error code from "Moc'ing MatrixTypeInterface.h..." The moc tool doesn't give any sort of error message as to why it isn't working, and I wasted most of yesterday trying to figure out why. I got the command that VS was using to call moc, and I entered in the command line myself. It didn't write anything to the screen. Any ideas?

    Read the article

  • Office Communicator 2007 (MOC): How to make chat history visible to newcomers

    - by Thomas L Holaday
    How can someone who joins an existing Microsoft Communicator chat see the history of what has gone before? For example: Larry: [describes problem] Moe: [enhances problem] Curly: We should ask Shemp [Shemp joins] Shemp: What's going on in this thread? Is there any way for Shemp to see what Larry and Moe have already typed? I have tried copy-pasting the whole thing, but that invokes an error with no error message - possibly "too much text." Update: Is this functionality what Microsoft calls Group Chat, and requires a separate product?

    Read the article

  • Office Communicator 2007 (MOC): How to make chat history visible to newcomers

    - by Thomas L Holaday
    How can someone who joins an existing Microsoft Communicator chat see the history of what has gone before? For example: Larry: [describes problem] Moe: [enhances problem] Curly: We should ask Shemp [Shemp joins] Shemp: What's going on in this thread? Is there any way for Shemp to see what Larry and Moe have already typed? I have tried copy-pasting the whole thing, but that invokes an error with no error message - possibly "too much text."

    Read the article

  • qt moc.exe error

    - by kaycee
    i'm using QT Creator 1.3.1 and trying to compile, but get this error... please help me get rid of it mingw32-make[1]: Leaving directory `C:/Documents and Settings/eyalk/My Documents/My QT Projects/XML' mingw32-make: Leaving directory `C:/Documents and Settings/eyalk/My Documents/My QT Projects/XML' 'C:/Qt/2010.02.1/qt/bin\moc.exe' is not recognized as an internal or external command, operable program or batch file. mingw32-make[1]: *** [debug/moc_mainwindow.cpp] Error 1 mingw32-make: *** [debug] Error 2 Exited with code 2. Error while building project XML When executing build step 'Make'

    Read the article

  • Qt MOC Filename Collisions using multiple .pri files

    - by Skinniest Man
    In order to keep my Qt project somewhat organized (using Qt Creator), I've got one .pro file and multiple .pri files. Just recently I added a class to one of my .pri files that has the same filename as a class that already existed in a separate .pri file. The file structure and makefiles generated by qmake appear to be oblivious to the filename collision that ensues. The generated moc_* files all get thrown into the same subdirectory (either release or debug, depending) and one ends up overwriting the other. When I try to make the project, I get several warnings that look like this: Makefile.Release:318: warning: overriding commands for target `release/moc_file.cpp` And the project fails to link. Here is a simple example of what I'm talking about. Directory structure: + project_dir | + subdir1 | | - file.h | | - file.cpp | + subdir2 | | - file.h | | - file.cpp | - main.cpp | - project.pro | - subdir1.pri | - subdir2.pri Contents of project.pro: TARGET = project TEMPLATE = app include(subdir1.pri) include(subdir2.pri) SOURCES += main.cpp Contents of subdir1.pri: HEADERS += subdir1/file.h SOURCES += subdir1/file.cpp Contents of subdir2.pri: HEADERS += subdir2/file.h SOURCES += subdir2/file.cpp Is there a way to tell qmake to generate a system that puts the moc_* files from separate .pri files into separate subdirectories?

    Read the article

  • Problem with signals and slots

    - by Jen
    I am creating a class with custom slots in Qt: class CustomEdit : public QTextEdit { Q_OBJECT public: CustomEdit(QWidget* parent); public slots: void onTextChanged (); }; However, I'm getting thise linker error: undefined reference to 'vtable for CustomEdit' The documentation says: if you get compiler errors along the lines of "undefined reference to vtable for LcdNumber", you have probably forgotten to run the moc or to include the moc output in the link command. ... but it is not obvious what that means. Is there something I need to add to my class, or to the .pro file?

    Read the article

  • Broken Multithreading With Core Data

    - by spamguy
    This is a better-focused version of an earlier question that touches upon an entirely different subject from before. I am working on a Cocoa Core Data application with multiple threads. There is a Song and Artist; every Song has an Artist relation. There is a delegate code file not cited here; it more or less looks like the template XCode generates. I am far better working with the former technology than the latter, and any multithreading capability came from a Core Data template. When I'm doing all my ManagedObjectContext work in one method, I am fine. When I put fetch-or-insert-then-return-object work into a separate method, the application halts (but does not crash) at the new method's return statement, seen below. The new method even gets its own MOC to be safe, and it has not helped any. The result is one addition to Song and a halt after generating an Artist. I get no errors or exceptions, and I don't know why. I've debugged out the wazoo. My theory is that any errors occurring are in another thread, and the one I'm watching is waiting on something forever. What did I do wrong with getArtistObject: , and how can I fix it? Thanks. - (void)main { NSInteger songCount = 1; NSManagedObjectContext *moc = [[NSManagedObjectContext alloc] init]; [moc setPersistentStoreCoordinator:[[self delegate] persistentStoreCoordinator]]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(contextDidSave:) name:NSManagedObjectContextDidSaveNotification object:moc]; /* songDict generated here */ for (id key in songDict) { NSManagedObject *song = [NSEntityDescription insertNewObjectForEntityForName:@"Song" inManagedObjectContext:moc]; [song setValue:[songDictItem objectForKey:@"Name"] forKey:@"title"]; [song setValue:[self getArtistObject:(NSString *) [songDictItem objectForKey:@"Artist"]] forKey:@"artist"]; [songDictItem release]; songCount++; } NSError *error; if (![moc save:&error]) [NSApp presentError:error]; [[NSNotificationCenter defaultCenter] removeObserver:self name:NSManagedObjectContextDidSaveNotification object:moc]; [moc release], moc = nil; [[self delegate] importDone]; } - (NSManagedObject*) getArtistObject:(NSString*)theArtist { NSError *error = nil; NSManagedObjectContext *moc = [[NSManagedObjectContext alloc] init]; [moc setPersistentStoreCoordinator:[[self delegate] persistentStoreCoordinator]]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(contextDidSave:) name:NSManagedObjectContextDidSaveNotification object:moc]; NSFetchRequest *fetch = [[[NSFetchRequest alloc] init] autorelease]; NSEntityDescription *entityDescription = [NSEntityDescription entityForName:@"Artist" inManagedObjectContext:moc]; [fetch setEntity:entityDescription]; // object to be returned NSManagedObject *artistObject = [[NSManagedObject alloc] initWithEntity:entityDescription insertIntoManagedObjectContext:moc]; // set predicate (artist name) NSPredicate *pred = [NSPredicate predicateWithFormat:[NSString stringWithFormat:@"name = \"%@\"", theArtist]]; [fetch setPredicate:pred]; NSArray *response = [moc executeFetchRequest:fetch error:&error]; if (error) [NSApp presentError:error]; if ([response count] == 0) // empty resultset --> no artists with this name { [artistObject setValue:theArtist forKey:@"name"]; NSLog(@"%@ not found. Adding.", theArtist); return artistObject; } else return [response objectAtIndex:0]; } @end

    Read the article

  • Bad linking in Qt unit test -- missing the link to the moc file?

    - by dwj
    I'm trying to unit test a class that inherits QObject; the class itself is located up one level in my directory structure. When I build the unit test I get the standard unresolved errors if a class' MOC file cannot be found: test.obj : error LNK2001: unresolved external symbol "public: virtual void * __thiscall UnitToTest::qt_metacast(char const *)" (?qt_metacast@UnitToTest@@UAEPAXPBD@Z) + 2 missing functions The MOC file is created but appears to not be linking. I've been poking around SO, the web, and Qt's docs for quite a while and have hit a wall. How do I get the unit test to include the MOC file in the link? ==== My project file is dead simple: TEMPLATE = app TARGET = test DESTDIR = . CONFIG += qtestlib INCLUDEPATH += . .. DEPENDPATH += . HEADERS += test.h SOURCES += test.cpp ../UnitToTest.cpp stubs.cpp DEFINES += UNIT_TEST My directory structure and files: C:. | UnitToTest.cpp | UnitToTest.h | \---test | test.cpp (Makefiles removed for clarity) | test.h | test.pro | stubs.cpp | +---debug | UnitToTest.obj | test.obj | test.pdb | moc_test.cpp | moc_test.obj | stubs.obj Edit: Additional information The generated Makefile.Debug shows the moc file missing: SOURCES = test.cpp \ ..\test.cpp \ stubs.cpp debug\moc_test.cpp OBJECTS = debug\test.obj \ debug\UnitToTest.obj \ debug\stubs.obj \ debug\moc_test.obj

    Read the article

  • exc_bad_access on insertNewObjectForEntityForName:inManagedObjectContext

    - by matthewc
    I have a garbage collected Cocoa application built on 10.5 frameworks. In an NSOperation In a loop I am quickly creating hundreds of NSManagedObjects. Frequently the creation of those NSManagedObejcts will crash with a exc_bad_access error. for (offsetCount; offsetCount < [parsedData count]; offsetCount++) { NSManagedObject *child = [NSEntityDescription insertNewObjectForEntityForName:@"Thread" inManagedObjectContext:[self moc]]; Thumbnail *thumb = [Thumbnail insertInManagedObjectContext:[self moc]]; Image *image = [Image insertInManagedObjectContext:[self moc]]; ... } Thumbnail and Image are both subclasses of NSManagedObject generated with mogenerator. insertInManagedObjectContext: looks like NSParameterAssert(moc_); return [NSEntityDescription insertNewObjectForEntityForName:@"Thumbnail" inManagedObjectContext:moc_]; NSParameterAssert(moc_); return [NSEntityDescription insertNewObjectForEntityForName:@"Image" inManagedObjectContext:moc_]; The NSManagedObjectContext returned by [self moc] is created for the NSOperation with NSPersistentStoreCoordinator *coord = [(MyApp_AppDelegate *)[[NSApplication sharedApplication] delegate] persistentStoreCoordinator]; self.moc = [[NSManagedObjectContext alloc] init]; [self.moc setPersistentStoreCoordinator:coord]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(contextDidSave:) name:NSManagedObjectContextDidSaveNotification object:self.moc]; [self.moc setMergePolicy:NSMergeByPropertyObjectTrumpMergePolicy]; [self.moc setUndoManager:nil]; [self.moc setRetainsRegisteredObjects:YES]; moc is defined as (nonatomic, retain) and synthesized. As far as I can tell it, the persistent store and my appDelegate have no reason to be and are not being garbage collected. The stack trace looks like Thread 2 Crashed: Dispatch queue: com.apple.root.default-priority 0 libauto.dylib 0x00007fff82d63600 auto_zone_root_write_barrier + 688 1 libobjc.A.dylib 0x00007fff826f963b objc_assign_strongCast_gc + 59 2 com.apple.CoreFoundation 0x00007fff88677068 __CFBasicHashAddValue + 504 3 com.apple.CoreFoundation 0x00007fff88676d2f CFBasicHashAddValue + 191 4 com.apple.CoreData 0x00007fff82bdee5e -[NSManagedObjectContext(_NSInternalAdditions) _insertObjectWithGlobalID:globalID:] + 190 5 com.apple.CoreData 0x00007fff82bded24 -[NSManagedObjectContext insertObject:] + 148 6 com.apple.CoreData 0x00007fff82bbd75c -[NSManagedObject initWithEntity:insertIntoManagedObjectContext:] + 716 7 com.apple.CoreData 0x00007fff82bdf075 +[NSEntityDescription insertNewObjectForEntityForName:inManagedObjectContext:] + 101 8 com.yourcompany.MyApp 0x000000010002c7a7 +[_Thumbnail insertInManagedObjectContext:] + 256 (_Thumbnail.m:14) 9 com.yourcompany.MyApp 0x000000010002672d -[ThreadParse main] + 10345 (B4ChanThreadParse.m:174) 10 com.apple.Foundation 0x00007fff85ee807e -[__NSOperationInternal start] + 698 11 com.apple.Foundation 0x00007fff85ee7d23 ____startOperations_block_invoke_2 + 99 12 libSystem.B.dylib 0x00007fff812bece8 _dispatch_call_block_and_release + 15 13 libSystem.B.dylib 0x00007fff8129d279 _dispatch_worker_thread2 + 231 14 libSystem.B.dylib 0x00007fff8129cbb8 _pthread_wqthread + 353 15 libSystem.B.dylib 0x00007fff8129ca55 start_wqthread + 13 My app is crashing in other places with exc_bad_access but this is code that it happens most with. All of the stack traces look similar and have something to do with CFHash. Any help would be appreciated.

    Read the article

  • Using Core Data Concurrently and Reliably

    - by John Topley
    I'm building my first iOS app, which in theory should be pretty straightforward but I'm having difficulty making it sufficiently bulletproof for me to feel confident submitting it to the App Store. Briefly, the main screen has a table view, upon selecting a row it segues to another table view that displays information relevant for the selected row in a master-detail fashion. The underlying data is retrieved as JSON data from a web service once a day and then cached in a Core Data store. The data previous to that day is deleted to stop the SQLite database file from growing indefinitely. All data persistence operations are performed using Core Data, with an NSFetchedResultsController underpinning the detail table view. The problem I am seeing is that if you switch quickly between the master and detail screens several times whilst fresh data is being retrieved, parsed and saved, the app freezes or crashes completely. There seems to be some sort of race condition, maybe due to Core Data importing data in the background whilst the main thread is trying to perform a fetch, but I'm speculating. I've had trouble capturing any meaningful crash information, usually it's a SIGSEGV deep in the Core Data stack. The table below shows the actual order of events that happen when the detail table view controller is loaded: Main Thread Background Thread viewDidLoad Get JSON data (using AFNetworking) Create child NSManagedObjectContext (MOC) Parse JSON data Insert managed objects in child MOC Save child MOC Post import completion notification Receive import completion notification Save parent MOC Perform fetch and reload table view Delete old managed objects in child MOC Save child MOC Post deletion completion notification Receive deletion completion notification Save parent MOC Once the AFNetworking completion block is triggered when the JSON data has arrived, a nested NSManagedObjectContext is created and passed to an "importer" object that parses the JSON data and saves the objects to the Core Data store. The importer executes using the new performBlock method introduced in iOS 5: NSManagedObjectContext *child = [[NSManagedObjectContext alloc] initWithConcurrencyType:NSPrivateQueueConcurrencyType]; [child setParentContext:self.managedObjectContext]; [child performBlock:^{ // Create importer instance, passing it the child MOC... }]; The importer object observes its own MOC's NSManagedObjectContextDidSaveNotification and then posts its own notification which is observed by the detail table view controller. When this notification is posted the table view controller performs a save on its own (parent) MOC. I use the same basic pattern with a "deleter" object for deleting the old data after the new data for the day has been imported. This occurs asynchronously after the new data has been fetched by the fetched results controller and the detail table view has been reloaded. One thing I am not doing is observing any merge notifications or locking any of the managed object contexts or the persistent store coordinator. Is this something I should be doing? I'm a bit unsure how to architect this all correctly so would appreciate any advice.

    Read the article

  • Tab bar application with UINavigation Controller MOC not being retained.

    - by iamsmug
    I created a tab bar application from the template and added a navigation controller to one of the tabs. I have already created this app from the navigation app template already and is working. The reason I am doing it this way is because I need to add a tab bar and thought it would be easier starting by using the tab bar project template and adding the nav controller to it rather than the other way round. I have copied the data model over from the other project and added the relevant code to where it should be. The problem I am having is passing the moc from the app delegate to the tab with the nav controller on. Here is a snippet from my applicationDidFinishLaunching method in my app delegate: - (void)applicationDidFinishLaunching:(UIApplication *)application { [self createEditableCopyOfDatabaseIfNeeded]; Top_BananaTableViewController *top_BananaTableViewController = (Top_BananaTableViewController *)[navigationController topViewController]; top_BananaTableViewController.managedObjectContext = self.managedObjectContext; // Add the tab bar controller's current view as a subview of the window [window addSubview:tabBarController.view]; [window makeKeyAndVisible]; } Everything seems fine here but when it comes to the fetchedResultsController on my nav controller view it bombs out with: '+entityForName: could not locate an NSManagedObjectModel for entity name 'cards'' When I checked what was set to my managedObjectContext on that view it was null. I don't know why or where it is loosing it's setting. Please help.

    Read the article

  • NSFetchedResultsController doesn't fetch up the child-parent moc chain?

    - by Kronusdark
    I cannot find any clarification on this, so it may be a bug. Problem is, I have a series of parent-child Managed Object Context's. When I save on a child context the changes get pushed up to the parent, and I can fetch using a plain old NSFetchRequest. However, if I rely on an NSFetchedResultsController to pull these changes into a sibling context to the first, they do not see them. calling -(void)performFetch: error; doesn't seem to pull the changes either. After a restart of the app, all new data is available. My hypothesis is that NSFetchedResultsController only fetches from its current context and will not follow the chain to the persistent store. Can someone please set me straight here? Am I going to have to use notifications to monitor changes on other contexts? and finally, is this mentioned somewhere in the doc's? I cannot find it for the life of me.

    Read the article

  • Sound from Ubuntu Server 10.04

    - by emilyk
    I feel like this should be a no brainer, but I just can't seem to figure it out. I am running Ubuntu Server 10.04 as a virtual machine in VMWare Fusion. I am simply trying to get there to be some sound that comes out of my laptop speakers. I have installed Alsa and MOC (followed these instructions, and it worked fine http://howto.blbosti.com/2010/03/ubuntu-server-install-alsa-sound-and-moc-music-on-console/). Especially using MOC, I can see that the song (an MP3) is playing, but I am not getting any sound out. lspci | grep audio gives me: 02:02.0 Multimedia audio controller: Ensoniq ES1371 [AudioPCI-97] (rev 02) This doesn't seem like it should be that big of a deal, but I just can't seem to make it work. Any ideas?

    Read the article

  • LINQ to Entities Projection of Nested List

    - by Matthew
    Assuming these objects... class MyClass { int ID {get;set;} string Name {get;set;} List<MyOtherClass> Things {get;set;} } class MyOtherClass { int ID {get;set;} string Value {get;set;} } How do I perform a LINQ to Entities Query, using a projection like below, that will give me a List? This works fine with an IEnumerable (assuming MyClass.Things is an IEnumerable, but I need to use List) MyClass myClass = (from MyClassTable mct in this.Context.MyClassTableSet select new MyClass { ID = mct.ID, Name = mct.Name, Things = (from MyOtherClass moc in mct.Stuff where moc.IsActive select new MyOtherClass { ID = moc.ID, Value = moc.Value }).AsEnumerable() }).FirstOrDefault(); Thanks in advance for the help!

    Read the article

  • How to efficiently save changes made in UI/main thread with Core Data?

    - by Jaanus
    So, there have been several posts here about importing and saving data from an external data source into Core Data. Apple documents a reasonable pattern for this: "import and save on background thread, merge saved objects to main thread." All fine and good. I have a related but different problem: the user is modifying data in the UI and main thread, and thus modifies state of some objects in the managed object context (MOC). I would like to save these changes from time to time. What is a good way to do that? Now, you could say that I could do the same: create a background thread with its own MOC and pass the changed objectID-s there. The catch-22 for me with this is that an object's ID changes when it is saved, and I cannot guarantee the order of things happening. I may end up passing a different objectID into the background thread for the same object, based on whether the object has been previously saved or not, and I don't know if Core Data can resolve this and see that different objectID-s are pointing to the same object and not create duplicates for me. (I could test this, but I'm lazywebbing with this question first.) One thought I had: I could always do MOC saves on a background thread, and queue them up with operationqueue, so that there is always only one save in progress. I would not create a new MOC, I would just use the same MOC as in main thread. Now, this is not thread safe and when someone modifies the MOC in main thread while it is being saved in background thread, the results will probably be catastrophic. But, minus the thread safety, you can see what kind of solution I'd wish for. To be clear, the problem I need to fix is that if I just do the save in main thread, it blocks the UI for an unacceptably long period of time, I want to move the save to background thread. So, questions: what about the reasoning of an object ID changing during saving, and Core Data being able to resolve them to the same object? Would this be the right way of addressing this problem? any other good ways of doing this?

    Read the article

  • Core Data - JSON (TouchJSON) on iPhone

    - by Urizen
    I have the following code which seems to go on indefinitely until the app crashes. It seems to happen with the recursion in the datastructureFromManagedObject method. I suspect that this method: 1) looks at the first managed object and follows any relationship property recursively. 2) examines the object at the other end of the relationship found at point 1 and repeats the process. Is it possible that if managed object A has a to-many relationship with object B and that relationship is two-way (i.e an inverse to-one relationship to A from B - e.g. one department has many employees but each employee has only one department) that the following code gets stuck in infinite recursion as it follows the to-one relationship from object B back to object A and so on. If so, can anyone provide a fix for this so that I can get my whole object graph of managed objects converted to JSON. #import "JSONUtils.h" @implementation JSONUtils - (NSDictionary*)dataStructureFromManagedObject:(NSManagedObject *)managedObject { NSDictionary *attributesByName = [[managedObject entity] attributesByName]; NSDictionary *relationshipsByName = [[managedObject entity] relationshipsByName]; //getting the values correspoinding to the attributes collected in attributesByName NSMutableDictionary *valuesDictionary = [[managedObject dictionaryWithValuesForKeys:[attributesByName allKeys]] mutableCopy]; //sets the name for the entity being encoded to JSON [valuesDictionary setObject:[[managedObject entity] name] forKey:@"ManagedObjectName"]; NSLog(@"+++++++++++++++++> before the for loop"); //looks at each relationship for the given managed object for (NSString *relationshipName in [relationshipsByName allKeys]) { NSLog(@"The relationship name = %@",relationshipName); NSRelationshipDescription *description = [relationshipsByName objectForKey:relationshipName]; if (![description isToMany]) { NSLog(@"The relationship is NOT TO MANY!"); [valuesDictionary setObject:[self dataStructureFromManagedObject:[managedObject valueForKey:relationshipName]] forKey:relationshipName]; continue; } NSSet *relationshipObjects = [managedObject valueForKey:relationshipName]; NSMutableArray *relationshipArray = [[NSMutableArray alloc] init]; for (NSManagedObject *relationshipObject in relationshipObjects) { [relationshipArray addObject:[self dataStructureFromManagedObject:relationshipObject]]; } [valuesDictionary setObject:relationshipArray forKey:relationshipName]; } return [valuesDictionary autorelease]; } - (NSArray*)dataStructuresFromManagedObjects:(NSArray*)managedObjects { NSMutableArray *dataArray = [[NSArray alloc] init]; for (NSManagedObject *managedObject in managedObjects) { [dataArray addObject:[self dataStructureFromManagedObject:managedObject]]; } return [dataArray autorelease]; } //method to call for obtaining JSON structure - i.e. public interface to this class - (NSString*)jsonStructureFromManagedObjects:(NSArray*)managedObjects { NSLog(@"-------------> just before running the recursive method"); NSArray *objectsArray = [self dataStructuresFromManagedObjects:managedObjects]; NSLog(@"-------------> just before running the serialiser"); NSString *jsonString = [[CJSONSerializer serializer] serializeArray:objectsArray]; return jsonString; } - (NSManagedObject*)managedObjectFromStructure:(NSDictionary*)structureDictionary withManagedObjectContext:(NSManagedObjectContext*)moc { NSString *objectName = [structureDictionary objectForKey:@"ManagedObjectName"]; NSManagedObject *managedObject = [NSEntityDescription insertNewObjectForEntityForName:objectName inManagedObjectContext:moc]; [managedObject setValuesForKeysWithDictionary:structureDictionary]; for (NSString *relationshipName in [[[managedObject entity] relationshipsByName] allKeys]) { NSRelationshipDescription *description = [[[managedObject entity]relationshipsByName] objectForKey:relationshipName]; if (![description isToMany]) { NSDictionary *childStructureDictionary = [structureDictionary objectForKey:relationshipName]; NSManagedObject *childObject = [self managedObjectFromStructure:childStructureDictionary withManagedObjectContext:moc]; [managedObject setValue:childObject forKey:relationshipName]; continue; } NSMutableSet *relationshipSet = [managedObject mutableSetValueForKey:relationshipName]; NSArray *relationshipArray = [structureDictionary objectForKey:relationshipName]; for (NSDictionary *childStructureDictionary in relationshipArray) { NSManagedObject *childObject = [self managedObjectFromStructure:childStructureDictionary withManagedObjectContext:moc]; [relationshipSet addObject:childObject]; } } return managedObject; } //method to call for obtaining managed objects from JSON structure - i.e. public interface to this class - (NSArray*)managedObjectsFromJSONStructure:(NSString *)json withManagedObjectContext:(NSManagedObjectContext*)moc { NSError *error = nil; NSArray *structureArray = [[CJSONDeserializer deserializer] deserializeAsArray:[json dataUsingEncoding:NSUTF32BigEndianStringEncoding] error:&error]; NSAssert2(error == nil, @"Failed to deserialize\n%@\n%@", [error localizedDescription], json); NSMutableArray *objectArray = [[NSMutableArray alloc] init]; for (NSDictionary *structureDictionary in structureArray) { [objectArray addObject:[self managedObjectFromStructure:structureDictionary withManagedObjectContext:moc]]; } return [objectArray autorelease]; } @end

    Read the article

  • objc_exception_throw When Returning NSManagedObject

    - by spamguy
    I have a method dedicated to finding an NSManagedObject ('company') using a supplied NSString and, if it's not found, creating a new one and returning it. As far as I know it's fully inited and the method works perfectly. That is, until the line after the return statement, when the app crashes with an objc_exception_throw. I googled this and couldn't find what causes it, only how to use it in breakpoint debugging. What's wrong with this method, and why is it throwing specifically this exception? - (NSManagedObject*) getCompanyObject:(NSString*)theCompany { NSError *error = nil; NSManagedObjectContext *moc = [[self delegate] managedObjectContext]; NSFetchRequest *fetch = [[[NSFetchRequest alloc] init] autorelease]; NSEntityDescription *entityDescription = [NSEntityDescription entityForName:@"Company" inManagedObjectContext:moc]; [fetch setEntity:entityDescription]; // object to be returned NSManagedObject *companyObject = [[NSManagedObject alloc] initWithEntity:entityDescription insertIntoManagedObjectContext:moc]; // set predicate (company name) NSPredicate *pred = [NSPredicate predicateWithFormat:[NSString stringWithFormat:@"name = \"%@\"", theCompany]]; [fetch setPredicate:pred]; NSArray *response = [moc executeFetchRequest:fetch error:&error]; if ([response count] == 0) // empty resultset --> no companies with this name { [companyObject setValue:theCompany forKey:@"name"]; NSLog(@"%@ not found. Adding.", theCompany); } else [companyObject setValue:[[response objectAtIndex:0] valueForKey:@"name"]]; return companyObject; }

    Read the article

  • Update tableview instantly as data pushed in core data iphone

    - by user336685
    I need to update the tableview as soon as the content is pushed in core data database. for this AppDelegate.m contains following code NSManagedObjectContext *moc = [self managedObjectContext]; NSFetchRequest *request = [[NSFetchRequest alloc] init]; [request setEntity:[NSEntityDescription entityForName:@"FeedItem" inManagedObjectContext:moc]]; //for loop // push data in code data & then save context [moc save:&error]; ZAssert(error == nil, @"Error saving context: %@", [error localizedDescription]); //for loop ends This code triggers following code from RootviewController.m - (void)controllerWillChangeContent:(NSFetchedResultsController*)controller { [[self tableView] beginUpdates]; } But this updates the tableview only at the end of the for loop ,the table does not get updated after immediate push in db. I tried following code but that didn't work - (void)controllerDidChangeContent:(NSFetchedResultsController *)controller { // In the simplest, most efficient, case, reload the table view. [self.tableView reloadData]; } I have been stuck with this problem for several days.Please help.Thanks in advance for solution.

    Read the article

  • Cannot figure out how to get rid of memory leak

    - by Mark S.
    I'm trying to test for memory leaks in my iphone and I'm not having much luck getting rid of this one. Here is the code that is leaking. - (id)initWithManagedObjectContext:(NSManagedObjectContext *)aMoc delegate:(id)aDelegate runSync:(BOOL)aRunSync { if (self = [super init]) { self.moc = aMoc; self.settingsManager = [[VacaCalcSettingsManager alloc] initWithManagedObjectContext:self.moc]; self.delegate = aDelegate; calendar = [[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar]; self.runSync = aRunSync; } return self; } It is leaking on the self.settingsManager = [[VacaCalcSettingsManager alloc] initWithManagedObjectContext:self.moc]; line. The self.settingManager instance variable is released in the dealloc method of the class. I'm not sure what other information would be pertinent. Please let me know and I can provide it. Thanks for any assistance. -Mark

    Read the article

  • java: <identifier> expected with ArrayList

    - by A-moc
    I have a class named Storage. Storage contains an arraylist of special objects called Products. Each product contains information such as name, price, etc. My code is as follows: class Storage{ Product sprite = new Product("sprite",1.25,30); Product pepsi = new Product("pepsi",1.85,45); Product orange = new Product("orange",2.25,36); Product hershey = new Product("hershey",1.50,33); Product brownie = new Product("brownie",2.30,41); Product apple = new Product("apple",2.00,15); Product crackers = new Product("peanut",3.90,68); Product trailmix = new Product("trailmix",1.90,45); Product icecream = new Product("icecream",1.65,28); Product doughnut = new Product("doughnut",2.75,18); Product banana = new Product("banana",1.25,32); Product coffee = new Product("coffee",1.30,40); Product chips = new Product("chips",1.70,35); ArrayList<Product> arl = new ArrayList<Product>(); //add initial elements to arraylist arl.add(sprite); arl.add(pepsi); arl.add(orange); arl.add(hershey); arl.add(brownie); arl.add(apple); arl.add(peanut); arl.add(trailmix); arl.add(icecream); arl.add(doughnut); arl.add(banana); arl.add(coffee); arl.add(chips); } Whenever I compile, I get an error message on lines 141-153 stating <identifier> expected. I know it's an elementary problem, but I can't seem to figure this out. Any help is much appreciated.

    Read the article

  • Linuxubuntu1234 [closed]

    - by Richard
    Dobry den Pani a Panvé Linux Ubuntu lepsi nové tu jemno cely Linuxubuntu 13,5 pogram sytem. Ptam se ano nové sytem moc chrany Ubuntu bude s mobil se jemnuje Liubuntu phone 13,9. Moc libi tu pogram lepsi noviky Liubuntu phone budeš sam sysem pracovt lepé 2 stejne pro mobil i tablet. A má nine Mini notebooky, netbooky a PC pogramy velky pro Ubuntu lepsi internet pro anglicky psani prekada cesky. Ano cesky má clanek ale nine anglicky nerozumi clanek preklada cesky jako google má pogram lip cele svet preklada a ctu nerozumi a preklada cesky.

    Read the article

1 2 3  | Next Page >