Apple は開発者ポータルをシャットダウンしてセキュリティ アップグレードを保留しているため、ステータス ページを作成して、オンラインに戻した機能を監視できるようにしました。このステータス ページの変更を監視する簡単なプログラムを作成しました。
Mac は、iPhone に送信された iMessage を受信するように設定されています。Apple のステータス ページが変更されたときに、私が作成したプログラムで iMessage を iPhone に送信できるかどうか、誰かが知っているかどうか疑問に思っています。
私は通常、iPhone 向けに開発を行っているので、人々が提供できる洞察に感謝します。私が以下に書いた簡単なプログラムは、更新があったかどうかを 15 分ごとにチェックし、更新があれば Safari に更新ページを表示します。
#import "AppDelegate.h"
@implementation AppDelegate
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification
{
// Insert code here to initialize your application
NSDateFormatter *format = [NSDateFormatter new];
[format setTimeZone:[NSTimeZone timeZoneForSecondsFromGMT:8*3600]];
[format setDateFormat:@"YYYY-MM-DD HH:mm:ss"];
NSString *text = @"";
bool no_connection;
do {
text = [[NSString alloc]initWithContentsOfURL:[NSURL URLWithString:@"https://developer.apple.com/support/system-status/"] encoding:NSASCIIStringEncoding error:NULL]; // pulls the source html from Apple's update page
NSString *status = @"No change";
if ([text rangeOfString:[self currentStatus]].location == NSNotFound) { // if cannot find the old text, then there has been a change
status = @"Update!";
}
no_connection = text == nil || [text length] == 0; // if no text or nil text then connection issue
if (no_connection) {
status = @"error making connection";
}
NSLog(@"status: %@",status); // report on status
if (no_connection) { // if no connection then try again in a minute
sleep(60);
continue;
}
sleep(900); // wait 15 minutes (60 x 15 = 900) and check again
} while ([text rangeOfString:[self currentStatus]].location != NSNotFound); // continue checking until there has been a change
NSURL *url = [NSURL URLWithString:@"https://developer.apple.com/support/system-status/"]; // bring up the update page in the browser
if( ![[NSWorkspace sharedWorkspace] openURL:url] )
NSLog(@"Failed to open url: %@",[url description]);
}
-(NSString*)currentStatus { /* returns the specific text in the html source that I'm checking for a change
"<span>" will be replaced with a hyperlink tag */
return @"<span>Certificates, Identifiers & Profiles";
}
@end