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

How bad is it to embed UIWebView in UIScrollView?
How to hide the toolbar when user taps an action in a CNContactViewController?
How Touch drag enter works?
How to fetch all contacts record in iOS 9 using Contacts Framework
Checking value of hundredths in Double
Why do I get a “HTTP load failed” exception after upgrading to XCode 7?
iOS client setup for GCM, need senderID clarification
PFUser.currentUser() never equals nil
Swift 2 .plist dictArray to Remote Json Array Error
Hide status bar in SWRevealViewController
How to get client secret from Google Developers Console in iOS?
Add extra function when status bar is tapped
How to set download status of UIProgressView in UILabel using AFNetworking (Objective-C)?
Hashtag and attributed color issue in FFLabel library for ios swift
How to add SDWebImagePrefetcher in swift
Unicode not working properly in iOS

Categories

HOME
graph
redirect
apt-get
android-sqlite
appium-ios
bootstrap-selectpicker
windows-runtime
webdriver-io
range
intl
dbus
gcov
hyperion
oracle-ucm
cytoscape.js
google-cloud-sdk
cloudrail
calabash-android
smartsheet-c#-sdk-v2
w2ui
jmeter-plugins
sfsafariviewcontroller
pwm
microphone
mediator
digital-logic
angular-services
android-security
ocean
dapper-fastcrud
magento2.0.2
pvlib
deep-copy
azure-app-service-envrmnt
data-science
increment
qweb
vue2
sourcetree
joe-editor
protobuf-3
polymer-cli
rtems
php-deployer
website-hosting
g-wan
billing
assembly-references
nsd
hapi.js
sound-synthesis
setwindowshookex
printscreen
ellipsis
ios-frameworks
gcloud-java
storage-duration
occam-pi
tag-helpers
dbfit
wchar-t
translate3d
abort
gevent-socketio
solr-boost
iife
swift-array
simpleadapter
nolio
jasmin
physx
bitrock
sbrk
django-postgresql
datacontractserializer
directcompute
bunny
deepzoom
sonata-media-bundle
dfsort
libavcodec
str-to-date
buildout
datasift-python
gora
rte
xhtml-transitional
double-precision
symfony-2.2
cassette
jmdns
eject
ariatemplates
maven-bundle-plugin
molehill
cellphone
proxy-classes
sharepoint-timer-job
system-tray
chickenfoot
coords
run-length-encoding
68hc11

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