Can I reset the simulator's contacts and location permission settings for my app, to simulate a first-time usage scenario? - core-location

My iOS app currently has a deployment target of iOS 7 (although my scheme runs the iOS 9.2 simulator), and links with the AddressBook, AddressBookUI, and CoreLocation frameworks. I have a suite of Swift UI tests in Xcode 7 (not in Instruments). When a user first uses my app, they are asked for permission to access their contacts, and their location while the app is running. Since this involves a fair amount of code that needs to execute perfectly, I'd love to automate all of the possible outcomes and ensure the UI is in the desired state.
Can I use Xcode UI testing to reset the Simulator's settings for access to contacts and locations? For example, I could implement this in the setUp() function within my test case class. I've found some tutorials about how to respond to the dialogs, but before I get to that point, I need to simulate the condition where the permissions are requested. Here's a question that explains how to respond to such an alert.

Short answer: no. There is no API for UI Testing to reset the simulator (and therefore reset the permission dialogs). I suggest filing a bug report with Apple explaining why you need this.
UI Testing doesn't make it easy to test "unhappy paths." In your question you mentioned testing all of the flows for permissions. Without manually reseting the simulator between tests this will prove impossible. I suggest only testing the happy path with UI Testing and leaving the other cases to unit tests.
I understand that this is not ideal but for now it's a decent workaround. For what it's worth, that is the approach I take when testing our app. (The app asks for push notifications and location permissions.)

xcrun simctl privacy booted reset location <your_app_bundle_id>
Source: https://developer.apple.com/videos/play/wwdc2020/10647/

In UITesting, it is simple:
let app = XCUIApplication()
app.resetAuthorizationStatus(for: .location)

Here is how I would do it. I would delete the simulator data which will delete the saved settings, hopefully this works in your situation. In Swift:
let filemanager = NSFileManager.defaultManager()
do {
try filemanager.removeItemAtPath(NSHomeDirectory())
}
catch let error as NSError {
print("Ooops! Something went wrong: \(error)")
}
Just figure out a good spot to put that in your code and poof--simulator data gone.

Related

Actions on Google Console showing "Your app must have at least one action to test"

I am having this very weird problem which I don't understand how it happened. I have created this my own app and I added a lot of intents in it. But when I need to test this app under the simulator, I can't seem to set the Test status to active. It says that my app must have at least one action to test. I am really confused because I do have a lot of actions. Is there something that I am missing here?
Then I check the FactsApp sample which Google provided. The Test Status of that app seems to be switchable. I tried to check the settings of that app but I didn't find anything that I missed to set.
Please help. Thanks!
I have managed to solved the problem by myself. It seems to happen that I created an agent in API AI console that consist of a project ID that does that match any of my current projects.
I don't know how I did that. But because I was experimenting with the projects and agents. I somehow created projects of the same name but did not link it properly with the agent that I created.
You can check the project ID of your agent under the settings of that agent. Just click on the small gear located at the left side of your agent name.
So when you create an agent, make sure that its project ID is the same as the project ID of the correct project.
You have to have at least one intent which handles the GOOGLE_ASSISTANT_WELCOME event.
See the docs: https://developers.google.com/actions/apiai/define-actions

Unable to log into WeChat Sandbox

Revisiting a project I've not opened for a month or so I've found that the sandbox account I previously set up cant be accessed, visiting;
http://admin.wechat.com/debug/cgi-bin/sandbox?t=sandbox/login
Allows me to log in via. the scanning of the QR code but after (seemingly) managing to log in it then gives the error 'Unable to initialize'
Previously this worked I'm wondering if there's been an unpublicised change to the WeChat platform?
So I've not been able to figure out if/why the wechat.com sandbox service has stopped working and if I'm an isolated case or it is a common problem
I did discover that the Weixin sandbox service on https://mp.weixin.qq.com/debug/cgi-bin/sandbox allows me to log in / access the same test app tied to my WeChat account so for others having issues the answer may be to use;
https://mp.weixin.qq.com/debug/cgi-bin/sandbox?t=sandbox/login
Same here! The International sandbox is not letting me in, but the Weixin one works.

How to recover from "No authentication methods configured" on login page

While trying to get GitLab Kanban Board to run nicely with my GitLab server I somehow managed to get myself locked out of the latter. Whenever I open the GitLab-URL now there's the message "No authentication methods configured" and no option for logging in.
Unfortunately, I don't even remember the exact settings that I was messing around with at that time, because it was a while ago and it's only now that I found the time for dealing with this problem again. IIRC one of the last things I did was to try and get OAuth working. (And I think that I was changing some settings in the web interface last, not in the settings files.)
Unable to find a solution online, one of the things I tried was to do a backup and then restore that on a different server. But the result is that I then get the same message on the new server also.
Does anyone have any idea on how to recover from this situation? Is there any way for example to enable "normal" login again by changing settings in the database?
If it's not (easily) possible to recover the whole GitLab installation, is there some way to somehow at least extract the bug report data from it? That's the data that I would be most unhappy to loose...
I'd really appreciate any help, because I'm completely at a loss right now!
You can use the Rails console to reenable your sign-in.
sudo gitlab-rails console
s = ApplicationSetting.find_by(signin_enabled: false)
s.signin_enabled = true
s.save
This will modify the rails settings directly.
As of version 10.5.X, use this instead (different ApplicationSetting key)
sudo gitlab-rails console
s = ApplicationSetting.find_by(password_authentication_enabled_for_web: false)
s.password_authentication_enabled_for_web = true
s.save

why does xamarin suddenly not let me deploy to iOS devices

