Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Insert a #warning if generating a setPrimitiveType: accessor #166

Open
wants to merge 1 commit into from

1 participant

@simonwhitaker

This is a suggested alternative to the fix in commit cd9809d. That fix results in the primitiveType and setPrimitiveType: accessors being silently suppressed. This fix still generates them (and hence doesn't break a build), but adds a #warning line (which Xcode will flag up) indicating that there's a problem if the app is intended for App Store submission.

Simon Whitaker Insert a #warning if generating a setPrimitiveType: accessor
This is a suggested alternative to the fix in commit cd9809d. That fix
results in the `primitiveType` and `setPrimitiveType:` accessors being
silently suppressed. This fix still generates them (and hence doesn't
break a build), but adds a #warning line (which Xcode will flag up)
indicating that there's a problem if the app is intended for App Store
submission.
7d3d09a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jul 7, 2013
  1. Insert a #warning if generating a setPrimitiveType: accessor

    Simon Whitaker authored
    This is a suggested alternative to the fix in commit cd9809d. That fix
    results in the `primitiveType` and `setPrimitiveType:` accessors being
    silently suppressed. This fix still generates them (and hence doesn't
    break a build), but adds a #warning line (which Xcode will flag up)
    indicating that there's a problem if the app is intended for App Store
    submission.
This page is out of date. Refresh to see the latest.
Showing with 4 additions and 16 deletions.
  1. +0 −15 mogenerator.m
  2. +4 −1 templates/machine.h.motemplate
View
15 mogenerator.m
@@ -159,21 +159,6 @@ - (NSArray*)noninheritedAttributes {
}
}
/** @TypeInfo NSAttributeDescription */
-- (NSArray*)noninheritedAttributesSansType {
- NSArray *attributeDescriptions = [self noninheritedAttributes];
- NSMutableArray *filteredAttributeDescriptions = [NSMutableArray arrayWithCapacity:[attributeDescriptions count]];
-
- nsenumerate(attributeDescriptions, NSAttributeDescription, attributeDescription) {
- if ([[attributeDescription name] isEqualToString:@"type"]) {
- ddprintf(@"WARNING skipping 'type' attribute on %@ (%@) - see https://github.com/rentzsch/mogenerator/issues/74\n",
- self.name, self.managedObjectClassName);
- } else {
- [filteredAttributeDescriptions addObject:attributeDescription];
- }
- }
- return filteredAttributeDescriptions;
-}
-/** @TypeInfo NSAttributeDescription */
- (NSArray*)noninheritedRelationships {
NSArray *sortDescriptors = [NSArray arrayWithObject:[NSSortDescriptor sortDescriptorWithKey:@"name" ascending:YES]];
NSEntityDescription *superentity = [self superentity];
View
5 templates/machine.h.motemplate
@@ -125,8 +125,11 @@ extern const struct <$managedObjectClassName$>UserInfo {<$foreach UserInfo userI
<$endif$><$endforeach do$>
@interface _<$managedObjectClassName$> (CoreDataGeneratedPrimitiveAccessors)
-<$foreach Attribute noninheritedAttributesSansType do$>
+<$foreach Attribute noninheritedAttributes do$>
<$if Attribute.hasDefinedAttributeType$>
+<$if Attribute.name=="type"$>
+#warning A setPrimitiveType: accessor is known to potentially cause App Store rejection. See https://github.com/rentzsch/mogenerator/issues/74. If this app is intended for App Store distribution you should rename the 'type' attribute in your model (e.g. to '<$name.lowercaseString$>Type') and re-run mogenerator.
+<$endif$>
- (<$Attribute.objectAttributeType$>)primitive<$Attribute.name.initialCapitalString$>;
- (void)setPrimitive<$Attribute.name.initialCapitalString$>:(<$Attribute.objectAttributeType$>)value;
<$if Attribute.hasScalarAttributeType$>
Something went wrong with that request. Please try again.