3

iOS iCloud は 2 番目のデバイスでオブジェクトを同期しますが、オブジェクトのプロパティを同期しません

  • NonSyncing プロパティ: カテゴリ

  • アプリ: ユニバーサル iOS、CoreData ライブラリ スタイル、tableView を処理する FRC あり、GarbageCollection なし

  • デバイス: 5.1.1 上の iPhone 4、iPad 1 は両方とも同じ iOS アプリを実行しています。

  • X コード 4.3.2

  • データ・モデル:

** エンティティ関係宛先逆 **

   Recipe       categories      Category        recipes

   Category     recipes         Recipe          categories
  • 関連するオブジェクト: レシピとカテゴリ。最初にオプション対多プロパティ カテゴリがあり、2 番目にオプション対多プロパティ レシピがペアになっています。Recipe の他のプロパティには、 components 、 NSString* が含まれます

  • 手順: iPad アプリで MOC に新しいレシピを作成し、それに既存のカテゴリをレシピ obj に追加してから、いくつかの材料テキストを追加します。次に save: を MOC に -- 唯一の save: 呼び出し。新しいレシピは iPhone で材料のテキストと同期されますが、iPad で追加および保存されたカテゴリがありません。この検索カテゴリは、追加された iPad では機能しますが、iPhone では機能しません。つまり、カテゴリは 2 番目のデバイスの新しいレシピのカテゴリ プロパティに追加されません。iCloud は 2 つの *.cdt ファイルを iPhone に置きます。

以下は、レシピとカテゴリのクラス インターフェイスと実装ファイル、および iPhone に表示される 2 つのログ ファイルのコンテンツ plist です。

  • 質問: この情報が、どこで修正を探すべきかを教えてくれることを願っていますか? ここでどのような情報を提供すればよいかわかりません。iCloud は、このプロパティの同期を独自に処理するべきではありませんか?

