closed API,private Framework に関する情報も絶賛募集しています。(そうでないとこのwikiの意味がありません。)
適宜コメントを挿入していただけると助かります.
#import <Foundation/Foundation.h>
main(int argv, char* argc[])
{
NSString *src;
NSURL * boardurl;
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
boardurl = [NSURL URLWithString:@"http://menu.2ch.net/bbstable.html"];
src = [NSString stringWithContentsOfURL:boardurl encoding:NSShiftJISStringEncoding error:nil];
NSLog(@"result: %@", src);
[pool release];
}
#import <Foundation/Foundation.h>
main(int argv, char* argc[])
{
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
NSString *src;
NSURL * boardurl;
NSString* parsedString;
NSRange range, subrange;
int length;
boardurl = [NSURL URLWithString:@"http://menu.2ch.net/bbstable.html"];
src = [NSString stringWithContentsOfURL:boardurl encoding:NSShiftJISStringEncoding error:nil];
length = [src length];
range = NSMakeRange(0, length);
while (range.length > 0) {
subrange = [src lineRangeForRange:
NSMakeRange(range.location, 0)];
parsedString = [src substringWithRange:subrange];
NSLog(@"result: %@", parsedString );
range.location = NSMaxRange(subrange);
range.length -= subrange.length;
}
[pool release];
}
/*
* gcc -w -o get_darwinnotify get_darwinnotify.m -I/opt/iphone20-headers/usr/lib/gcc/arm-apple-darwin9/4.0.1/include -I/opt/iphone20-headers/include -I/opt/iphone20-headers/usr/include -I/var/include -L/usr/lib -F/System/Library/Frameworks -F/System/Library/PrivateFrameworks -bind_at_load -lobjc -framework CoreFoundation -framework Foundation -framework UIKit -framework CoreTelephony -framework CFNetwork -framework AudioToolbox -lSystem -lm && ldid -S get_ctnotify
*/
#import <Foundation/Foundation.h>
#import <AudioToolbox/AudioServices.h>
#include <stdio.h>
#include <notify.h>
#include <unistd.h>
#include <stdarg.h>
static void callback(CFNotificationCenterRef center, void *observer, CFStringRef name, const void *object, CFDictionaryRef userInfo) {
if ([name isEqualToString: @"kCTSMSClass0StringReceivedNotification"]) {
NSLog(@"kita-!!\n");
AudioServicesPlaySystemSound(kSystemSoundID_Vibrate);
}
return;
}
static void sigHandler(int sigraised)
{
printf("\nInterrupted.\n");
_exit(0);
}
int main(int argc, char **argv)
{
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
CFNotificationCenterAddObserver(
CFNotificationCenterGetDarwinNotifyCenter(),
NULL,
callback,
@"com.apple.language.changed",
NULL,
CFNotificationSuspensionBehaviorHold
);
signal(SIGINT, sigHandler);
CFRunLoopRun();
return 0;
}
/*
* gcc -w -o get_ctnotify get_ctnotify.m -I/opt/iphone20-headers/usr/lib/gcc/arm-apple-darwin9/4.0.1/include -I/opt/iphone20-headers/include -I/opt/iphone20-headers/usr/include -I/var/include -L/usr/lib -F/System/Library/Frameworks -F/System/Library/PrivateFrameworks -bind_at_load -lobjc -framework CoreFoundation -framework Foundation -framework UIKit -framework CoreTelephony -framework CFNetwork -framework AudioToolbox -lSystem -lm && ldid -S get_ctnotify
*/
#import <Foundation/Foundation.h>
#import <AudioToolbox/AudioServices.h>
#include <stdio.h>
#include <notify.h>
#include <unistd.h>
#include <stdarg.h>
static void callback(CFNotificationCenterRef center, void *observer, CFStringRef name, const void *object, CFDictionaryRef userInfo) {
if ([name isEqualToString: @"kCTSMSClass0StringReceivedNotification"]) {
NSLog(@"kita-!!\n");
AudioServicesPlaySystemSound(kSystemSoundID_Vibrate);
}
return;
}
static void sigHandler(int sigraised)
{
printf("\nInterrupted.\n");
_exit(0);
}
int main(int argc, char **argv)
{
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
CTTelephonyCenterAddObserver(
CTTelephonyCenterGetDefault(),
NULL,
callback,
NULL,
NULL,
CFNotificationSuspensionBehaviorHold
);
signal(SIGINT, sigHandler);
CFRunLoopRun();
return 0;
}