SBUserNotificationAlert

前言

本文的重点是借助弹框信息,处理各个进程的错误。例如PPPD的MS-CHAP authentication failed: bad username or password

正文


-(void)setAlertHeader:(NSString *)arg1 ;


VPN 连接

  • pppd
MS-CHAP authentication failed: bad username or password

VPN Connection

/System/Library/CoreServices/SpringBoard.app/SpringBoard

see also


%hook SBAlertItemsController

- (void) activateAlertItem:(id)alert {
    if ([alert isKindOfClass:[%c(SBLaunchAlertItem) class]]) {
        int _type = MSHookIvar<int>(alert, "_type");
        char _isDataAlert = MSHookIvar<char>(alert, "_isDataAlert");
        char _usesCellNetwork = MSHookIvar<char>(alert, "_usesCellNetwork");
        if (_type == 1) {
            BOOL cellPrompt = (_isDataAlert != 0 && _usesCellNetwork != 0);
            BOOL dataPrompt = (_isDataAlert != 0 && _usesCellNetwork != 1);
            if (cellPrompt || dataPrompt) {
                [self deactivateAlertItem:alert];
                return;
                
            }
            
        }
    }
    if ([alert isKindOfClass:[%c(SBUserNotificationAlert) class]]) {
        if ([[alert alertMessage] isEqual:CELLULAR_DATA_IS_TURNED_OFF_FOR_APP_NAME_string]) {
            [self deactivateAlertItem:alert];
            return;
        }
    }
    %orig;
}

%end



- (void)willActivate
{
NSLog(@"🐶 ++++++++++++ willActivate 准备 点击了++++++");
%orig;

dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{



id (*returnSheet)(id,SEL) = (id(*)(id,SEL))objc_msgSend;
id sheet = returnSheet(self,@selector(alertSheet));


void (*clickButton)(id,SEL,int,_Bool) = (void(*)(id,SEL,int,_Bool))objc_msgSend;

clickButton(sheet,@selector(dismissWithClickedButtonIndex:animated:),1,1);


void (*alertButton)(id,SEL,id,_Bool) = (void(*)(id,SEL,id,_Bool))objc_msgSend;
alertButton(self,@selector(alertView:clickedButtonAtIndex:),sheet,1);

void (*cancelSend)(id,SEL) = (void(*)(id,SEL))objc_msgSend;
cancelSend(self,@selector(cancel));

});

}
<!-- NS_ENUM 、CF_ENUM是一样的,NS_OPTIONS、CF_OPTIONS是一样的 -->

<!-- https://opensource.apple.com/source/CF/CF-744/CFNumberFormatter.h.auto.html -->

typedef CF_ENUM(CFIndex, CFNumberFormatterStyle) {	// number format styles
	kCFNumberFormatterNoStyle = 0,
	kCFNumberFormatterDecimalStyle = 1,
	kCFNumberFormatterCurrencyStyle = 2,
	kCFNumberFormatterPercentStyle = 3,
	kCFNumberFormatterScientificStyle = 4,
	kCFNumberFormatterSpellOutStyle = 5
};

<!-- typedef signed long CFIndex; -->

typedef CF_ENUM(CFIndex, CFNumberFormatterStyle) {	// number format styles
	kCFNumberFormatterNoStyle = 0,
	kCFNumberFormatterDecimalStyle = 1,
	kCFNumberFormatterCurrencyStyle = 2,
	kCFNumberFormatterPercentStyle = 3,
	kCFNumberFormatterScientificStyle = 4,
	kCFNumberFormatterSpellOutStyle = 5,
	kCFNumberFormatterOrdinalStyle API_AVAILABLE(macos(10.11), ios(9.0), watchos(2.0), tvos(9.0)) = 6,
	kCFNumberFormatterCurrencyISOCodeStyle API_AVAILABLE(macos(10.11), ios(9.0), watchos(2.0), tvos(9.0)) = 8,
	kCFNumberFormatterCurrencyPluralStyle API_AVAILABLE(macos(10.11), ios(9.0), watchos(2.0), tvos(9.0)) = 9,
	kCFNumberFormatterCurrencyAccountingStyle API_AVAILABLE(macos(10.11), ios(9.0), watchos(2.0), tvos(9.0)) = 10,
};

