Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/git/20.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios `UIApplicationLegate`to`WKInterfaceController`数据传递_Ios_Objective C_Parse Platform_Watchkit - Fatal编程技术网

Ios `UIApplicationLegate`to`WKInterfaceController`数据传递

Ios `UIApplicationLegate`to`WKInterfaceController`数据传递,ios,objective-c,parse-platform,watchkit,Ios,Objective C,Parse Platform,Watchkit,关于如何将此数据从我的iOSAppDelegate.m传递到我的WatchKitInterfaceController.m有什么想法吗 我在iOSAppDelegate.m - (void)application:(UIApplication *)application handleWatchKitExtensionRequest:(NSDictionary *)userInfo reply:(void(^)(NSDictionary *replyInfo))reply {

关于如何将此数据从我的iOS
AppDelegate.m
传递到我的WatchKit
InterfaceController.m
有什么想法吗

我在iOS
AppDelegate.m

    - (void)application:(UIApplication *)application handleWatchKitExtensionRequest:(NSDictionary *)userInfo reply:(void(^)(NSDictionary *replyInfo))reply {
        NSString * request = [userInfo objectForKey:@"requestString"];
        if ([request isEqualToString:@"executeMethodA"]) {

            // GMT Date from Phone
            NSDate *gmtNow = [NSDate date];
            NSLog(@"GMT Now: %@", gmtNow);
            // Query Parse
            PFQuery *query = [PFQuery queryWithClassName:@"na"];

            [query whereKey:@"dateGame" greaterThanOrEqualTo:gmtNow];

            [query findObjectsInBackgroundWithBlock:^(NSArray *objects, NSError *error) {
                if (!error) {
                    NSMutableArray *localMatchup = [@[] mutableCopy];
                    for (PFObject *object in objects) {

                        // Add objects to local Arrays
                        [localMatchup addObject:[object objectForKey:@"matchup"]];

                        // App Group
                        NSString *container = @"group.com.me.off";
                        NSUserDefaults *defaults = [[NSUserDefaults alloc] initWithSuiteName:container];

                        // Matchup
                        [defaults setObject:localMatchup forKey:@"KeyMatchup"];
                        NSArray *savedMatchup = [defaults objectForKey:@"KeyMatchup"];
                        NSLog(@"Default Matchup: %@", savedMatchup);

                 }


                dispatch_async(dispatch_get_main_queue(), ^{
                    NSLog(@"dispatch");
                });

                reply(@{@"localMatchup": localMatchup});
            }
            else {
                reply(@{@"error": error.description});
            }
        }];
    }
}

很高兴发布任何额外的代码,请提问,谢谢

在您的
handleWatchKitExtensionRequest
方法中有一个
reply
块,请在完成查询时使用dict中的数据运行它

reply(@{@"localMatchup": localMatchup});

handleWatchKitExtensionRequest
方法中有一个
reply
块,当您完成查询时,使用dict中的数据运行它

reply(@{@"localMatchup": localMatchup});

handleWatchKitExtensionRequest
方法中有一个
reply
块,当您完成查询时,使用dict中的数据运行它

reply(@{@"localMatchup": localMatchup});

handleWatchKitExtensionRequest
方法中有一个
reply
块,当您完成查询时,使用dict中的数据运行它

reply(@{@"localMatchup": localMatchup});


我想你可以调用handleWatchKitExtensionRequest方法

我想你可以调用handleWatchKitExtensionRequest方法

我想你可以调用handleWatchKitExtensionRequest方法

谢谢你的回复!是的,我假设我需要
reply
块,但我不知道,因为我在查询中得到了一个
array
,当我执行
reply
部分时,我应该如何将它放入
dict
中。有什么想法吗?只要把它放在字典里{“parseArray”:arrayFromParse}@SRMR是的,你可以把它放在那里。此外,我认为最好在发生错误时也回复一条错误消息。将其放在其他地方的一个单独的
回复中,或者做一个NSLog?@SRMR您已经有了
!如果条件出现错误
只需向其添加一个
else
,并回复如下内容
回复(@{“error”:error.description})
。感谢您的回复!是的,我假设我需要
reply
块,但我不知道,因为我在查询中得到了一个
array
,当我执行
reply
部分时,我应该如何将它放入
dict
中。有什么想法吗?只要把它放在字典里{“parseArray”:arrayFromParse}@SRMR是的,你可以把它放在那里。此外,我认为最好在发生错误时也回复一条错误消息。将其放在其他地方的一个单独的
回复中,或者做一个NSLog?@SRMR您已经有了
!如果条件出现错误
只需向其添加一个
else
,并回复如下内容
回复(@{“error”:error.description})
。感谢您的回复!是的,我假设我需要
reply
块,但我不知道,因为我在查询中得到了一个
array
,当我执行
reply
部分时,我应该如何将它放入
dict
中。有什么想法吗?只要把它放在字典里{“parseArray”:arrayFromParse}@SRMR是的,你可以把它放在那里。此外,我认为最好在发生错误时也回复一条错误消息。将其放在其他地方的一个单独的
回复中,或者做一个NSLog?@SRMR您已经有了
!如果条件出现错误
只需向其添加一个
else
,并回复如下内容
回复(@{“error”:error.description})
。感谢您的回复!是的,我假设我需要
reply
块,但我不知道,因为我在查询中得到了一个
array
,当我执行
reply
部分时,我应该如何将它放入
dict
中。有什么想法吗?只要把它放在字典里{“parseArray”:arrayFromParse}@SRMR是的,你可以把它放在那里。此外,我认为最好在发生错误时也回复一条错误消息。将其放在其他地方的一个单独的
回复中,或者做一个NSLog?@SRMR您已经有了
!如果条件出现错误
只需向其添加一个
else
,并回复如下内容
回复(@{“error”:error.description})
。感谢您的回复!我想这就是我正在使用的方法,对吗?谢谢你的回复!我想这就是我正在使用的方法,对吗?谢谢你的回复!我想这就是我正在使用的方法,对吗?谢谢你的回复!我想这就是我正在使用的方法,对吗?