This question is similar this question, but slightly different.
I am trying to retrieve the name of my currently connected wifi network using the Connectivity Plugin.
This answer works perfectly fine in android, and while it sounds like it should work for iOS, I am getting an exception:
PlatformException(UNAVAILABLE, wifi name unavailable, null)
Simple ex. of the code causing the exception (with the assumption I am connected to wifi, also not using an emulator):
Connectivity connectivity = Connectivity();
print(await (connectivity.getWifiName()));
My gut is telling me it may be permission related, but honestly I am not sure.
Cheers and thanks!
Edit:
I just realized, the exception above is thrown by the wifi plugin, which I was also experimenting with.
print(await (Wifi.ssid));
Connectivity simply returns null...
I'll see if I can fix that in the plugin's code. If so, I'll get back to this answer.
However, for now, adding the capability to your project (or simply switching it ON) on Xcode will do it: (no code change in your app required)
# on your project folder, run:
open -a xcode ./ios
In Xcode 12+
On Target > Runner > Signing & Capabilities, use the + Capability button to add the Access WiFi Information capability to your project.
In older Xcode versions
On Runner > Capabilities, switch Access WiFi Information to on.
See:
Related
I'm working on a DriverKit driver. I have it running on macOS, including a very simple client app written in SwiftUI. Everything is working fine there. I've added iPadOS as a destination for the app as demonstrated in the WWDC video on DriverKit for iPadOS. The app builds and runs on my iPad, as expected (after a little work to conditionalize out my use of SystemExtensions.framework for installation on macOS). However, after installing and running the app on an iPad, the driver does not show up in Settings->General, nor in the app-specific settings pane triggered by the inclusion of a settings bundle in the app.
I've confirmed that the dext is indeed being included in the app bundle when built for iPadOS (in MyApp.app/SystemExtensions/com.me.MyApp.MyDriver.dext). I also can see in the build log that there's a validation step for the dext, and that seems to be succeeding.
I don't know why the driver isn't being discovered -- or in any case surfaced to the user -- when the app is installed on the iPad. Has anyone faced this problem and solved it? Are there ways to troubleshoot installation/discovery of an embedded DriverKit extensions on iOS?
Update after further debugging:
I've decided to try to get Apple's DriverKitUserClientSample sample app working on iOS, since some version of that is what was shown in the WWDC video, and it's much simpler than my driver.
I'm able to get it working on macOS, following the instructions for provisioning etc. in the page on the sample app. But I'm having the exact same problem on iPadOS where the app runs fine, but the driver doesn't show up in either general settings, nor the app's own settings page. I'm using manually, explicitly generated App IDs and provisioning profiles for the driver and container app.
Looking at the console logs on the iPad, the only thing I see that seems to have anything to do with the driver (as opposed to the container app) is this line:
debug 15:35:10.872075-0700 installd open(/var/installd/Library/Caches/com.apple.mobile.installd.staging/temp.3XF4J5/extracted/DriverKitSampleApp.app/SystemExtensions/com.openreelsoftware.dext-to-user-client.driver.dext/Info.plist,0x0,0x1b6) = 4
Not sure what that means, except that I worry that = 4 is an error code. Assuming it's the regular open() being used here, 4 is EINTR // Interrupted system call.. Not sure if that really means anything.
I've put my modified version of Apple sample project on GitHub here: https://github.com/armadsen/CommunicatingBetweenADriverKitExtensionAndAClientApp
Any help is most welcome.
So I'm working on a project using flutter in iOS, and I seem to have run into a brick wall.
First, I need to you know I DO have a 100% working copy of the project. No problems, No bugs, etc.
What I'm trying to do is create a second copy of the project with a few minor changes, and get that to work too. (Changes like text colour, and name of the app).
I'm using flutter to program this, running FirebaseAuth to authorize the end-user, and google-maps in the project afterwards.
Now after I made those minor changes, I can't seem to get the second project functional at all. (I've had it functional previously, but that build is lost. I should have used better source control).
Now I know I had to change the bundle identifier in XCode, which I've done both in the info.plist, and the General Tab of the xcode project. (Done opening up the workspace, not the project). Replaced the GoogleServices-Info.plist and added to the project through XCode. I've also replaced the value for the url scheme in the info.plist with the new value from the GoogleServices-Info.plist.
Also changed the API keys with the new ones I'm supposed to have for the new project. And made sure all the normal things like ensuring that Push Notifications are active on the project, etc.
So as far as I can remember, I've done everything that I should to get the project to function... But instead of stalling or giving me errors, it just crashes.
Running through Terminal using the command:
NO_PROXY=localhost,127.0.0.1; flutter run --verbose
I get the following error.
Error connecting to the service protocol: failed to connect to http://127.0.0.1:1033/
If I run it in Xcode I get the following error:
flutter: Phone Auth Verification Failed: Invalid token.
and if I run it in VSCode I don't even get that far.
Error connecting to the service protocol: failed to connect to http://127.0.0.1:1025/
I checked on their individual git's and issues boards, but I couldn't find anything in flutter or firebase that leads me to any idea as to what is even going on.
Does anyone have something like a checklist of places I could look for possible errors? (I'm pretty sure it's likely just a setting in XCode I forgot to change, or something like that). Much appreciated.
Open the Project in Xcode then,
Window > Devices & Simulators
Select the device and
Uncheck Connect Via network.
Unless I enable debugging (Esc > Cmd+D > Debug JS Remotely) then I see this error:
Module AppRegistry is not a registered callable module
This also means that I'm unable to view the bundled app on device. If I try to view the app on device, but still use the dev server (remembering to use an IP address in AppDelegate.m instead of localhost) then I instead get this error:
WebSocket connection failed with error Error Domain=NSPOSIXErrorDomain Code=61 "Connection refused"
even though I've verified that I can open the dev server URL in a browser on the device.
I'm not an iOS developer, so maybe this is really obvious, but how do I go about debugging why these errors are happening, or just not having these errors in the first place?
One reason could be App Transport Security that was added in iOS 9. Please see https://facebook.github.io/react-native/docs/running-on-device-ios.html#app-transport-security for reference. You have to add the NSAllowsArbitraryLoads entry to your Info.plist yourself if you didn't use the React Native CLI to generate your project.
Although this doesn't really answer the 'How do I debug these kinds of generic errors' question, I've found out that in my case the problem was that I created my app using an older version of RN (maybe 0.26?) that had a bug in the scaffolding code it creates (which I stupidly ignored at the time when I found i could work around it by enabling debugging) and updating to newer versions of the app hasn't fixed the issue because that doesn't cause the scaffolding to be updated. By creating a fresh app under RN 0.29, and copying my code into it, everything is now working as expected.
Whenever I try to submit my update to the iOS app store I get an error stating
The network connection was lost.
I tried to submit from the Xcode 6 Beta but I get an error that basically says I cannot submit from Xcode 6 yet.
Does anyone know how I can fix the The network connection was lost.?
I've restarted the iOS device and my MacBook.
Yosemite right now has some bugs that we must report to Apple in order to get solved. For example I cannot drag and drop any element to .h or .m files anymore, it will crash if I do so. I would suggest you to open the console from your 'Other' folder, and try to locate where the problem is happening. Then you will get a better chance of solving it.
I have also problems connecting my WiFi network at home. My work around is to use my phone and USB-cable to connect to the internet. Not nice to have but it works here. I have to mention that I use an old MacBook Pro.
I am developing an ios app that doesn't need an internet connection. I'm using phonegap and jquery-mobile. I'd like to develop offline, but XCode gets stuck with a status saying 'Attaching to iosproj' (iosproj is my project name). After that I cannot stop the stuck task, and have to force-quit XCode. With an internet connection however, everything works just fine. Grateful for any clues.
Edit: XCode seems to install the app fine without a network, but it gets stuck before/durimg receiving the deviceready event.
Update 1: The app runs fine on the simulator with or without the n/w. It is purely the XCode-iOS simulator interaction.
Update 2: When using phonegap (Apache cordova), there's an easy work-around to work offline. Once the project has been built and installed (with a n/w), all subsequent updates to html/js/css/img can be made directly to the www directory in the simulator's Library (under your app folder, in ~/Library/Application Support/iPhone Simulator/6.0/Applications).
The Simulator itself attempts to make an Internet connection to Apple as it launches. In particular, the itunesstored process attempts to connect to ax.init.itunes.apple.com and phobos.apple.com.
[That information comes from LittleSnitch. You would be well advised to install LittleSnitch so that you can be sure of exactly what connection is being attempted here. No one - certainly no developer - should be without it.]
If you find this troublesome (that is, if the connection failure is causing you to be unable to run your app in the Simulator at all) you should file a bug report with Apple. However, I've had no difficulty with this, so perhaps this an Xcode bug. I'd suggest first updating to Xcode 4.5.2 in case it is fixed there.