これを読んでくれてありがとう!マーク

    // Recipe.h

    #import <CoreData/CoreData.h>

    @class Category;
    @class Photo;

    @interface Recipe :  NSManagedObject  
    {

    }
    @property (nonatomic, retain) NSString * name;
    @property (nonatomic, retain) NSNumber * recipeID;
    @property (nonatomic, retain) NSNumber * ctime;
    @property (nonatomic, retain) NSString * ingredients;
    @property (nonatomic, retain) NSString * comments;
    @property (nonatomic, retain) NSString * nameShort;
    @property (nonatomic, retain) NSString * directions;
    @property (nonatomic, retain) NSNumber * ptime;
    @property (nonatomic, retain) NSSet* photos;
    @property (nonatomic, retain) NSSet* categories;

    - (NSComparisonResult)compareRecipeNames:(Recipe *)recipe;

    @end


    @interface Recipe (CoreDataGeneratedAccessors)
    - (void)addPhotosObject:(Photo *)value;
    - (void)removePhotosObject:(Photo *)value;
    - (void)addPhotos:(NSSet *)value;
    - (void)removePhotos:(NSSet *)value;

    - (void)addCategoriesObject:(Category *)value;
    - (void)removeCategoriesObject:(Category *)value;
    - (void)addCategories:(NSSet *)value;
    - (void)removeCategories:(NSSet *)value;

    @end

    // 
    //  Recipe.m


    #import "Recipe.h"

    #import "Category.h"
    #import "Photo.h"

    @implementation Recipe

    @dynamic name;
    @dynamic recipeID;
    @dynamic ctime;
    @dynamic ingredients;
    @dynamic comments;
    @dynamic nameShort;
    @dynamic directions;
    @dynamic ptime;
    @dynamic junk;
    @dynamic photos;
    @dynamic categories;


    - (id)init{

        self = [super init];

        return self;
    }


    - (void)addCategories:(NSSet *)value{

        [self willChangeValueForKey:@"categories"
                        withSetMutation:NSKeyValueUnionSetMutation
                            usingObjects:value];

        [[self primitiveCategories] unionSet:value];

        [self didChangeValueForKey:@"categories"
                      withSetMutation:NSKeyValueUnionSetMutation
                          usingObjects:value];

    }


    - (void)addCategoriesObject:(Category *)value 
    {    
        NSSet *changedObjects = [[NSSet alloc] initWithObjects:&value count:1];

        [self willChangeValueForKey:@"categories" withSetMutation:NSKeyValueUnionSetMutation usingObjects:changedObjects];
        [[self primitiveValueForKey:@"categories"] addObject:value];
        [self didChangeValueForKey:@"categories" withSetMutation:NSKeyValueUnionSetMutation usingObjects:changedObjects];

        [changedObjects release];
    }

    - (void)removeCategoriesObject:(Category *)value 
    {
        NSSet *changedObjects = [[NSSet alloc] initWithObjects:&value count:1];

        [self willChangeValueForKey:@"categories" withSetMutation:NSKeyValueMinusSetMutation usingObjects:changedObjects];
        [[self primitiveValueForKey:@"categories"] removeObject:value];
        [self didChangeValueForKey:@"categories" withSetMutation:NSKeyValueMinusSetMutation usingObjects:changedObjects];

        [changedObjects release];
    }

    - (void)addPhotosObject:(Photo *)value 
    {    
        NSSet *changedObjects = [[NSSet alloc] initWithObjects:&value count:1];

        [self willChangeValueForKey:@"photos" withSetMutation:NSKeyValueUnionSetMutation usingObjects:changedObjects];
        [[self primitiveValueForKey:@"photos"] addObject:value];
        [self didChangeValueForKey:@"photos" withSetMutation:NSKeyValueUnionSetMutation usingObjects:changedObjects];

        [changedObjects release];
    }

    - (void)removePhotosObject:(Photo *)value 
    {
        NSSet *changedObjects = [[NSSet alloc] initWithObjects:&value count:1];

        [self willChangeValueForKey:@"photos" withSetMutation:NSKeyValueMinusSetMutation usingObjects:changedObjects];
        [[self primitiveValueForKey:@"photos"] removeObject:value];
        [self didChangeValueForKey:@"photos" withSetMutation:NSKeyValueMinusSetMutation usingObjects:changedObjects];

        [changedObjects release];
    }


    - (NSComparisonResult)compareRecipeNames:(Recipe *)recipe  {
        // Compare nodes to each other by comparing the data part.
        return [self.name compare:[recipe name] options:NSCaseInsensitiveSearch];
    }


    @end

    -- Category.h

    //Category.h

    #import <CoreData/CoreData.h>

    @class Recipe;

    @interface Category :  NSManagedObject  
    {
    }

    @property (nonatomic, retain) NSString * nameShort;
    @property (nonatomic, retain) NSString * name;
    @property (nonatomic, retain) NSSet* recipes;
    @property (nonatomic, retain) NSNumber* sortIndex;

    - (NSComparisonResult) compareCategoryNames:(Category *)category ;
    - (NSComparisonResult) compareCategorySortIndeces:(Category *)category;

    @end


    @interface Category (CoreDataGeneratedAccessors)
    - (void)addRecipesObject:(Recipe *)value;
    - (void)removeRecipesObject:(Recipe *)value;
    - (void)addRecipes:(NSSet *)value;
    - (void)removeRecipes:(NSSet *)value;

    @end


    // 
    //  Category.m
    //

    #import "Category.h"
    #import "Recipe.h"

    @implementation Category 

    @dynamic nameShort;
    @dynamic name;
    @dynamic recipes;
    @dynamic sortIndex;


    - (void)addRecipesObject:(Recipe *)value 
    {    
        NSSet *changedObjects = [[NSSet alloc] initWithObjects:&value count:1];

        [self willChangeValueForKey:@"recipes" withSetMutation:NSKeyValueUnionSetMutation usingObjects:changedObjects];
        [[self primitiveValueForKey:@"recipes"] addObject:value];
        [self didChangeValueForKey:@"recipes" withSetMutation:NSKeyValueUnionSetMutation usingObjects:changedObjects];

        [changedObjects release];
    }

    - (void)removeRecipesObject:(Recipe *)value 
    {
        NSSet *changedObjects = [[NSSet alloc] initWithObjects:&value count:1];

        [self willChangeValueForKey:@"recipes" withSetMutation:NSKeyValueMinusSetMutation usingObjects:changedObjects];
        [[self primitiveValueForKey:@"recipes"] removeObject:value];
        [self didChangeValueForKey:@"recipes" withSetMutation:NSKeyValueMinusSetMutation usingObjects:changedObjects];

        [changedObjects release];
    }


    - (NSComparisonResult) compareCategoryNames:(Category *)category
    {
        return [[self name] localizedCaseInsensitiveCompare: [category name]];
    }

    - (NSComparisonResult) compareCategorySortIndeces:(Category *)category
    {

         if ([self sortIndex] > [category    sortIndex]) {
              return (NSComparisonResult)NSOrderedDescending;
         }

         if ([self sortIndex] < [category sortIndex]) {
              return (NSComparisonResult)NSOrderedAscending;
         }
         return (NSComparisonResult)NSOrderedSame;
    }


    @end