/*	CFNumberFormatter.h







Safari有一个“添加至屏幕”的功能,其实就是在桌面上添加了一个网页书签,App可以使用这个功能来实现创建桌面快捷方式。


<!-- 一、运用基本技术点 -->

JavaScript

Data URI Schema

Socket基本知识

Base64编码

<!-- 二、基本原理 -->

程序内部创建一个简单的Web站点,通过这个站点调用Safari,站点将自定义的Html页面返回给Safari,此时利用Safari的“添加至主屏幕”功能,将自定义的Html制作成桌面书签,当用户点击桌面图标时,则运行自定义的Javascript来进行跳转至App。


<!-- 三、什么是 data URI scheme?节省了一个 HTTP 请求 -->

直接把图像的内容崁入网页里面,这个密技的官方名称是 data URI schema 

<!-- Data URI scheme 的语法 -->

data – 取得数据的协定名称

image/png – 数据类型名称

base64 – 数据的编码方法

iVBOR…. – 编码后的数据

: , ; – data URI scheme 指定的分隔符号



<!-- 四、什么是 Base64 编码? -->

把一些 8-bit 数据翻译成标准 ASCII 字符


<!-- 五、Socket基本知识 -->

使用CocoaHttpServer创建一个本地的站点


https://github.com/robbiehanson/CocoaHTTPServer

 _httpServer = [[HTTPServer alloc] init];
    [_httpServer setType:@"_http._tcp."];
    NSString *webPath = [[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:@"Web"];
//    DDLogInfo(@"Setting document root: %@", webPath);
    [_httpServer setDocumentRoot:webPath];
    [self startServer];

<!-- 创建HttpServer -->

- (void)startServer
{
    // Start the server (and check for problems)
    NSError *error;
    if([_httpServer start:&error])
    {
        DDLogInfo(@"Started HTTP Server on port %hu", [_httpServer listeningPort]);
        // open the url.
        NSString *urlStrWithPort = [NSString stringWithFormat:@"http://localhost:%d",[_httpServer listeningPort]];
        [[UIApplication sharedApplication] openURL:[NSURL URLWithString:urlStrWithPort]];
    }
    else
    {
        DDLogError(@"Error starting HTTP Server: %@", error);
    }
}




<!-- 六、实现 -->


<!--         [[UIApplication sharedApplication] openURL:[NSURL URLWithString:urlStrWithPort]]; -->


https://developer.apple.com/library/ios/documentation/AppleApplications/Reference/SafariWebContent/ConfiguringWebApplications/ConfiguringWebApplications.html





1) 检测Web应用程序当前是否运行在全屏状态,只要检测window.navigator.standalone是否为true就可以了

2) 检测到Web应用程序运行在非全屏状态时就可以提示用户把Web应用程序的图标添加到主屏幕。

3) http://software.hixie.ch/utilities/cgi/data/data



iOS App创建桌面快捷方式  https://github.com/lijianfeigeek/iOS-desktop
https://github.com/cubiq/add-to-homescreen/zipball/master

mobile-bookmark-bubble: https://code.google.com/archive/p/mobile-bookmark-bubble/


<!-- 如果非全屏,那么我们显示引导页,如果是全屏,我们就打开一个链接 -->

涉及:OpenUrl、iOS shceme、Data URI Scheme、JS、Socket#

<!-- 在Safari中,有一个功能叫:添加到主屏幕,而我们将使用这个入口去实现这个功能。 -->

<!-- [[UIApplication sharedApplication] openURL:[NSURLURLWithString:@"tel://xxx"]]; -->

<!-- JS -->

<script>
if (window.navigator.standalone == true)
{
    // 全屏状态的时候 模拟点击事件,即打开app---webKit---通过快捷方式打开的Safari是全屏的
    var lnk = document.getElementById("你的带scheme的<a>标签ID").click();
    //通过你所知道的方式打开一个scheme,上面这句话的链接标签如:<a href="tel://xxx">
}
else
{
    document.getElementById("msg").innerHTML='<div style="font-size:12px">
    可以插入引导页</div>';
    //这里你可以去加载你的引导页
}
</script>

<!-- 通过DataURI,我们可以把图片进行base64编码直接存储在页面中 -->

    <link rel='apple-touch-icon' href='data:image/jpeg;base64,/9j/4AAQSkZJRgABAQEASABIAAD/2wBDAAcFBQYFBAcGBgYIBwcICxILCwoKCxYPEA0SGhYbGhkWGRgcICgiHB4mHhgZIzAkJiorLS4tGyIyNTEsNSgsLSz/2wBDAQcICAsJCxULCxUsHRkdLCwsLCwsLCwsLCwsLCwsLCwsLCwsLCwsLCwsLCwsLCwsLCwsLCwsLCwsLCwsLCwsLCz/wAARCAC0ALQDASIAAhEBAxEB/8QAHwAAAQUBAQEBAQEAAAAAAAAAAAECAwQFBgcICQoL/8QAtRAAAgEDAwIEAwUFBAQAAAF9AQIDAAQRBRIhMUEGE1FhByJxFDKBkaEII0KxwRVS0fAkM2JyggkKFhcYGRolJicoKSo0NTY3ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqDhIWGh4iJipKTlJWWl5iZmqKjpKWmp6ipqrKztLW2t7i5usLDxMXGx8jJytLT1NXW19jZ2uHi4+Tl5ufo6erx8vP09fb3+Pn6/8QAHwEAAwEBAQEBAQEBAQAAAAAAAAECAwQFBgcICQoL/8QAtREAAgECBAQDBAcFBAQAAQJ3AAECAxEEBSExBhJBUQdhcRMiMoEIFEKRobHBCSMzUvAVYnLR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MR0wB7UEc04nB5oPNIkZSH0p3FIaAEx6daTnNO4x0pDQO4LkjmjFApfxosK43aPWinFeaKNB3ZzcJHHWrkfKjvVSDkA+1Wo8e9caOgtRkAetTqfyquvHFTKccVaEydWxUgOeMGokPNSA4PWtUQOHHrWD41sri98J3P2QL9qgaO4iJO0Bo3D9e3ANbwz6Vl+Kra4vPCGrW1oXFxLaSKm1dxyVPAHrTW4jJ+GloIfA9pcbzJLevJdyMzZYs7E8n1xgfhXXgVxfhLxJ4bsPD+n6XHf29nLFCqtBcZhffj5vlfBJzmuri1C1njDR3ELg91cEU2tRWOD1FNaf4yWot2lt7c26HchXy5rdCTIG77t7qB9c16JjmuVurmOD4ladvI/0rTpoojnjcroxH5fyrp/MTHLDH1qxM5nxdIml6pouvPIEitrj7LNnoI5sLn8GCH86b4LgW6fVfERzv1e5Ypk/8sY8pHj6gE/jS+PL7SH8G6paX09s7y27rDCzKXeTadm1epOcYxW7otp9h0KxtfJWHyYETy16KQo4FAi0R6D8aTB9akOcU0mkCsRkGjGRT+vak+lILIZ360bjTiARzSHApisGP/1UmKcM4pDmkVYOPSikIPvRQOxzcIyv0qynSiiuRG5bi5YCrCdBRRViJk55pynKiiitEQx4GBTs80UUxI5TUrG11X4lWdtewR3ENtp0lwiSKGXezqhJB68D9TWhL4J8M3B3SaFYZJ5IgVf5CiimSiJ/h34Wllgm/smFHt23LsyueCMHHUe1WrrwP4auowsuj22P9hNn8sUUVSE9znotA0nRPippsen6dbW6y6bMWCxjqrpg/XkjNd2SaKKroJjaAKKKQxjHBHFBoooGthGGCBSEdqKKRIo6CnACiil1GG0UUUVQj//Z'>




https://github.com/ldhlfzysys/AddIconToScreen/blob/master/AddIconToHome/Web/content.html




<!-- 如何让Safari 知道?其实很简单,就一个meta, -->

<!-- https://developer.apple.com/library/content/documentation/AppleApplications/Reference/SafariWebContent/ConfiguringWebApplications/ConfiguringWebApplications.html -->

<link rel="apple-touch-icon" href="touch-icon-iphone.png">
<link rel="apple-touch-icon" sizes="152x152" href="touch-icon-ipad.png">
<link rel="apple-touch-icon" sizes="180x180" href="touch-icon-iphone-retina.png">
<link rel="apple-touch-icon" sizes="167x167" href="touch-icon-ipad-retina.png">


<!-- Specifying a Launch Screen Image -->

<link rel="apple-touch-startup-image" href="/launch.png">






<!-- http://cubiq.org/add-to-home-screen?utm_source=caibaojian.com -->

// default options
ath.defaults = {
    appID: 'org.cubiq.addtohome',       // local storage name (no need to change)
    fontSize: 15,               // base font size, used to properly resize the popup based on viewport scale factor
    debug: false,               // override browser checks
    logging: false,             // log reasons for showing or not showing to js console; defaults to true when debug is true
    modal: false,               // prevent further actions until the message is closed
    mandatory: false,           // you can't proceed if you don't add the app to the homescreen
    autostart: true,            // show the message automatically
    skipFirstVisit: false,      // show only to returning visitors (ie: skip the first time you visit)
    startDelay: 1,              // display the message after that many seconds from page load
    lifespan: 15,               // life of the message in seconds
    displayPace: 1440,          // minutes before the message is shown again (0: display every time, default 24 hours)
    maxDisplayCount: 0,         // absolute maximum number of times the message will be shown to the user (0: no limit)
    icon: true,                 // add touch icon to the message
    message: '',                // the message can be customized
    validLocation: [],          // list of pages where the message will be shown (array of regexes)
    onInit: null,               // executed on instance creation
    onShow: null,               // executed when the message is shown
    onRemove: null,             // executed when the message is removed
    onAdd: null,                // when the application is launched the first time from the homescreen (guesstimate)
    onPrivate: null,            // executed if user is in private mode
    privateModeOverride: false, // show the message even in private mode (very rude)
    detectHomescreen: false     // try to detect if the site has been added to the homescreen (false | true | 'hash' | 'queryString' | 'smartURL')
};

转载请注明: > SBUserNotificationAlert

在操作过程或者文章有问题的话欢迎在 原文 里提问或指正。

赞赏支持

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码支持
扫码打赏,你说多少就多少
最近的文章

usefulConfig

前言正文tweak /Package/Library/MobileSubstrate/DynamicLibraries/.plist <?xml version="1.0" encoding="UTF-8"?><!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"><plist version="1.0...…

tool继续阅读
更早的文章

ImplementingaVoIPApp

前言写本文的初心是实现开机自启动app的功能,即Apple官方说的:An app with this key is also relaunched in the background immediately after system boot to ensure that the VoIP services are always available.正文 StrategiesforImplementingYourApp Legacy VoIP background ...…

iOSre继续阅读
更多