Different paths for companion app and extension app in same App Group - swift

I have enabled app groups in my iOS app and watchkit app. My provisioning profile is also managed by XCode. The both apps iOS app and WatchKit App runs fine.
When I try to access the path of shared container from iOS app and watchkit extension using following statement, I get different paths.
let directory: NSURL = NSFileManager.defaultManager().containerURLForSecurityApplicationGroupIdentifier("group.com.myapp")
Does anyone have any idea, what I am doing wrong here?

Related

WatchOS app cannot start with error Domain: "IDELaunchErrorDomain Code: 15" on Xcode 11 beta

Want to run app under watchOS getting error under Xcode beta:
Domain: IDELaunchErrorDomain Code: 15 Failure Reason: Build and Run launch failed as the app to run does not appear to be known by the system.
My solution was to add to watch app scheme iOS target like in screenshot:
However I reported to Apple about such behavior.
This happened to me after modifying the bundle identifier.
Following these steps works for me:
Delete all the Schemes
Select the WatchKit App target and under General > Embedded Content remove the WatchKit Extension
Select the WatchKit Extension target and under Info > NSExtension > NSExtensionAttributes > WKAppBundleIdentifier make sure it is the same identifier the WatchKit App
Clean Build (just in case)
Select again the WatchKit App target and under General > Embedded Content add the WatchKit Extension
Add a new Scheme for the WatchKit App
Edit the new Scheme and in Build add a the target for: (credits to Evgeny Zrorin)
The iOS App target if your WatchKit App is a companion of an iOS App
The iOS target generated by Xcode if your WatchKit App is a standalone App
You must have 2 targets in your Scheme > Build, run your app and good luck
With your WatchKit app selected under your targets, go to 'Build Phases', expand the 'Dependencies' and the 'Embed App Extensions' sections and make sure that the correct Watchkit App Extension is present there. If you duplicated your target, it is possible that an old unrelated WatchKit extension sitting over there is creating the problem.

Application not running in apple watch simulator due to bundle identifier issue

I'm building an apple watch application for which i created a AppGroup and also setting the provisioning profile and the certificate.
Now the issue is while building/running the "watchkit app" xcode is throwing an error saying,
warning: Capabilities that require entitlements from “appname WatchKit Extension/appname WatchKit Extension.entitlements" may not function in the Simulator because the provisioning profile specified in your build settings (“WatchKitProfile”) has an AppID of “com.id.watchApp” which does not match your bundle identifier “com.id.watchApp.watchkitextension”.
and nothing is showing in the applewatch simulator.But application is working fine in iPhone simulator.
Even the applewatch methods are not calling WKInterfaceController.openParentApplication
One more doubt, I'm using the appgroup which already used by other members.Will this create any problem or is this the issue for this warning.
Can anyone please help me on this.
When you create an App ID, you need to regenerate your provisioning profiles because they will not have the newly created App ID listed. Xcode can do this for you automatically as a "Fix Issue" prompt.
Ensure once you have created your App ID, you add it both the main app and the watch kit app extension via the capabilities tab and click on Fix Issues until it is all ok.

ios registering document in document files

I am working on app that reads gpx (topografix) file attached to an email. I have successfully registered this document type to my app so whenever I select such a file I get the option to open it by this app on iPhone. It works fine on my iPhone but on iPad my app is not recognised for opening such a file so my app does not appear on the list of apps that are capable to open it. This app uses iPhone environment and is set for iPhone not for universal environment. By changing on universal environment does not change anything. Why is my app not recognised in the list?
Well the conversion of an iphone app to ipad app has to be done if you want to make it universal.
refer this

Xcode wont allow 2 projects on my phone at a time.?

I've been working on a few apps and now when I run them on my iPhone, Xcode will only let one app be on my phone at a time, and if I load up another app in xcode, and try to run it, it kind of over writes the first app instead of haveing two apps on.
Have I done something wrong or is this the new Xcode and iOS6 to stop piracy?
No, the apps probably have the same bundle identifier. I'd check your project settings to make sure each app has a unique bundle identifier.

Using iCloud in iOS Simulator

In my App, when I try to run code in the iOS Simulator:
NSURL *iCloudURL = [fileManager URLForUbiquityContainerIdentifier:#"2VHM28566N.com.eept.TestICloud"];
NSLog(#"IS ICloud : %#", [iCloudURL absoluteString]);
It shows that iCloudURL is nil.
Can we use iCloud without an iPhone device?
I tried to run my iCloud app today on the simulator and there is no option to enable iCloud in the simulator as far as I can see. I looked in settings, but no luck. So the answer would be no, you can't really test iCloud unless you test it on an actual device.
If anyone has a workaround, that would be fabulous. It's a bit tedious to always test your app on the device.
In Xcode 5:
iOS Simulator now supports iCloud syncing of documents and KVS data
within an app, enabling apps to sync between devices using iCloud.
This feature is useful when testing to ensure that the app documents
and data are syncing properly across multiple devices.
Note: With the app running in the iOS Simulator, sign in to an Apple
ID account using the Settings app. After signing in, use the “Trigger
iCloud sync” command in the Debug menu to tell the simulator to sync
with other devices.
I know this is an old topic, but you can test iCloud by changing your deployment target to 'Device'. Plug your device in via USB and let the fun begin.
I would imagine that this is done for security reasons, and for a very good reason at that.
Because your device will have a mobile provisioning certificate which ties up with your iCloud 'bucket' as well as your App Bundle ID, it ensures that only you (your app and allowed devices) have access to your provisioned iCloud bucket.
If you could run it on the simulator without having all of these certificates and ID's in place, you could easily get a team ID from any other app which you download, slap together a project using that identifier and without a certificate marrying up developer, with iCloud bucket, you'd get full access to another App's bucket.
All I did to get around this was order a 5m USB extension so I can have my iPads, iPods and iPhones on the desk in front of me without having to crouch under a desk or sit in awkward positions whilst testing.
edit Just to add an slightly clearer answer as to what allthewayapps asks about the bundle ID.
2VHM28566N.com.eept.TestICloud
is made up of 3 parts in this case:
2VHM28566N - Being the TeamID which Apple assign you when you register as a developer
com.eept - Reverse domain notation of the App's related website i.e. Apple apps would have com.apple
TestICloud - The name of that app itself.
In short its:
teamid.com.yourdomain.appname
Hope this helps.