-- cdt ファイルからの最初の plist

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
    <plist version="1.0">
    <dict>
        <key>compressedGlobalIDs</key>
        <array>
            <string>0:0:0</string>
            <string>1:1:0</string>
            <string>0:2:0</string>
            <string>0:3:0</string>
            <string>0:4:0</string>
            <string>0:5:0</string>
            <string>0:6:0</string>
            <string>0:7:0</string>
            <string>0:8:0</string>
            <string>0:9:0</string>
            <string>0:10:0</string>
            <string>0:11:0</string>
            <string>0:12:0</string>
            <string>0:13:0</string>
        </array>
        <key>deleted</key>
        <dict/>
        <key>entityNames</key>
        <array>
            <string>Recipe</string>
            <string>Category</string>
        </array>
        <key>inserted</key>
        <dict>
            <key>0</key>
            <dict>
                <key>categories</key>
                <array>
                    <string>1</string>
                </array>
                <key>ctime</key>
                <integer>0</integer>
                <key>name</key>
                <string>Aaa Rx D</string>
                <key>photos</key>
                <array/>
                <key>ptime</key>
                <integer>0</integer>
                <key>recipeID</key>
                <integer>0</integer>
            </dict>
        </dict>
        <key>kvStr</key>
        <string>mobile.F0F5BE6D-59A3-5D63-A0B2-4767EFECC603:1</string>
        <key>modelVersionHash</key>
        <string>9FRYa_LmmBTIAw8875pOlLyYmr5vrP1Hwi~lgvsHL1k=</string>
        <key>peerIDs</key>
        <array>
            <string>mobile.F0F5BE6D-59A3-5D63-A0B2-4767EFECC603</string>
        </array>
        <key>peerStates</key>
        <dict/>
        <key>primaryKeys</key>
        <array>
            <string>p89</string>
            <string>p6</string>
            <string>p43</string>
            <string>p4</string>
            <string>p41</string>
            <string>p5</string>
            <string>p52</string>
            <string>p58</string>
            <string>p68</string>
            <string>p13</string>
            <string>p79</string>
            <string>p28</string>
            <string>p17</string>
            <string>p25</string>
        </array>
        <key>transactionDate</key>
        <real>1343676810.7298651</real>
        <key>transactionNumber</key>
        <integer>1</integer>
        <key>updated</key>
        <dict>
            <key>1</key>
            <dict>
                <key>name</key>
                <string>Desserts</string>
                <key>recipes</key>
                <array>
                    <string>2</string>
                    <string>3</string>
                    <string>4</string>
                    <string>5</string>
                    <string>6</string>
                    <string>7</string>
                    <string>8</string>
                    <string>9</string>
                    <string>0</string>
                    <string>10</string>
                    <string>11</string>
                    <string>12</string>
                    <string>13</string>
                </array>
                <key>sortIndex</key>
                <integer>0</integer>
            </dict>
        </dict>
    </dict>
    </plist>

