reachability

AFNetworking 2.0 Reachability not working

流过昼夜 提交于 2020-02-01 05:07:18
问题 I'm having some trouble making AFNetworking Reachability module to work. I have setup my AFHTTPRequestOperationManager with a ReachabilityStatusChangeBlock but it's never being called. self.manager = [[AFHTTPRequestOperationManager alloc] initWithBaseURL:[NSURL URLWithString:@"http://192.168.1.2:3000"]]; self.manager.responseSerializer = [AFJSONResponseSerializer serializer]; NSOperationQueue *operationQueue = self.manager.operationQueue; [self.manager.reachabilityManager

How to return BOOL when checking internet connection in XCODE

坚强是说给别人听的谎言 提交于 2020-01-21 18:38:47
问题 I want to be able to check for internet connectivity when my View loads. To predetermine the contents of my view. I have the following viewDidLoad method: - (void)viewDidLoad { [super viewDidLoad]; if(![self hasInternetConnection]){ NSLog(@"SHOW ORIGINAL DOC"); } else{ NSLog(@"SHOW NEW DOC"); } } And I have a method called hasInternetConnection as follows: - (BOOL)hasInternetConnection{ NSLog(@"Starting connection test"); internetReachableFoo = [Reachability reachabilityWithHostname:@"www

How to know whether actual internet is available or not in Swift?

别等时光非礼了梦想. 提交于 2020-01-17 14:49:08
问题 I want to get notified when my WiFi Router color changes from Green to Red I am making an app which will tell you whether you are online or offline from menu bar in Swift which is open source & can be found at https://github.com/deadcoder0904/net-alert I want to know if its possible to get notified when WiFi color changes in Swift. I can't constantly ping my server to know that the color changed as this would be wasting internet resources. So is it possible to know this in Swift? 回答1: First

“Reachability.h” "Reachability.m gives an Apple mach-o linker error while adding them

浪尽此生 提交于 2020-01-16 19:45:09
问题 I am creating an iPhone application, and I am using RestKit api to connect to the server. I am facing a problem whenever I add the Reachability.m and Reachability.h into the second UIViewController of the project. I tried making a new .m file in Xcode4 and now I get an Apple macho-linker (id) error on all tabst. I added it to the first UIViewcontroller it works normally, but when I try to add it to any other forms I receive this error. 回答1: Have you added the SystemsConfigurations.Framework

Reachability sample code

|▌冷眼眸甩不掉的悲伤 提交于 2020-01-14 06:11:08
问题 I am using Reachability sample code from Apple site. I have added Reachability.h and Reachability.m files to my project, also I have added SystemConfiguration.framework. Added #import "Reachability.h" to my view controller .m file and declared reachability variable in my view controller .h file. Everything compiles without errors until I start using Reachability instances. I get ReachableViaWiFiNetwork and ReachableViaCarrierDataNetwork undeclared error. Why does this happen? reachability =

Reachability sample code

我们两清 提交于 2020-01-14 06:09:38
问题 I am using Reachability sample code from Apple site. I have added Reachability.h and Reachability.m files to my project, also I have added SystemConfiguration.framework. Added #import "Reachability.h" to my view controller .m file and declared reachability variable in my view controller .h file. Everything compiles without errors until I start using Reachability instances. I get ReachableViaWiFiNetwork and ReachableViaCarrierDataNetwork undeclared error. Why does this happen? reachability =

Reachability on iPhone app with a false positive - will it get past apple?

僤鯓⒐⒋嵵緔 提交于 2020-01-13 19:20:08
问题 I am using this code... Reachability *r = [Reachability reachabilityWithHostName:@"www.maxqdata.com"]; NetworkStatus internetStatus = [r currentReachabilityStatus]; if ((internetStatus != ReachableViaWiFi) && (internetStatus != ReachableViaWWAN)) { UIAlertView *myAlert = [[UIAlertView alloc] initWithTitle:@"No Internet Connection" message:@"You require an internet connection via WiFi or cellular network for location finding to work." delegate:self cancelButtonTitle:@"Ok" otherButtonTitles:nil

Can I programmatically flip Info.plist values while my application is running?

大憨熊 提交于 2020-01-13 10:03:11
问题 I am interested in using the SBUsesNetwork and UIRequiresPersistentWiFi keys in my application; however, I would like to enable them only when using a certain set of view controllers. Is there a way to programmatically flip those key values while the application is running? 回答1: You can't modify your bundle contents while running, you don't have write access to that directory. I'm not sure there's a way to do exactly what you want. 回答2: I know you can get your info.plist as an NSDictionary

Can I programmatically flip Info.plist values while my application is running?

徘徊边缘 提交于 2020-01-13 10:02:53
问题 I am interested in using the SBUsesNetwork and UIRequiresPersistentWiFi keys in my application; however, I would like to enable them only when using a certain set of view controllers. Is there a way to programmatically flip those key values while the application is running? 回答1: You can't modify your bundle contents while running, you don't have write access to that directory. I'm not sure there's a way to do exactly what you want. 回答2: I know you can get your info.plist as an NSDictionary

找不到头文件xxxxx.h file not found

99封情书 提交于 2020-01-09 23:47:44
项目里有该文件,但是还是显示找不到。或者是cocopods打开的项目。 原因:.h文件路径找不到。具体找不到的原因有很多种。 1、一般会设置 IOS引用三方framewrok的头文件出现'xxxxx/xxxx.h' file not found问题解决方法 例如:xxxxxx'MAMapKit/MAMapKit.h' file not found 我们平时添加三方framework一般会这么设置。 小伙伴们,如果你遇到了上面说的错就看一下下面这张图是否做了同样的设置。 如果还是不行的话,很有可能是上面 填的路径根文件夹实际路径不同。 2、还有可能pods 的头文件找不到 #import "Reachability.h"找不到 首先找到下面配置文件: Reachability-Private.xcconfig 查看里面内容: #include "Reachability.xcconfig" GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Private/Reachability" "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}