“有没有办法隐藏?”;“回到狩猎之旅”;从iOS9中的状态栏?
如何以编程方式从状态栏隐藏此<返回Safari 我在我的应用程序中得到它——如果用户想使用他们的Facebook帐户登录,我将从我的应用程序中退出 以下是我不喜欢(希望)在我的应用程序中“返回Safari”的场景“有没有办法隐藏?”;“回到狩猎之旅”;从iOS9中的状态栏?,ios,mobile-safari,ios9,uistatusbar,applinks,Ios,Mobile Safari,Ios9,Uistatusbar,Applinks,如何以编程方式从状态栏隐藏此
不,没有API允许您这样做 你可以通过转发到一个网站,并将其转发回你的应用程序来实现这一点。以下步骤允许您在状态栏中隐藏“返回Safari”,MyApp是示例应用程序名称:
<key>LSApplicationQueriesSchemes</key>
<array>
<string>myapp</string>
</array>
- (void)willLoginWithFacebook
{
__weak __typeof(self) weakSelf = self;
[self.view setUserInteractionEnabled:NO];
[self.sessionManager authenticateViaFacebookWithCompletion:^(NSString *token, NSSet *grantedPermissions,
NSError *error) {
if (error) {
if (error.code != myappErrorCodeCancelled) {
[weakSelf.rootViewController presentError:error];
}
}
else {
[weakSelf authorizeWithFacebookToken:token];
NSString *customURL = @"myapp://";
if ([[UIApplication sharedApplication]
canOpenURL:[NSURL URLWithString:customURL]])
{
NSString *stringURL = @"http://example.com/myapp";
NSURL *url = [NSURL URLWithString:stringURL];
[[UIApplication sharedApplication] openURL:url];
}
else
{
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"URL error"
message:[NSString stringWithFormat:
@"No custom URL defined for %@", customURL]
delegate:self cancelButtonTitle:@"Ok"
otherButtonTitles:nil];
[alert show];
}
};
}];
}
最好不要在这里问测试版操作系统的问题,而是在苹果测试版论坛上。在这里发布-这不是一个与bug相关的问题。我想要一个答案,如果我们可以通过编程或其他方式隐藏它?因为一旦我关闭(删除)Safari浏览器,该消息将被删除。但我不希望出现这种行为,因为我不希望我的用户返回Safari。找到解决方案了吗?@EaswaramoorthyK,不-还没有。我们至少可以覆盖该操作吗?太好了,我有打开其他应用程序的逻辑,然后返回到我的应用程序,这个按钮弄乱了我的整个逻辑-我不明白为什么它可以被禁用?我找不到任何相关文档。我想我们根本摸不着它。
- (void)willLoginWithFacebook
{
__weak __typeof(self) weakSelf = self;
[self.view setUserInteractionEnabled:NO];
[self.sessionManager authenticateViaFacebookWithCompletion:^(NSString *token, NSSet *grantedPermissions,
NSError *error) {
if (error) {
if (error.code != myappErrorCodeCancelled) {
[weakSelf.rootViewController presentError:error];
}
}
else {
[weakSelf authorizeWithFacebookToken:token];
NSString *customURL = @"myapp://";
if ([[UIApplication sharedApplication]
canOpenURL:[NSURL URLWithString:customURL]])
{
NSString *stringURL = @"http://example.com/myapp";
NSURL *url = [NSURL URLWithString:stringURL];
[[UIApplication sharedApplication] openURL:url];
}
else
{
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"URL error"
message:[NSString stringWithFormat:
@"No custom URL defined for %@", customURL]
delegate:self cancelButtonTitle:@"Ok"
otherButtonTitles:nil];
[alert show];
}
};
}];
}