Cocoapod pod仅适用于指定平台

时间:2015-10-18 21:13:10

标签: ios xcode cocoapods tvos

我有一个包含多个目标的Xcode项目。其中一个目标是tvOS平台。我的其他目标使用'youtube-iso-player-helper'框架,它不支持tvOS。我想要一个仅在iOS上包含播放器框架的Cocoapod Podfile。

这是我当前的Podfile:

source 'https://github.com/CocoaPods/Specs.git' 
platform :ios, '8.0'
platform :tvos, '9.0'

use_frameworks!

pod 'SVGgh'

pod "youtube-ios-player-helper", "~> 0.1"

xcodeproj 'MyProject.xcodeproj'

当我尝试更新我的pod时,出现以下错误:

  

[!]目标Pods(tvOS 9.0)的平台与youtube-ios-player-helper (0.1.4)不兼容,tvos不支持angular.module('FinalApp.Controllers').controller('refillController', function ($rootScope, $scope, $location, $modal, userService, dependentsService, accountService, sharedCollections, configurationService, refillsService) { $scope.user = userService.GetUserInformation(); $scope.userInfoArr = []; //$scope.tests.push({'Name':$scope.user.FirstName, 'LinkToken':$scope.user.LinkToken}); $scope.userInfoArr = $scope.user.Dependants.map(function(item){return {'Name':item.FirstName, 'LinkToken':item.LinkToken}}); $scope.userInfoArr.splice(0, 0, {'Name': $scope.user.FirstName, 'LinkToken': $scope.user.LinkToken}); console.log($scope.userInfoArr); $scope.finUserInfoArr = $scope.userInfoArr[0].LinkToken; $scope.billingInfo = null; $rootScope.showNavbar = true; $scope.selectedMethod = null; $scope.location = null; $scope.payment = null; $scope.refills = []; $scope.deliverTypes = []; $scope.locations = []; $scope.payments = []; $scope.allSelected = false; $scope.loadingBillingInfo = false; $scope.isMailOrder = false; //Detect Mobile Switch Refill List To Grid if(window.innerWidth <= 800) { $scope.view = "Grid"; } else { $scope.view = "List"; } $scope.changeViewToList = function () { $scope.view = "List"; }; $scope.changeViewToGrid = function () { $scope.view = "Grid"; }; $scope.testchange = function(selectedTest) { $scope.getRefills(selectedTest); console.log(selectedTest); }; $scope.getRefills = function (linkToken) { $scope.allSelected = false; $scope.loading = true; refillsService.GetRefills( linkToken, $scope.selectedMethod, $scope.location, $scope.payment ).then(function (data) { $scope.refills = []; _.each(data.Prescriptions, function (item) { fillRefills(item); }); fillDeliverTypes(data.DeliveryTypes); if (!$scope.selectedMethod) $scope.selectedMethod = data.DeliveryTypeId; if (!$scope.location) $scope.location = data.PickupLocationId; if (!$scope.payment) $scope.payment = data.PaymentTypeId; $scope.loading = false; $scope.updateLocations(); })["catch"](function (error) { console.log(error); $scope.loading = false; alertify.alert(configurationService.ErrorMessage("getting your refills", error.Message)); }); }; var fillRefills = function (item) { //TODO-CallDoc temp fix if (item.RefillClass == "CALL_DOCTOR") { item.NextRefillDate = '1900-01-01T00:00:00' } var parsedDate = checkDate(moment(item.NextRefillDate).format('L')); var lastrefill = checkDate(moment(item.LastDispenseDate).format('L')); var expireDate = checkDate(moment(item.ExpirationDate).format('L')); var status = (item.RefillStatus.indexOf("After") == -1) ? item.RefillStatus : "Refill " + item.RefillStatus; $scope.refills.push({ selected: false, rx: item.ScriptNo, name: item.DrugName, dose: item.UnitsPerDose, dir: item.Instructions, nextfill: parsedDate, lastfill: lastrefill, refillsLeft: item.NumRefillsLeft, status: status, msg: item.RefillMessage, canSelect: item.IsRefillable, refillClass: item.RefillClass, lastDispenseQty: item.LastDispenseQty, DaysSupply: item.DaysSupply, expireDate: expireDate, copayAmt: item.CopayAmt, drFirstName: item.DoctorFirstName, drLastName: item.DoctorLastName, writtenQty: item.WrittenQty }); }; var checkDate = function (date) { if (date == "01/01/1900") return "N/A"; if (date == "Invalid Date") return ""; return date; }; var fillDeliverTypes = function (deliverTypes) { $scope.deliverTypes = []; _.each(deliverTypes, function (item) { $scope.deliverTypes.push({ id: item.DeliveryTypeId, name: item.DeliveryTypeName, locations: item.PickupLocations, payments: item.PaymentTypes }); }); }; var getBillingInfo = function () { $scope.loadingBillingInfo = true; accountService.GetCreditCardInfo().then(function (data) { $scope.billingInfo = data; $scope.loadingBillingInfo = false; })["catch"](function (error) { $scope.loadingBillingInfo = false; alertify.alert(configurationService.ErrorMessage("getting account information", error.Message)); }); }; var getAccountInfo = function () { accountService.GetAccountInfo().then(function (data) { if (data.StatusCode == "SUCCESS") { $scope.user = data; userService.SaveUserInformation(data); if ($scope.user.IsLinked) { $rootScope.enableMyRefills = true; $rootScope.enableMyReports = true; window.location.hash = "#/refills"; } else { $rootScope.enableMyRefills = false; $rootScope.enableMyReports = true; } } else { alertify.alert(configurationService.ErrorMessage("getting account information", data.StatusMessage)); } })["catch"](function (error) { alertify.alert(configurationService.ErrorMessage("getting account information", error.Message)); }); }; var openModal = function (viewUrl, controllerUrl, size, payload) { var modalInstance = $modal.open({ templateUrl: viewUrl, controller: controllerUrl, size: size, resolve: { data: function () { return payload; } } }); return modalInstance; }; $scope.toggleRxSelection = function(rx) { if (rx.canSelect) { rx.selected = !rx.selected; $scope.evaluateAllSelected(); } }; $scope.selectAll = function (data) { // $scope.allSelected = allSelected; _.each($scope.refills, function (x) { if (x.canSelect) x.selected = data; }); }; $scope.evaluateAllSelected = function () { var count = _.countBy(_.where($scope.refills, {canSelect:true}), function(refill) { return refill.selected ? 'selected' : 'not'; }); $scope.allSelected = (count.not === undefined); }; $scope.openEditCreditCardInfo = function () { var payload = ($scope.billingInfo != null && $scope.billingInfo != undefined) && $scope.billingInfo.CardNumber != "" ? $scope.billingInfo : {}; if (payload != {}) { payload.ExpMonth = {id: parseInt(payload.ExpMonth)}; payload.ExpYear = {id: parseInt(payload.ExpYear)}; } openModal('app/views/editAccount/billingInformation.html', "billingInformationController", "xlg", payload).result.then(function () { getAccountInfo(); getBillingInfo(); }, function () { getBillingInfo(); }); }; $scope.openConfirmOrder = function () { var refillsSelected = _.where($scope.refills, {selected: true}); var location = _.findWhere($scope.locations, {PickupLocationId: $scope.location}); var payment = _.findWhere($scope.payments, {PaymentTypeId: $scope.payment}); var deliver = _.findWhere($scope.deliverTypes, {id: $scope.selectedMethod}); if (refillsSelected.length == 0) { alertify.error("You need to select at least one refill"); return; } if (deliver.id == 10001 && !$scope.user.IsCreditCardOnFile) { alertify.error("Need credit card on file for mail order"); return; } sharedCollections.setRefills(refillsSelected); sharedCollections.setLocation(location); sharedCollections.setPayment(payment); sharedCollections.setDeliver(deliver); openModal('app/views/refills/confirmOrder.html', "confirmOrderController", "xlg").result.then(function () { $scope.billingInfo = accountService.GetCreditCardInfo(); $scope.getRefills(); }, function () { //$scope.billingInfo = accountService.GetCreditCardInfo(); //getRefills(); }); }; $scope.showRefill = function (rx) { var data = {rx: rx, refills: $scope.refills}; openModal('app/views/refills/showRefills.html', "refillsCarrousel", "xlg", data).result.then(function () { $scope.evaluateAllSelected(); }, function () { $scope.evaluateAllSelected(); }); }; $scope.updateLocations = function () { $scope.locations = _.findWhere($scope.deliverTypes, {id: $scope.selectedMethod}).locations; $scope.payments = _.findWhere($scope.deliverTypes, {id: $scope.selectedMethod}).payments; setLocationAndPayment(); }; var setLocationAndPayment = function () { if ($scope.locations.length == 1) { $scope.location = $scope.locations[0].PickupLocationId; } if ($scope.payments.length == 1) { $scope.payment = $scope.payments[0].PaymentTypeId; } //check for mail order ($scope.selectedMethod == 10001 && !$scope.payment) ? $scope.isMailOrder = true : $scope.isMailOrder = false; }; $scope.getRefills($scope.finUserInfoArr); getBillingInfo();

显然,这是使用当前版本的Cocoapods。

所以,我需要知道我的Podfile所需的语法。

4 个答案:

答案 0 :(得分:3)

这似乎对我有用:

target 'iOSAppTarget' do
  platform :ios, '8.0'
  pod 'PodForiOS'
end

target 'TVAppTarget' do
  platform :tvos, '9.0'
  pod 'PodForTV'
end

答案 1 :(得分:0)

我有类似的问题,但有框架。尝试使用targetlink_with为特定目标安装pod:

target :tvos, :exclusive => true do
    use_frameworks!
    link_with 'AppName'
    pod "youtube-ios-player-helper", "~> 0.1"
end

答案 2 :(得分:0)

刚遇到类似的问题,我已经通过使用这种模式修复了它:

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

def shared_pods
    pod 'SVGgh'
end

target 'myiOSTargetName' do
    platform :ios, '8.0'
    use_frameworks! 
    shared_pods
    pod "youtube-ios-player-helper", "~> 0.1"
end

target 'mytvOSTargetName' do
    platform :tvos, '9.0'  
    use_frameworks! 
    shared_pods
end

我没有测试过,但我希望它有所帮助! 干杯

答案 3 :(得分:0)

实际上不仅仅是你的podfile,而且pod的创建者需要启用apple TV。你可以在这里阅读http://blog.cocoapods.org/CocoaPods-0.39/