This just started happening today after I got a message from xcode to agree to new t&c's.
I can't put anything on the device, on any of my computers.
Doesn't work on my macbook, doesn't work on my mac mini, doens't work with existing projects that worked fine until yesterday, doesn't even work with completely new projects.
I constantly get the message:
writeDictToFile:1241 open failed for
/Users/georgecook/Desktop/test/iOS/obj/iPhone/Debug/mtouch-cache/install-shadow-directory/339bee33bc83c8e05fbd004dcc732c0b/20715d40747e047ba8a4ce4c1d2672ef90161df5/ManifestCache.plist
: No such file or directory MDMCacheDirectoryManifest:1315
writeDictToFile failed to write to
/Users/georgecook/Desktop/test/iOS/obj/iPhone/Debug/mtouch-cache/install-shadow-directory/339bee33bc83c8e05fbd004dcc732c0b/20715d40747e047ba8a4ce4c1d2672ef90161df5/ManifestCache.plist
: No such file or directory error MT1006: Could not install the
application
'/Users/georgecook/Desktop/test/iOS/bin/iPhone/Debug/test.iOS.app' on
the device Gandalf the white: Your application failed code-signing
checks. Check your certificates, provisioning profiles, and bundle
ids. Probably your device is not part of the selected provisioning
profile (error: 0xe8008015).
No idea why this is suddenly happening - this is really not good - how to resolve this?
I tripped over this one recently too.
The key is this part of the message:
Your application failed code-signing checks. Check your certificates, provisioning profiles, and bundle ids. Probably your device is not part of the selected provisioning profile
Likely, your provisioning profile has expired. The easiest way to solve this is to launch Xcode, create an empty project, and hit Run. This will go over a series of dialog boxes offering you to fix your provisioning profile until it deploys. Once this happens, you can switch back to Visual Studio/Xamarin Studio and deploy.
One reason this can happen is if you have multiple developer accounts set up in XCode. Here are the steps
Verify that your device is on Apple member center
Verify that your device is part of the relevant provisioning profile
Repeat steps 1 and 2 for each account
Create a new project in XCode and run it on the device. XCode may ask you to select the team (if you have multiple accounts)
If you have multiple developer accounts (teams) set up in XCode, the repeat step 4 each time with a new project and select a different team each time.
These steps ensure that XCode clears the way for Xamarin. The idea is that Xamarin does not allow you to decide which "team" to use, so you want to make sure that XCode has done the setup for EVERY team.
I just had this ManifestCache.plist : No such file or directory problem. I checked device logs (View -> Pads -> iOS Device Log) to see why it was happening. Logs said it was rejecting an upgrade. Upgrade, I thought to myself, that doesn't sound right...then I remembered I had an app on my iPhone with the same identifier to.dima.application from a previous version which I forgot to uninstall. Removing the old app cleared up this issue for me. Hope this helps anyone else who has the same problem! :)
It works! I have found the solution.I was facing the same problem. Somehow there was a misconfiguration in Xamarin. The entitlements.plist had a wrong manuel entry. The cert ist checking all the values in it and if you have a manuel entry there it is not working anymore. Apple is searching somehow only for own entry they are needing.
I spent sometime on developer portal to find out the problem, it occurs because of distribution APNS or development. It did not fixed, after restoring all provisioning profiles and certificates, . In my case solution was letting Xamarin choose signing profiles. I did not use info.plist auto signing which did not solve either but changing Project -> iOS Bundle Signing -> Signing identity, Provisioning Profile Auto solved all issues for development and production cases.
I had the same issue, and so I opened Xcode and updated all my profiles, but nothing happened. So I added the device UDID in the developer portal to the team I was developing for, went to Xcode and updated the profiles again, and then it worked. Don't know if the device must be registered to be able to build to device or this triggered some other update to my profiles that suddenly made it work.
Today they published a new revision of the Apple Developer Licence agreement.
The error message was essentially the same as OP's. The true reason only became apparent when creating a new project in XCode on the Mac, where more useful warnings show up in the "Deployment info" section of the "General" tab.
I had to log in to apple.developer.com, there was a red panel asking me to accept the new licence conditions, and as soon as I did that, deploying apps from Xamarin immediately worked again.

Signed J2me app hanging at first start

In my j2me app that is signed by veriSign, has problem in accepting the always or yes permissions the time it has to perform PIM.getInstance().openPIMList(..) action.
When my app perform below line of code very first time of it's installation it hangs and doesn't show up the main screen rather a black background hanged screen. When I exit and restart the application it runs normally without any problem even if I delete it and put it back again and runs fine, except I delete and restart the phone and try to run it again it shows the same problem I described above.
My code of line that causes to ask permissions is here that actually also causes the problem. One more thing this error only occurs on specific phones which actually allow ALWAYS permission on start.
I am checking it over Nokia X2-05 and it shows problem but on Nokia C3-02 it doesn't as it doesn't allow ALWAYS permission automatically on start of app.
private void permissionSettings() throws PIMException {
PIM.getInstance().openPIMList(PIM.CONTACT_LIST, PIM.READ_WRITE);
}
Above is code snippet that hangs at first start.
It sounds like a bug on the handset to me, the TCK tests used to verify j2me libraries are pretty weak so lots of bugs like this find their way through.
It seems that the key is in the permissions, so I would try and play around in this area. Make sure you have the right permissions set in the .jad (before signing), if you can get hold of one try to sign with a certificate in a different security domain or certificate, try changing the permission level before running the applet.
I would expect that you'll only be able to work around the problem, so rather than suggest something specific I would be varying things within those areas.

Resources