Reachability *r = [Reachability reachabilityWithHostName:#"www.google.com"];
This line works fine on device, but on simulator i get crash :
* Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '+[Reachability reachabilityWithHostName:]: unrecognized selector sent to class
Does anyone know why ?
I had almost the same problem, except that linker did not link Reachability after I added it via pod.
internetReachable = [Reachability reachabilityWithHostName:#"www.google.com"];
In this line compiler was giving error 'No known class method for selector reachabilityWithHostName:'.
I tried to readd reachability, tried to clean project, nothing helped. Then I just tried to rewrite this line and it compiled!
internetReachable = [Reachability reachabilityWithHostname:#"www.google.com"];
And now I understand why it worked. Because my old code was taken from another project with other version of Reachability and selector was with 'HostName' but new one is with 'Hostname'.
Before rewriting I was checking if Reachability has this method and it seemed to me that it has and I couldn't understand the problem. It turned out that I didn't notice this small change in one letter!
solved, I was upgrading Reachability, I searched the web and I found that somewhere someone had this before and just delete systemconfiguration framework and re add it, clean the project and then build again and it will work on both simulator and device perfectly
Related
Hey I have this peculiar issue regarding yandex configuration. If I run the app on simulator app crashes with following error:
'NSInvalidArgumentException', reason: '*** -[NSFileManager
contentsOfDirectoryAtURL:includingPropertiesForKeys:options:error:]:
URL is nil'
I have created an environment condition in my applicationDidFinishLaunnchinWithOptions in app delegate that bypasses yandex configuration on simulator:
#if !targetEnvironment(simulator)
let configuration = YMMYandexMetricaConfiguration.init(apiKey: YANDEX_API_KEY)
configuration?.crashReporting = true
YMMYandexMetrica.activate(with: configuration!)
#endif
app uses yandex and doesn't crash but simulator crashes.
I had the same problem. The path to DerivedData must not have whitespaces.
Check if you changed the name of the user folder or the path to the DerivedData.
Changing the name of the user folder helped me.
I am getting the following error:
Terminating app due to uncaught exception 'RLMException', reason: 'Realm version is higher than the current version provided to `setSchemaVersion:withMigrationBlock:`'
How do I update the version provided to setSchemaVersion:withMigrationBlock?
You need to call:
[RLMRealm setSchemaVersion:newVersion withMigrationBlock:^{
// add migration code here
}];
before accessing any Realms.
If you have only made changes to your schema locally (ie you haven't yet shipped your app) you can instead simply delete your Realm files or the entire app from the simulator/device to reset everything.
The error message when hitting this error has been changed here:
https://github.com/realm/realm-cocoa/pull/1167
I am having some problems adding Reachability to my project. I just used Reachability before, but this time I am failing. I always having the error below:
Undefined symbols for architecture armv7:
"_OBJC_CLASS_$_Reachability", referenced from:
objc-class-ref in DelegatePrincipal.o
ld: symbol(s) not found for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)
My project don't use ARC (and I don't want it), base sdk 5.0, ARchitecture standard (armv7) and I already add the SystemConfiguration.framework.
I also tested the Tony million Reachability and it does not work. Same problem.
I saw the same question from other topics, but it was with ARC. My project does not have ARC.
Additionally, i am doing a simple test inside the delegate, as follows:
Reachability *reach = [Reachability reachabilityForInternetConnection];
NetworkStatus netStatus = [reach currentReachabilityStatus];
if (!netStatus == NotReachable) {
NSLog(#"Not connected");
}
Thanks!
Are you sure you added the Reachability.m file to your project?
Check also if it is assigned to your current target.
That error definitely means that the linker did not find the class definition anywhere among the binaries produced by the compiler for the armv7 architecture.
Add Message UI framework in your project..
Hope, this will help you...enjoy..
I am trying to use Reachability in ios 5.1 but it gives me a Match-o Linker error.
I am using Xcode 4.3 and building my app with armv6 and armv7. I have read that Reachability doesn't play nice with armv7, which may be causing the error. Is that true?
If so, is ythere any workaround to get my app checking internet connectivity?
And yes, i have imported both
Reachability.h
and
SystemConfiguration.framework
My sample implementation code is as below:
[[NSNotificationCenter defaultCenter] addObserver:self selector:#selector(checkNetworkStatus:) name:kReachabilityChangedNotification object:nil];
internetReachable = [Reachability reachabilityForInternetConnection];
[internetReachable startNotifier];
hostReachable = [Reachability reachabilityWithHostName: #"www.apple.com"];
[hostReachable startNotifier];
Thanks in advcance!
https://github.com/tonymillion/Reachability
iOS5 / GCD / ARC friendly version
Not sure whether you have solved this problem yet.
But if you read the actual error highlighted in Xcode 4 and if it says something like
"ld: duplicate symbol _OBJC_IVAR_$_Reachability.reachabilityRef in . . . linker command failed with exit code 1 (use -v to see invocation)"
That is saying you have already included Reachability.h and Reachability.m in your project somewhere and you now have included a duplicate copy.
Delete all the duplicate copies of Reachability.h and Reachability.m and leave just 1 copy of it somewhere in your project files.
I ran into this error when building my code with CLANG:
In file included from /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.0.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIKit.h:31,
from /Users/waspfish/Documents/NanaimoStudio/Projects/iPhoneMonk/Projects/IdeaOrganizer/IdeaOrganizer_Prefix.pch:13,
from :1:
/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.0.sdk/System/Library/Frameworks/UIKit.framework/Headers/UILocalizedIndexedCollation.h:13: error: syntax error before ‘AT_NAME’ token
/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.0.sdk/System/Library/Frameworks/UIKit.framework/Headers/UILocalizedIndexedCollation.h:21: error: syntax error before ‘}’ token
/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.0.sdk/System/Library/Frameworks/UIKit.framework/Headers/UILocalizedIndexedCollation.h:23: fatal error: method definition not in #implementation context
compilation terminated.
{standard input}:32:FATAL:.abort detected. Assembly stopping.
I ended up having to exclude the UILocalizedIndexedCollation.h from UIKit.h and everything built fine. Any idea what could have caused the problem? I can't imagine Apple is shipping a defective header file.
The problem comes from SDK 3.0 which now use gcc 4.2 but scan-build still use /usr/bin/gcc. So you need to tell scan-build to use /usr/bin/gcc-4.2 instead.
scan-build --use-cc=/usr/bin/gcc-4.2 xcodebuild -configuration Debug
Et voila!
Apple’s engineer had confirmed that they had a bug in UIKit framework:
We do have a simple workaround for this UIKit bug. In UILocalizedIndexedCollation.h change this:
UIKIT_EXTERN #interface UILocalizedIndexedCollation : NSObject
to
UIKIT_EXTERN_CLASS #interface UILocalizedIndexedCollation : NSObject
Denis2342
Usually when I see something like this I clean the build and restart Xcode, then things were fine. With GCC 4.2 sometimes a bad pch could cuase hiccups like this, but clang uses a totoally different pch implementation. You may want t completely delete the build dir while Xcode is not running.
Technically clang is not supported for iPhone development, but I use it for simulator compiles , and I do not see the compile errors you are seeing, so (at least for me) it works. One thing sticks out in my head, you refer to editing your UIKit.h. I understand what you did that, but tweaking system headers is big no-no. Is there a chance you have done that for other reasons, because if you are not running stock headers there any number of reasons this could be happening.