ios


When submitting a swift based cocoapod, I get this error when checking if the device is a simulator: code after 'return' will never be executed


I am attempting to submit a cocoapod written in Swift that contains the following code method intended to prevent execution of specific code when targeting a simulator:
func isDevice() -> Bool {
#if (arch(i386) || arch(x86_64)) && os(iOS)
return false
#endif
return true
}
While XCode finds this acceptable, and I can suppress the warning from pod lib lint with the --allow-warnings flag, attempting to submit the pod will still fail.
This code produces the warning warning: code after 'return' will never be executed.
The mistake I made was that while the source of this answer is solid, I did not properly implement the conditional check.
Below is the proper way to do it to avoid issues with the Cocoapod validation:
func isDevice() -> Bool {
#if (arch(i386) || arch(x86_64)) && os(iOS)
return false
#else
return true
#endif
}
By placing the check inside the #if...#endif, I was able to avoid the warning.

Related Links

Converting to Swift 3 (Swift and Firebase Project)
load .html from a local directory that is not compiled in my app
iOS Facebook share video Swift
DateFormatter Changes Date by 500 Years
Localytics ios push device token
getting optional with value even after unwrapping it
Use of unresolved identifier 'GMSPlacesClient' in xcode 7.3.1
Unknown Selector Issue
How to crop my App image like iPhone photo gallary
iOS: How to subscribe a customer to an Automatically Renewable Subscription
Add objects into array from UITableViewCell
Moving view closer to camera
My session.dataTaskWithRequest method is not returning any data
How to fetch all WiFi connection
Swift 2 Static UICollectionView change to Json Parsing UICollectionView
MyApp-Swift.h file not found. for a specific class only

Categories

HOME
ssis
dynamics-crm-365
apt-get
isis
asana
swashbuckle
turing
jqgrid
arm
sony-camera-api
mobilefirst-adapters
silverlight
eloqua
prerender
atmelstudio
broker
urlrewriter.net
ratchet-2
precision
naturallyspeaking
confidence-interval
x-sendfile
webfocus
plm
gcp
azure-api-apps
google-domain-api
extraction
folly
confirm
otroslogviewer
formatdatetime
appdynamics
sql-insert
notimplementedexception
stroke
catalina
mapr
ipmi
configuration-profile
informatica-cloud
jsbin
xendesktop
duration
vimeo-ios
dbfit
openocd
openejb
pyenchant
axlsx
wss4j
xerces
simperium
mks
isql
catalina.out
notifydatasetchanged
bonecp
asp.net-apicontroller
colormatrix
polarssl
argumentexception
chromeless
icon-fonts
memento
hudson-plugins
wpf-4.0
timestamp-with-timezone
mysql-backup
expression-encoder-sdk
c++builder-xe2
proxy-classes
consistent-hashing
objcopy
websolr
openid4java
junitperf
xmltextwriter
wiki-markup
nsindexset
xtratreelist
webshop
xquery-update
gumstix
nhaml
large-teams

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App