Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
pcjbird committed Nov 18, 2024
1 parent 69618b3 commit 5aa96c3
Showing 1 changed file with 43 additions and 43 deletions.
86 changes: 43 additions & 43 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,60 +35,60 @@ pod 'iOSLogBrowserSDK'
## 使用 / Usage

```objc
#import <XLFacility/XLFacilityMacros.h>
#import <iOSLogBrowserSDK/iOSLogBrowserSDK.h>
#import <Reachability/Reachability.h>
#import <XLFacility/XLFacilityMacros.h>
#import <iOSLogBrowserSDK/iOSLogBrowserSDK.h>
#import <Reachability/Reachability.h>
```

```objc
@interface AppDelegate ()
@interface AppDelegate ()

@property(nonatomic, assign) BOOL started;
@property(nonatomic, assign) BOOL started;

@end
@end
```

```objc

@implementation AppDelegate

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Override point for customization after application launch.
self.started = NO;
Reachability* reachability = [Reachability reachabilityForLocalWiFi];
if([reachability isReachable])
{
[self start];
}
__weak typeof(self) weakSelf = self;
reachability.reachableBlock = ^(Reachability *reachability) {
NSLog(@"%@", @"网络可用");
__strong typeof(self) strongSelf = weakSelf;
if(!strongSelf) return;
if(strongSelf.started)
{
return;
}
[strongSelf start];
};
reachability.unreachableBlock = ^(Reachability *reachability) {
NSLog(@"%@", @"网络不可用");
};
[reachability startNotifier];
return YES;
}
-(void) start
{
iOSLogBrowserOption* option = [iOSLogBrowserOption defaultOption];
option.suspendInBackground = YES;
[iOSLogBrowserSDK startWithOption:option];
XLOG_INFO(@"%@", @"您正在使用 iOS 局域网日志查看服务!");
self.started = YES;
}
@end
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Override point for customization after application launch.
self.started = NO;
Reachability* reachability = [Reachability reachabilityForLocalWiFi];
if([reachability isReachable])
{
[self start];
}
__weak typeof(self) weakSelf = self;
reachability.reachableBlock = ^(Reachability *reachability) {
NSLog(@"%@", @"网络可用");
__strong typeof(self) strongSelf = weakSelf;
if(!strongSelf) return;
if(strongSelf.started)
{
return;
}
[strongSelf start];
};
reachability.unreachableBlock = ^(Reachability *reachability) {
NSLog(@"%@", @"网络不可用");
};
[reachability startNotifier];
return YES;
}

-(void) start
{
iOSLogBrowserOption* option = [iOSLogBrowserOption defaultOption];
option.suspendInBackground = YES;
[iOSLogBrowserSDK startWithOption:option];

XLOG_INFO(@"%@", @"您正在使用 iOS 局域网日志查看服务!");
self.started = YES;
}

@end

```
Expand Down

0 comments on commit 5aa96c3

Please sign in to comment.