-2番目のリスト

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
    <plist version="1.0">
    <dict>
        <key>compressedGlobalIDs</key>
        <array>
            <string>0:0:0</string>
            <string>1:1:0</string>
            <string>0:2:0</string>
            <string>0:3:0</string>
            <string>0:4:0</string>
            <string>0:5:0</string>
            <string>0:6:0</string>
            <string>0:7:0</string>
            <string>0:8:0</string>
            <string>0:9:0</string>
            <string>0:10:0</string>
            <string>0:11:0</string>
            <string>0:12:0</string>
            <string>0:13:0</string>
        </array>
        <key>deleted</key>
        <dict/>
        <key>entityNames</key>
        <array>
            <string>Recipe</string>
            <string>Category</string>
        </array>
        <key>inserted</key>
        <dict>
            <key>0</key>
            <dict>
                <key>categories</key>
                <array>
                    <string>1</string>
                </array>
                <key>ctime</key>
                <integer>0</integer>
                <key>name</key>
                <string>Aaa Rx D</string>
                <key>photos</key>
                <array/>
                <key>ptime</key>
                <integer>0</integer>
                <key>recipeID</key>
                <integer>0</integer>
            </dict>
        </dict>
        <key>kvStr</key>
        <string>mobile.F0F5BE6D-59A3-5D63-A0B2-4767EFECC603:1</string>
        <key>modelVersionHash</key>
        <string>9FRYa_LmmBTIAw8875pOlLyYmr5vrP1Hwi~lgvsHL1k=</string>
        <key>peerIDs</key>
        <array>
            <string>mobile.F0F5BE6D-59A3-5D63-A0B2-4767EFECC603</string>
        </array>
        <key>peerStates</key>
        <dict/>
        <key>primaryKeys</key>
        <array>
            <string>p89</string>
            <string>p6</string>
            <string>p43</string>
            <string>p4</string>
            <string>p41</string>
            <string>p5</string>
            <string>p52</string>
            <string>p58</string>
            <string>p68</string>
            <string>p13</string>
            <string>p79</string>
            <string>p28</string>
            <string>p17</string>
            <string>p25</string>
        </array>
        <key>transactionDate</key>
        <real>1343676810.7298651</real>
        <key>transactionNumber</key>
        <integer>1</integer>
        <key>updated</key>
        <dict>
            <key>1</key>
            <dict>
                <key>name</key>
                <string>Desserts</string>
                <key>recipes</key>
                <array>
                    <string>2</string>
                    <string>3</string>
                    <string>4</string>
                    <string>5</string>
                    <string>6</string>
                    <string>7</string>
                    <string>8</string>
                    <string>9</string>
                    <string>0</string>
                    <string>10</string>
                    <string>11</string>
                    <string>12</string>
                    <string>13</string>
                </array>
                <key>sortIndex</key>
                <integer>0</integer>
            </dict>
        </dict>
    </dict>
    </plist>

- 唯一の MOC 保存に続くメッセージ:

2012-07-31 12:38:44.632 iHungryMePlus[688:1b03] +PFUbiquityBaseline metadataFromCurrentBaselineForStoreWithName:modelVersionHash:andUbiquityRootLocation:withError:: CoreData: Ubiquity: メタデータ URL からベースライン メタデータを取得できませんでした: file://localhost/private/ var/mobile/Library/Mobile%20Documents/3PAT8SS34X~com~DrummingGrouse~iHMP/.baseline/current.nosync/com.DrummingGrouse.iHMP.mainstore/9FRYa_LmmBTIAw8875pOlLyYmr5vrP1Hwi~lgvsHL1k=/baseline.meta

エラー: (ヌル)

2012-07-31 12:38:44.818 iHungryMePlus[688:1b03] +PFUbiquityBaseline metadataFromCurrentBaselineForStoreWithName:modelVersionHash:andUbiquityRootLocation:withError:: CoreData: Ubiquity: メタデータ URL からベースライン メタデータを取得できませんでした: file://localhost/private/ var/mobile/Library/Mobile%20Documents/3PAT8SS34X~com~DrummingGrouse~iHMP/.baseline/current.nosync/com.DrummingGrouse.iHMP.mainstore/9FRYa_LmmBTIAw8875pOlLyYmr5vrP1Hwi~lgvsHL1k=/baseline.meta

エラー: (ヌル)

2012-07-31 12:38:44.824 iHungryMePlus[688:1b03] -PFUbiquityBaselineRecoveryOperation メイン: CoreData: ユビキタス: localPeerID: mobile.F0F5BE6D-59A3-5D63-A0B2-4767EFECC603、storeName: com.DrummingGrouse.iHMP.mainstore、modelVersionHash: 9FRYa_LmmBTIAw8875pOlLyYmr5vrP1Hwi~lgvsHL1k=

ubiquityRootLocation: <PFUbiquityLocation: 0x162e10>: /private/var/mobile/Library/Mobile Documents/3PAT8SS34X~com~DrummingGrouse~iHMP

現在のベースライン メタデータに対して nil を取得しました (null)

4

0 に答える 0