首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >RealmSwift-1.2和iOS-9具有基于iOS的WatchKit扩展(全部在iPhone上)

RealmSwift-1.2和iOS-9具有基于iOS的WatchKit扩展(全部在iPhone上)
EN

Stack Overflow用户
提问于 2015-09-30 21:23:16
回答 1查看 373关注 0票数 0

使用iOS-9.01 / Swift-1.2 / RealmSwift-1.2 / XCode-7.0.1:

我尝试将我工作的AppleWatch-1.0应用程序更新为iOS9,仍然在使用Swift-1.2,并且仍然希望在IPHONE上运行AppleWatch-App (而不是在AppleWatch上运行)。

当第一次在XCode7中打开时,该应用程序不幸不再编译!最后会出现以下错误:

第一次在XCode7中启动错误消息(app在XCode6.4下运行良好):

代码语言:javascript
复制
Target 'Pods-MyApp WatchKit Extension' of project 'Pods' was rejected as an
implicit dependency for 'Pods_MyApp_WatchKit_Extension.framework' because it
doesn't contain platform 'watchsimulator' in its SUPPORTED_PLATFORMS 'iphonesimulator,
iphoneos'

那个错误是什么意思??

我读过in another post,需要对WatchKit扩展的体系结构设置(即调试-目标)进行不同的设置。

Base(在构建设置/体系结构下)设置需要什么?

在第一次启动之后,Base默认设置为watchOS (如下面的第一张图所示)。但是,由于我想保持应用程序A纯iPhone,我想,这个Base应该设置为“最新的iOS (iOS 9.0)”。这样说对吗?

将Base设置为“最新的iOS (iOS 9.0)”之后,"General“选项卡将消失(见下图)。所以我想这也是不对的??或者是吗?

不仅"General“选项卡消失,而且还会出现另一个错误:

将Base更改为最新的-iOS (iOS 9.0)后的错误消息(2):

代码语言:javascript
复制
target specifies product type 'com.apple.product-type.watchkit2-extension',
but there's no such product type for the 'iphonesimulator' platform

如果为Debug和发行版(according to the suggestion of the other post)设置“受支持的平台”,我将返回错误消息1。

有关所支持的平台设置的混合体,请参见下图:

错误信息(1)现在又回来了..。

代码语言:javascript
复制
Target 'Pods-MyApp WatchKit Extension' of project 'Pods' was rejected as an
implicit dependency for 'Pods_MyApp_WatchKit_Extension.framework' because it
doesn't contain platform 'watchsimulator' in its SUPPORTED_PLATFORMS 'iphonesimulator,
iphoneos'

问题仍然存在:要使应用程序按预期工作,还需要做什么??任何在这方面的帮助都是非常感谢的!

此外,我的Cocoa看起来如下:

代码语言:javascript
复制
xcodeproj 'MyApp.xcodeproj'
workspace 'MyApp.xcworkspace'
platform :ios, '9.0'
inhibit_all_warnings!

source 'https://github.com/artsy/Specs.git'
source 'https://github.com/CocoaPods/Specs.git'

use_frameworks!
link_with 'MyApp', 'MyApp WatchKit Extension'

def shared_pods
      pod 'Realm', :git => 'https://github.com/realm/realm-cocoa.git', :branch => 'swift-1.2'
      pod 'RealmSwift', :git => 'https://github.com/realm/realm-cocoa.git', :branch => 'swift-1.2'
end

target 'MyApp' do
    shared_pods
end

target 'MyAppTests' do
    shared_pods
end

target 'MyApp WatchKit Extension' do
    platform :ios, '9.0'
    shared_pods
end
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2015-09-30 21:34:13

您正在使用SWIFT1.2版本的Realms。iOS 9使用SWIFT2.0,所以我相信您只需要使用最新版本的Realms:

代码语言:javascript
复制
def shared_pods
      pod 'Realm'
      pod 'RealmSwift'
end
票数 3
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/32875868

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档