如何 运行 源代码从 Xcode 4.3 到 Xcode 7.1.1 在主线程中发出中止信号 iOS
how to run source code from Xcode 4.3 to Xcode 7.1.1 signal abort in main thread iOS
我已经从这个 link https://github.com/radif/SIPHON-SIP-Client-that-actually-compiles 下载了源代码
当我编译时出现错误,请推荐我如何编译或者我需要更改构建设置的体系结构
/***** SIP ********/
/* */
- (BOOL)sipStartup
{
if (_app_config.pool)
return YES;
self.networkActivityIndicatorVisible = YES;
if (sip_startup(&_app_config) != PJ_SUCCESS)
{
self.networkActivityIndicatorVisible = NO;
return NO;
}
self.networkActivityIndicatorVisible = NO;
/** Call management **/
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(processCallState:)
name: kSIPCallState object:nil];
/** Registration management */
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(processRegState:)
name: kSIPRegState object:nil];
return YES;
}
/* */
- (void)sipCleanup
{
//[[NSNotificationCenter defaultCenter] removeObserver:self];
[[NSNotificationCenter defaultCenter] removeObserver:self
name: kSIPRegState
object:nil];
[[NSNotificationCenter defaultCenter] removeObserver:self
name:kSIPCallState
object:nil];
[self sipDisconnect];
if (_app_config.pool != NULL)
{
sip_cleanup(&_app_config);
}
}
/* */
- (BOOL)sipConnect
{
pj_status_t status;
if (![self sipStartup])
return FALSE;
if ([self wakeUpNetwork] == NO)
return NO;
if (_sip_acc_id == PJSUA_INVALID_ID)
{
self.networkActivityIndicatorVisible = YES;
if ((status = sip_connect(_app_config.pool, &_sip_acc_id)) != PJ_SUCCESS)
{
self.networkActivityIndicatorVisible = NO;
return FALSE;
}
}
return TRUE;
}
/* */
- (BOOL)sipDisconnect
{
if ((_sip_acc_id != PJSUA_INVALID_ID) &&
(sip_disconnect(&_sip_acc_id) != PJ_SUCCESS))
{
return FALSE;
}
_sip_acc_id = PJSUA_INVALID_ID;
isConnected = FALSE;
return TRUE;
}
- (void)initUserDefaults:(NSMutableDictionary *)dict fromSettings:(NSString *)settings
{
NSDictionary *prefItem;
NSString *pathStr = [[NSBundle mainBundle] bundlePath];
NSString *settingsBundlePath = [pathStr stringByAppendingPathComponent:@"Settings.bundle"];
NSString *finalPath = [settingsBundlePath stringByAppendingPathComponent:settings];
NSDictionary *settingsDict = [NSDictionary dictionaryWithContentsOfFile:finalPath];
NSArray *prefSpecifierArray = [settingsDict objectForKey:@"PreferenceSpecifiers"];
for (prefItem in prefSpecifierArray)
{
NSString *keyValueStr = [prefItem objectForKey:@"Key"];
if (keyValueStr)
{
id defaultValue = [prefItem objectForKey:@"DefaultValue"];
if (defaultValue)
{
[dict setObject:defaultValue forKey: keyValueStr];
}
}
}
}
- (void)initUserDefaults
{
#if defined(CYDIA) && (CYDIA == 1)
// TODO Franchement pas beau ;-)
NSUserDefaults *userDef = [NSUserDefaults standardUserDefaults];
NSDictionary *dict = [NSDictionary dictionaryWithObjectsAndKeys:
[NSNumber numberWithInt: 1800], @"regTimeout",
[NSNumber numberWithBool:NO], @"enableNat",
[NSNumber numberWithBool:NO], @"enableMJ",
[NSNumber numberWithInt: 5060], @"localPort",
[NSNumber numberWithInt: 4000], @"rtpPort",
[NSNumber numberWithInt: 15], @"kaInterval",
[NSNumber numberWithBool:NO], @"enableEC",
[NSNumber numberWithBool:YES], @"disableVad",
[NSNumber numberWithInt: 0], @"codec",
[NSNumber numberWithBool:NO], @"dtmfWithInfo",
[NSNumber numberWithBool:NO], @"enableICE",
[NSNumber numberWithInt: 0], @"logLevel",
[NSNumber numberWithBool:YES], @"enableG711u",
[NSNumber numberWithBool:YES], @"enableG711a",
[NSNumber numberWithBool:NO], @"enableG722",
[NSNumber numberWithBool:NO], @"enableG7221",
[NSNumber numberWithBool:NO], @"enableG729",
[NSNumber numberWithBool:YES], @"enableGSM",
[NSNumber numberWithBool:NO], @"keepAwake",
nil];
[userDef registerDefaults:dict];
[userDef synchronize];
#else
NSUserDefaults *userDef = [NSUserDefaults standardUserDefaults];
NSMutableDictionary *dict = [NSMutableDictionary dictionaryWithCapacity: 10];
[self initUserDefaults:dict fromSettings:@"Advanced.plist"];
[self initUserDefaults:dict fromSettings:@"Network.plist"];
[self initUserDefaults:dict fromSettings:@"Phone.plist"];
[self initUserDefaults:dict fromSettings:@"Codec.plist"];
[userDef registerDefaults:dict];
[userDef synchronize];
//[dict release];
#endif // CYDIA
}
- (void)initModel
{
NSString *model = [[UIDevice currentDevice] model];
isIpod = [model hasPrefix:@"iPod"];
//NSLog(@"%@", model);
}
- (UIView *)applicationStartWithoutSettings
{
// TODO: go to settings immediately
UIView *mainView = [[UIView alloc] initWithFrame:[[UIScreen mainScreen]
applicationFrame]];
mainView.backgroundColor = [UIColor whiteColor];
UINavigationBar *navBar = [[UINavigationBar alloc] init];
[navBar setFrame:CGRectMake(0, 0, 320,45)];
navBar.barStyle = UIBarStyleBlackOpaque;
[navBar pushNavigationItem: [[UINavigationItem alloc] initWithTitle:VERSION_STRING]
animated: NO];
[mainView addSubview:navBar];
UIImageView *background = [[UIImageView alloc]
initWithFrame:CGRectMake(0.0f, 45.0f, 320.0f, 185.0f)];
[background setImage:[UIImage imageNamed:@"settings.png"]];
[mainView addSubview:background];
UILabel *text = [[UILabel alloc]
initWithFrame: CGRectMake(0, 220, 320, 200.0f)];
text.backgroundColor = [UIColor clearColor];
text.textAlignment = UITextAlignmentCenter;
text.numberOfLines = 0;
text.lineBreakMode = UILineBreakModeWordWrap;
text.font = [UIFont systemFontOfSize: 18];
text.text = NSLocalizedString(@"Siphon requires a valid\nSIP account.\n\nTo enter this information, select \"Settings\" from your Home screen, and then tap the \"Siphon\" entry.", @"SiphonApp");
[mainView addSubview:text];
text = [[UILabel alloc] initWithFrame: CGRectMake(0, 420, 320, 40.0f)];
text.backgroundColor = [UIColor clearColor];
text.textAlignment = UITextAlignmentCenter;
text.font = [UIFont systemFontOfSize: 16];
text.text = NSLocalizedString(@"Press the Home button", @"SiphonApp");
[mainView addSubview:text];
return mainView;
}
- (UIView *)applicationStartWithSettings
{
/* Favorites List*/
/*
FavoritesListController *favoritesListCtrl = [[FavoritesListController alloc]
initWithStyle:UITableViewStylePlain];
//autorelease];
favoritesListCtrl.phoneCallDelegate = self;
UINavigationController *favoritesViewCtrl = [[[UINavigationController alloc]
initWithRootViewController:
favoritesListCtrl]
autorelease];
favoritesViewCtrl.navigationBar.barStyle = UIBarStyleBlackOpaque;
[favoritesListCtrl release];
*/
/* Recents list */
recentsViewController = [[RecentsViewController alloc]
initWithStyle:UITableViewStylePlain];
//autorelease];
recentsViewController.phoneCallDelegate = self;
UINavigationController *recentsViewCtrl = [[[UINavigationController alloc]
initWithRootViewController:
recentsViewController]
autorelease];
recentsViewCtrl.navigationBar.barStyle = UIBarStyleBlackOpaque;
[recentsViewController release];
/* Dialpad */
phoneViewController = [[[PhoneViewController alloc]
initWithNibName:nil bundle:nil] autorelease];
phoneViewController.phoneCallDelegate = self;
/* Contacts */
ContactViewController *contactsViewCtrl = [[[ContactViewController alloc]
init] autorelease];
contactsViewCtrl.phoneCallDelegate = self;
/* Voicemail */
VoicemailController *voicemailController = [[VoicemailController alloc]
initWithStyle:UITableViewStyleGrouped];
voicemailController.phoneCallDelegate = self;
UINavigationController *voicemailNavCtrl = [[[UINavigationController alloc]
initWithRootViewController:
voicemailController]
autorelease];
voicemailNavCtrl.navigationBar.barStyle = UIBarStyleBlackOpaque;
[voicemailController release];
tabBarController = [[UITabBarController alloc] init];
tabBarController.viewControllers = [NSArray arrayWithObjects:
/*favoritesViewCtrl,*/ recentsViewCtrl,
phoneViewController, contactsViewCtrl,
voicemailNavCtrl, nil];
tabBarController.selectedIndex = 2;
return tabBarController.view;
}
/***** APPLICATION *****/
#if 0 //def __IPHONE_3_0
- (BOOL)application:(UIApplication *)application
didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
if (launchOptions == nil)
{
// Démarrage normal
}
NSURL *url = [launchOptions objectForKey:UIApplicationLaunchOptionsURLKey];
// UIApplicationLaunchOptionsSourceApplicationKey : Pour retrouver l'appli qui lance
if (url != nil)
{
// Démarrage avec URL
}
NSDictionary *userInfo = [launchOptions objectForKey: UIApplicationLaunchOptionsRemoteNotificationKey];
if (userInfo != nil)
{
// Réception d'une notification
}
}
/* Sent to the delegate when a running application receives a remote notification.
* RQ: Ne devrais pas être appelée, le serveur ne devrait pas communiquer avec une
* application lancée.
* RQ: Une appli peut être lancée sans être connectée au serveur (absence de WiFi)
*/
- (void)application:(UIApplication *)application
didReceiveRemoteNotification:(NSDictionary *)userInfo
{
}
#else
- (void)applicationDidFinishLaunching:(UIApplication *)application
{
#if defined(CYDIA) && (CYDIA == 1)
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSLibraryDirectory, NSUserDomainMask, YES);
NSString *libraryDirectory = [NSString stringWithFormat:@"%@/Siphon", [paths objectAtIndex:0]];
mkdir([libraryDirectory UTF8String], 0755);
#endif
_sip_acc_id = PJSUA_INVALID_ID;
isConnected = FALSE;
[self initModel];
self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease];
NSUserDefaults *userDef = [NSUserDefaults standardUserDefaults];
[self initUserDefaults];
if (![[userDef objectForKey: @"username"] length] ||
![[userDef objectForKey: @"server"] length])
{
// self.window.rootViewController = navigationController;
[window addSubview: [self applicationStartWithoutSettings]];
// window.rootViewController=[self applicationStartWithoutSettings] ;
//[window makeKeyAndVisible];
launchDefault = NO;
}
else
{
NSString *server = [userDef stringForKey: @"proxyServer"];
NSArray *array = [server componentsSeparatedByString:@","];
NSEnumerator *enumerator = [array objectEnumerator];
while (server = [enumerator nextObject])
if ([server length])break;// {[server retain]; break;}
//[enumerator release];
// [array release];
if (!server || [server length] < 1)
server = [userDef stringForKey: @"server"];
NSRange range = [server rangeOfString:@":"
options:NSCaseInsensitiveSearch|NSBackwardsSearch];
if (range.length > 0)
{
server = [server substringToIndex:range.location];
}
// Build GUI
callViewController = [[CallViewController alloc] initWithNibName:nil bundle:nil];
[window addSubview: [self applicationStartWithSettings]];
//[window makeKeyAndVisible];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(reachabilityChanged:)
name:kReachabilityChangedNotification
object:nil];
_hostReach = [[Reachability reachabilityWithHostName: server] retain];
[_hostReach startNotifer];
launchDefault = YES;
[self performSelector:@selector(sipConnect) withObject:nil afterDelay:0.2];
if ([userDef boolForKey:@"keepAwake"])
[self keepAwakeEnabled];
}
[window makeKeyAndVisible];
}
#endif
只需转到编辑 -> 转换 -> objective c 弧以添加弧。
我需要修改主文件
int main(int argc, char * argv[]) {
@autoreleasepool {
return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
}
}
我已经从这个 link https://github.com/radif/SIPHON-SIP-Client-that-actually-compiles 下载了源代码 当我编译时出现错误,请推荐我如何编译或者我需要更改构建设置的体系结构
/***** SIP ********/
/* */
- (BOOL)sipStartup
{
if (_app_config.pool)
return YES;
self.networkActivityIndicatorVisible = YES;
if (sip_startup(&_app_config) != PJ_SUCCESS)
{
self.networkActivityIndicatorVisible = NO;
return NO;
}
self.networkActivityIndicatorVisible = NO;
/** Call management **/
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(processCallState:)
name: kSIPCallState object:nil];
/** Registration management */
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(processRegState:)
name: kSIPRegState object:nil];
return YES;
}
/* */
- (void)sipCleanup
{
//[[NSNotificationCenter defaultCenter] removeObserver:self];
[[NSNotificationCenter defaultCenter] removeObserver:self
name: kSIPRegState
object:nil];
[[NSNotificationCenter defaultCenter] removeObserver:self
name:kSIPCallState
object:nil];
[self sipDisconnect];
if (_app_config.pool != NULL)
{
sip_cleanup(&_app_config);
}
}
/* */
- (BOOL)sipConnect
{
pj_status_t status;
if (![self sipStartup])
return FALSE;
if ([self wakeUpNetwork] == NO)
return NO;
if (_sip_acc_id == PJSUA_INVALID_ID)
{
self.networkActivityIndicatorVisible = YES;
if ((status = sip_connect(_app_config.pool, &_sip_acc_id)) != PJ_SUCCESS)
{
self.networkActivityIndicatorVisible = NO;
return FALSE;
}
}
return TRUE;
}
/* */
- (BOOL)sipDisconnect
{
if ((_sip_acc_id != PJSUA_INVALID_ID) &&
(sip_disconnect(&_sip_acc_id) != PJ_SUCCESS))
{
return FALSE;
}
_sip_acc_id = PJSUA_INVALID_ID;
isConnected = FALSE;
return TRUE;
}
- (void)initUserDefaults:(NSMutableDictionary *)dict fromSettings:(NSString *)settings
{
NSDictionary *prefItem;
NSString *pathStr = [[NSBundle mainBundle] bundlePath];
NSString *settingsBundlePath = [pathStr stringByAppendingPathComponent:@"Settings.bundle"];
NSString *finalPath = [settingsBundlePath stringByAppendingPathComponent:settings];
NSDictionary *settingsDict = [NSDictionary dictionaryWithContentsOfFile:finalPath];
NSArray *prefSpecifierArray = [settingsDict objectForKey:@"PreferenceSpecifiers"];
for (prefItem in prefSpecifierArray)
{
NSString *keyValueStr = [prefItem objectForKey:@"Key"];
if (keyValueStr)
{
id defaultValue = [prefItem objectForKey:@"DefaultValue"];
if (defaultValue)
{
[dict setObject:defaultValue forKey: keyValueStr];
}
}
}
}
- (void)initUserDefaults
{
#if defined(CYDIA) && (CYDIA == 1)
// TODO Franchement pas beau ;-)
NSUserDefaults *userDef = [NSUserDefaults standardUserDefaults];
NSDictionary *dict = [NSDictionary dictionaryWithObjectsAndKeys:
[NSNumber numberWithInt: 1800], @"regTimeout",
[NSNumber numberWithBool:NO], @"enableNat",
[NSNumber numberWithBool:NO], @"enableMJ",
[NSNumber numberWithInt: 5060], @"localPort",
[NSNumber numberWithInt: 4000], @"rtpPort",
[NSNumber numberWithInt: 15], @"kaInterval",
[NSNumber numberWithBool:NO], @"enableEC",
[NSNumber numberWithBool:YES], @"disableVad",
[NSNumber numberWithInt: 0], @"codec",
[NSNumber numberWithBool:NO], @"dtmfWithInfo",
[NSNumber numberWithBool:NO], @"enableICE",
[NSNumber numberWithInt: 0], @"logLevel",
[NSNumber numberWithBool:YES], @"enableG711u",
[NSNumber numberWithBool:YES], @"enableG711a",
[NSNumber numberWithBool:NO], @"enableG722",
[NSNumber numberWithBool:NO], @"enableG7221",
[NSNumber numberWithBool:NO], @"enableG729",
[NSNumber numberWithBool:YES], @"enableGSM",
[NSNumber numberWithBool:NO], @"keepAwake",
nil];
[userDef registerDefaults:dict];
[userDef synchronize];
#else
NSUserDefaults *userDef = [NSUserDefaults standardUserDefaults];
NSMutableDictionary *dict = [NSMutableDictionary dictionaryWithCapacity: 10];
[self initUserDefaults:dict fromSettings:@"Advanced.plist"];
[self initUserDefaults:dict fromSettings:@"Network.plist"];
[self initUserDefaults:dict fromSettings:@"Phone.plist"];
[self initUserDefaults:dict fromSettings:@"Codec.plist"];
[userDef registerDefaults:dict];
[userDef synchronize];
//[dict release];
#endif // CYDIA
}
- (void)initModel
{
NSString *model = [[UIDevice currentDevice] model];
isIpod = [model hasPrefix:@"iPod"];
//NSLog(@"%@", model);
}
- (UIView *)applicationStartWithoutSettings
{
// TODO: go to settings immediately
UIView *mainView = [[UIView alloc] initWithFrame:[[UIScreen mainScreen]
applicationFrame]];
mainView.backgroundColor = [UIColor whiteColor];
UINavigationBar *navBar = [[UINavigationBar alloc] init];
[navBar setFrame:CGRectMake(0, 0, 320,45)];
navBar.barStyle = UIBarStyleBlackOpaque;
[navBar pushNavigationItem: [[UINavigationItem alloc] initWithTitle:VERSION_STRING]
animated: NO];
[mainView addSubview:navBar];
UIImageView *background = [[UIImageView alloc]
initWithFrame:CGRectMake(0.0f, 45.0f, 320.0f, 185.0f)];
[background setImage:[UIImage imageNamed:@"settings.png"]];
[mainView addSubview:background];
UILabel *text = [[UILabel alloc]
initWithFrame: CGRectMake(0, 220, 320, 200.0f)];
text.backgroundColor = [UIColor clearColor];
text.textAlignment = UITextAlignmentCenter;
text.numberOfLines = 0;
text.lineBreakMode = UILineBreakModeWordWrap;
text.font = [UIFont systemFontOfSize: 18];
text.text = NSLocalizedString(@"Siphon requires a valid\nSIP account.\n\nTo enter this information, select \"Settings\" from your Home screen, and then tap the \"Siphon\" entry.", @"SiphonApp");
[mainView addSubview:text];
text = [[UILabel alloc] initWithFrame: CGRectMake(0, 420, 320, 40.0f)];
text.backgroundColor = [UIColor clearColor];
text.textAlignment = UITextAlignmentCenter;
text.font = [UIFont systemFontOfSize: 16];
text.text = NSLocalizedString(@"Press the Home button", @"SiphonApp");
[mainView addSubview:text];
return mainView;
}
- (UIView *)applicationStartWithSettings
{
/* Favorites List*/
/*
FavoritesListController *favoritesListCtrl = [[FavoritesListController alloc]
initWithStyle:UITableViewStylePlain];
//autorelease];
favoritesListCtrl.phoneCallDelegate = self;
UINavigationController *favoritesViewCtrl = [[[UINavigationController alloc]
initWithRootViewController:
favoritesListCtrl]
autorelease];
favoritesViewCtrl.navigationBar.barStyle = UIBarStyleBlackOpaque;
[favoritesListCtrl release];
*/
/* Recents list */
recentsViewController = [[RecentsViewController alloc]
initWithStyle:UITableViewStylePlain];
//autorelease];
recentsViewController.phoneCallDelegate = self;
UINavigationController *recentsViewCtrl = [[[UINavigationController alloc]
initWithRootViewController:
recentsViewController]
autorelease];
recentsViewCtrl.navigationBar.barStyle = UIBarStyleBlackOpaque;
[recentsViewController release];
/* Dialpad */
phoneViewController = [[[PhoneViewController alloc]
initWithNibName:nil bundle:nil] autorelease];
phoneViewController.phoneCallDelegate = self;
/* Contacts */
ContactViewController *contactsViewCtrl = [[[ContactViewController alloc]
init] autorelease];
contactsViewCtrl.phoneCallDelegate = self;
/* Voicemail */
VoicemailController *voicemailController = [[VoicemailController alloc]
initWithStyle:UITableViewStyleGrouped];
voicemailController.phoneCallDelegate = self;
UINavigationController *voicemailNavCtrl = [[[UINavigationController alloc]
initWithRootViewController:
voicemailController]
autorelease];
voicemailNavCtrl.navigationBar.barStyle = UIBarStyleBlackOpaque;
[voicemailController release];
tabBarController = [[UITabBarController alloc] init];
tabBarController.viewControllers = [NSArray arrayWithObjects:
/*favoritesViewCtrl,*/ recentsViewCtrl,
phoneViewController, contactsViewCtrl,
voicemailNavCtrl, nil];
tabBarController.selectedIndex = 2;
return tabBarController.view;
}
/***** APPLICATION *****/
#if 0 //def __IPHONE_3_0
- (BOOL)application:(UIApplication *)application
didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
if (launchOptions == nil)
{
// Démarrage normal
}
NSURL *url = [launchOptions objectForKey:UIApplicationLaunchOptionsURLKey];
// UIApplicationLaunchOptionsSourceApplicationKey : Pour retrouver l'appli qui lance
if (url != nil)
{
// Démarrage avec URL
}
NSDictionary *userInfo = [launchOptions objectForKey: UIApplicationLaunchOptionsRemoteNotificationKey];
if (userInfo != nil)
{
// Réception d'une notification
}
}
/* Sent to the delegate when a running application receives a remote notification.
* RQ: Ne devrais pas être appelée, le serveur ne devrait pas communiquer avec une
* application lancée.
* RQ: Une appli peut être lancée sans être connectée au serveur (absence de WiFi)
*/
- (void)application:(UIApplication *)application
didReceiveRemoteNotification:(NSDictionary *)userInfo
{
}
#else
- (void)applicationDidFinishLaunching:(UIApplication *)application
{
#if defined(CYDIA) && (CYDIA == 1)
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSLibraryDirectory, NSUserDomainMask, YES);
NSString *libraryDirectory = [NSString stringWithFormat:@"%@/Siphon", [paths objectAtIndex:0]];
mkdir([libraryDirectory UTF8String], 0755);
#endif
_sip_acc_id = PJSUA_INVALID_ID;
isConnected = FALSE;
[self initModel];
self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease];
NSUserDefaults *userDef = [NSUserDefaults standardUserDefaults];
[self initUserDefaults];
if (![[userDef objectForKey: @"username"] length] ||
![[userDef objectForKey: @"server"] length])
{
// self.window.rootViewController = navigationController;
[window addSubview: [self applicationStartWithoutSettings]];
// window.rootViewController=[self applicationStartWithoutSettings] ;
//[window makeKeyAndVisible];
launchDefault = NO;
}
else
{
NSString *server = [userDef stringForKey: @"proxyServer"];
NSArray *array = [server componentsSeparatedByString:@","];
NSEnumerator *enumerator = [array objectEnumerator];
while (server = [enumerator nextObject])
if ([server length])break;// {[server retain]; break;}
//[enumerator release];
// [array release];
if (!server || [server length] < 1)
server = [userDef stringForKey: @"server"];
NSRange range = [server rangeOfString:@":"
options:NSCaseInsensitiveSearch|NSBackwardsSearch];
if (range.length > 0)
{
server = [server substringToIndex:range.location];
}
// Build GUI
callViewController = [[CallViewController alloc] initWithNibName:nil bundle:nil];
[window addSubview: [self applicationStartWithSettings]];
//[window makeKeyAndVisible];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(reachabilityChanged:)
name:kReachabilityChangedNotification
object:nil];
_hostReach = [[Reachability reachabilityWithHostName: server] retain];
[_hostReach startNotifer];
launchDefault = YES;
[self performSelector:@selector(sipConnect) withObject:nil afterDelay:0.2];
if ([userDef boolForKey:@"keepAwake"])
[self keepAwakeEnabled];
}
[window makeKeyAndVisible];
}
#endif
只需转到编辑 -> 转换 -> objective c 弧以添加弧。
我需要修改主文件
int main(int argc, char * argv[]) {
@autoreleasepool {
return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
}
}