watchkit

Apple Watch app detect if a apple watch is paired with the phone

时光总嘲笑我的痴心妄想 提交于 2019-12-21 04:20:49
问题 When the user opens the app on the phone is there a way to detect if the phone is paired/connected to a apple watch? 回答1: There is no built-in method (at least in the WatchKit SDK) to determine if a Watch has been paired with an iPhone. A common strategy is to write a BOOL to a shared NSUserDefaults (using app groups) so that the iPhone knows that the Watch app has been run at least once. That's the technique I've used in my own app. 回答2: So on WatchOS 2 that is possible ! You have to do on

Cocoa pods and Watchkit Extesion

老子叫甜甜 提交于 2019-12-20 21:05:12
问题 I try to build a WatchKit Extension for my app... I Updated the pods file to look like this: platform:ios, '8.0' use_frameworks! source 'https://github.com/CocoaPods/Specs.git' link_with 'my-team-ios', 'My Team WatchKit Extension' def shared_pods pod 'DOSingleton' pod 'JSONModel' pod 'MagicalRecord' end target :'My App' do shared_pods pod 'Facebook-iOS-SDK', '~> 3.23.1' pod 'Reveal-iOS-SDK', :configurations => ['Debug'] ... some more pods here... end target :'My Team WatchKit Extension' do

Core Data with WatchKit and iOS App

ⅰ亾dé卋堺 提交于 2019-12-20 14:31:48
问题 This question has already been asked, but has received no answers. My iOS app and my WatchKit extension share an App Group in which a Core Data store persists. The Core Data model (simplified) is a Person object that has an attribute for Age. Both the app and extension can change the age at will. If the value for a person changes on the watch, the app does not reflect it unless I close and rerun the app. Same going the opposite direction. If I try to change the age on the watch to 20, and

Trying to get button to spin in WatchKit

旧城冷巷雨未停 提交于 2019-12-20 06:41:16
问题 the code i'm using works just fine in swift for iPhone apps but not in the WatchKit 7.0 beta. the outlets and actions are different. I'm not sure what needs to change to make it work in WatchKit. please help! import WatchKit import Foundation class InterfaceController: WKInterfaceController { @IBOutlet var spinButton: WKInterfaceButton! var isRotating = false override func awakeWithContext(context: AnyObject?) { super.awakeWithContext(context) // Configure interface objects here. } override

WatchKit Extension not working under CocoaPods

≡放荡痞女 提交于 2019-12-20 05:52:36
问题 Using iOS-8.3, Xcode-6.3.1 and MacOS-10.10.3 - The CocoaPods (v0.37.1) installation of the RealmSwift (v0.92.3) described here and here basically works, except the WatchKit Extension does not find any Realm keywords. My Podfile looks as follows: xcodeproj 'MyApp.xcodeproj' workspace 'MyApp.xcworkspace' platform :ios, '8.3' source 'https://github.com/artsy/Specs.git' source 'https://github.com/CocoaPods/Specs.git' use_frameworks! def shared_pods pod 'RealmSwift', '>= 0.92.3' end target 'MyApp'

How to build an application with the watchOS 2 SDK

二次信任 提交于 2019-12-20 04:23:16
问题 In the last submission of our application, we have received this warning : Invalid WatchKit Support - Starting April 1, 2018, all apps submitted to the App Store for Apple Watch must be built with the watchOS 2 SDK or later My question is to know how to to build the application with the watchOS 2 SDK? I was thinking that is enough to build with XCODE 9. Thank's. 回答1: Check your Deployment Target. It's likely it wasn't updated just by using a newer version of Xcode. Also try checking Base SDK

Apple Watch “No such module 'Alamofire'”

百般思念 提交于 2019-12-20 03:16:25
问题 Alamofire has been working fine for an iPhone only project. I DID THE MANUAL INSTALL OF ALAMOFIRE - NOT COCOA PODS Now I have added a watch app target following these steps - https://developer.apple.com/library/content/documentation/General/Conceptual/WatchKitProgrammingGuide/ConfiguringYourXcodeProject.html#//apple_ref/doc/uid/TP40014969-CH2-SW1IIm "import Alamofire" works fine on the iPhone's view controller but when I try to add it to one of the code files in the " Extension" Folder the

Detecting Apple Watch in iOS 8

家住魔仙堡 提交于 2019-12-20 02:55:08
问题 I have some events that should only be fired off if a user has an Apple Watch. Is there a way to detect whether a watch is paired? I'm not sure if I can use the shared app group to detect the Apple Watch extension or maybe I can use bluetooth? 回答1: The best you an do is set a BOOL to true in shared NSUserDefaults the first time the Watch app is run and then check for that value in your iOS app. All indications on the dev forums and publicly have been that there isn't a way to programatically

NSURLSession returns data as Null on Watch OS2 using Objective-C

自作多情 提交于 2019-12-20 01:56:06
问题 This works perfectly on iPhone (Simlulator and Device) but on Watch OS2 i get blank data. What might be the issue with this ? NSURLSession *session = [NSURLSession sharedSession]; NSURLSessionDataTask *task = [session dataTaskWithRequest:theRequest completionHandler: ^(NSData *data, NSURLResponse *response, NSError *error) { theData = [[NSString alloc]initWithBytes:[data bytes] length:[data length] encoding:NSUTF8StringEncoding]; NSLog(@"%@", theData); }]; [task resume]; 回答1: Sorry found the

Approaching Size Limit - The size of watch application (50MB limit is headache.)

半世苍凉 提交于 2019-12-19 20:24:06
问题 Our app reaches approx 49MB and we are not halfway. So definitely it will exceed the limit of 50MB. I have few questions as follow. 1) Is On-Demand Resources possible in watchOS? 2) My resources(images, custom fonts) make 2 copy each one is watch app and other is watch extension. How to solve that? 3) Swift core and other swift frameworks are consuming about ~28MB of space. is there any way to disable that? (PS. we have bit code disabled) Edit for watchOS4: Previously our app size was 44.3 MB