UA-17470720-3

Jump to content


Photo
- - - - -

to-many relationship not allowed here


  • Please log in to reply
6 replies to this topic

#1 codebonbon

codebonbon

    Advanced Member

  • STV 3.0 Pro
  • PipPipPipPipPip
  • 181 posts
Reputation: 8
Good

Posted 13 September 2011 - 01:35 PM

Hi Tarek!

I am getting a "to-many relationship not allowed here" error when i try to represent the below relationships in my core data model? Below the basic schema of this. I tried to debug this but to no avail. Any ideas why this could happen?

House has many Person
Person has many House
House has a single Address
Person has many Address


Thanks!

#2 Tarek

Tarek

    Forum Admin

  • Administrators
  • 3670 posts
Reputation: 452
Popular

Posted 14 September 2011 - 01:21 AM

Hi Harold,

Would you please post the exception log? Also, are you using any custom NSPredicate? Thanks!

#3 codebonbon

codebonbon

    Advanced Member

  • STV 3.0 Pro
  • PipPipPipPipPip
  • 181 posts
Reputation: 8
Good

Posted 15 September 2011 - 07:45 AM

Hi Tarek!

I'm not using any predicate and here's the exception log.

*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'to-many key not allowed here'
*** Call stack at first throw:
(
	0   CoreFoundation					  0x014445a9 __exceptionPreprocess + 185
	1   libobjc.A.dylib					 0x01598313 objc_exception_throw + 44
	2   CoreData							0x00f47266 -[NSSQLGenerator newSQLStatementForFetchRequest:ignoreInheritance:countOnly:nestingLevel:] + 1270
	3   CoreData							0x00e7f4d8 -[NSSQLAdapter _newSelectStatementWithFetchRequest:ignoreInheritance:] + 488
	4   CoreData							0x00e7f2e1 -[NSSQLAdapter newSelectStatementWithFetchRequest:] + 49
	5   CoreData							0x00e7f18e -[NSSQLCore newRowsForFetchPlan:] + 430
	6   CoreData							0x00e7e515 -[NSSQLCore objectsForFetchRequest:inContext:] + 357
	7   CoreData							0x00e7e0ce -[NSSQLCore executeRequest:withContext:error:] + 206
	8   CoreData							0x00f2dcdc -[NSPersistentStoreCoordinator executeRequest:withContext:error:] + 1084
	9   CoreData							0x00e7b267 -[NSManagedObjectContext executeFetchRequest:error:] + 359
	10  MyApp						0x0001424f +[SCHelper generateObjectsArrayForEntityClassDefinition:usingPredicate:] + 575
	11  MyApp						0x0004a10c -[SCArrayOfObjectsModel initWithTableView:withViewController:withEntityClassDefinition:usingPredicate:] + 172
	12  MyApp						0x0004a04d -[SCArrayOfObjectsModel initWithTableView:withViewController:withEntityClassDefinition:] + 109
	13  MyApp						0x0006a300 -[HouseViewController setupView] + 704
	14  MyApp						0x00069fe8 -[HouseViewController viewDidLoad] + 88
	15  UIKit							   0x00519089 -[UIViewController view] + 179
	16  UIKit							   0x00517482 -[UIViewController contentScrollView] + 42
	17  UIKit							   0x00527f25 -[UINavigationController _computeAndApplyScrollContentInsetDeltaForViewController:] + 48
	18  UIKit							   0x00526555 -[UINavigationController _layoutViewController:] + 43
	19  UIKit							   0x00527870 -[UINavigationController _startTransition:fromViewController:toViewController:] + 524
	20  UIKit							   0x0052232a -[UINavigationController _startDeferredTransitionIfNeeded] + 266
	21  UIKit							   0x0063d2e9 -[UILayoutContainerView layoutSubviews] + 226
	22  QuartzCore						  0x010e3a5a -[CALayer layoutSublayers] + 181
	23  QuartzCore						  0x010e5ddc CALayerLayoutIfNeeded + 220
	24  QuartzCore						  0x0108b0b4 _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 310
	25  QuartzCore						  0x0108c294 _ZN2CA11Transaction6commitEv + 292
	26  UIKit							   0x0046b9c9 -[UIApplication _reportAppLaunchFinished] + 39
	27  UIKit							   0x0046be83 -[UIApplication _runWithURL:payload:launchOrientation:statusBarStyle:statusBarHidden:] + 690
	28  UIKit							   0x00476617 -[UIApplication handleEvent:withNewEvent:] + 1533
	29  UIKit							   0x0046eabf -[UIApplication sendEvent:] + 71
	30  UIKit							   0x00473f2e _UIApplicationHandleEvent + 7576
	31  GraphicsServices					0x01ca7992 PurpleEventCallback + 1550
	32  CoreFoundation					  0x01425944 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 52
	33  CoreFoundation					  0x01385cf7 __CFRunLoopDoSource1 + 215
	34  CoreFoundation					  0x01382f83 __CFRunLoopRun + 979
	35  CoreFoundation					  0x01382840 CFRunLoopRunSpecific + 208
	36  CoreFoundation					  0x01382761 CFRunLoopRunInMode + 97
	37  UIKit							   0x0046b7d2 -[UIApplication _run] + 623
	38  UIKit							   0x00477c93 UIApplicationMain + 1160
	39  MyApp						0x00002e1d main + 125
	40  MyApp						0x00002d95 start + 53
	41  ???								 0x00000001 0x0 + 1
)
terminate called throwing an exception(lldb) 


#4 Tarek

Tarek

    Forum Admin

  • Administrators
  • 3670 posts
Reputation: 452
Popular

Posted 16 September 2011 - 11:06 AM

Hi Harold,

This exception seems to be related to your Core Data model, though I am not sure what exactly is wrong with it. I can have a look at your project if you wish. Also, have you tried asking on forums like stackoverflow.com? It's very probable that somebody there faced the same problem before.

#5 codebonbon

codebonbon

    Advanced Member

  • STV 3.0 Pro
  • PipPipPipPipPip
  • 181 posts
Reputation: 8
Good

Posted 26 September 2011 - 08:25 AM

Did as you suggested. Even removed every relationships in all other entities in my model. I even deleted and recreated the datamodel all together. Should i create a many to many relationship whit an intermediate entity to fix this? How to do so with sensible cocoa? Let's just say i'm stumped by this error. Any help would be appreciated since i'm trying to release this product soon.

Thanks!

#6 codebonbon

codebonbon

    Advanced Member

  • STV 3.0 Pro
  • PipPipPipPipPip
  • 181 posts
Reputation: 8
Good

Posted 27 September 2011 - 07:39 AM

I tried this also and get the same error. New core data model. Two entities. EntityA has a to many relationship with EntityB (no inverse). Simple enough and i still get the same result.

Thanks!

#7 Tarek

Tarek

    Forum Admin

  • Administrators
  • 3670 posts
Reputation: 452
Popular

Posted 27 September 2011 - 01:57 PM

Hi Harold,

Thank you very much for all the updates! I am still trying to figure out this myself. I'll also do some online research on the matter. Will keep you updated.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users