반응형

$ sudo gem install cocoapods

Building native extensions. This could take a while...
ERROR:  Error installing cocoapods:
ERROR: Failed to build gem native extension.


    current directory: /Library/Ruby/Gems/2.6.0/gems/ffi-1.16.3/ext/ffi_c
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby -I /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0 -r ./siteconf20231018-31509-1t1qqqx.rb extconf.rb
checking for ffi.h... *** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers.  Check the mkmf.log file for more details.  You may
need configuration options.


Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/$(RUBY_BASE_NAME)
--with-ffi_c-dir
--without-ffi_c-dir
--with-ffi_c-include
--without-ffi_c-include=${ffi_c-dir}/include
--with-ffi_c-lib
--without-ffi_c-lib=${ffi_c-dir}/lib
--enable-debug
--disable-debug
--enable-system-libffi
--disable-system-libffi
--with-libffi-config
--without-libffi-config
--with-pkg-config
--without-pkg-config
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:467:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:585:in `block in try_compile'
from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:534:in `with_werror'
from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:585:in `try_compile'
from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:1109:in `block in have_header'
from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:959:in `block in checking_for'
from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:361:in `block (2 levels) in postpone'
from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:331:in `open'
from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:361:in `block in postpone'
from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:331:in `open'
from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:357:in `postpone'
from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:958:in `checking_for'
from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:1108:in `have_header'
from extconf.rb:10:in `system_libffi_usable?'
from extconf.rb:46:in `<main>'


To see why this extension failed to compile, please check the mkmf.log which can be found here:


  /Library/Ruby/Gems/2.6.0/extensions/universal-darwin-22/2.6.0/ffi-1.16.3/mkmf.log


extconf failed, exit code 1


Gem files will remain installed in /Library/Ruby/Gems/2.6.0/gems/ffi-1.16.3 for inspection.
Results logged to /Library/Ruby/Gems/2.6.0/extensions/universal-darwin-22/2.6.0/ffi-1.16.3/gem_make.out

 

# 아래 링크 참조

https://gorails.com/setup/macos/10.11-el-capitan

 

Install Ruby On Rails on macOS 10.11 El Capitan | GoRails - GoRails

A guide to setting up a Ruby on Rails development environment on macOS 10.11 El Capitan with Git, MySQL, and PostgreSQL

gorails.com

1. brew 설치

$ /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

 

2. brew Path 지정

$ echo 'source ~/.bash_profile' >> ~/.zshrc

$ echo 'export PATH=/opt/homebrew/bin:$PATH' >> ~/.zshrc

$ source ~/.zshrc

 

3. ruby 설치

$ cd
$ git clone https://github.com/excid3/asdf.git ~/.asdf

$ vi ~/.zshrc

$HOME/.asdf/asdf.sh
$HOME/.asdf/completions/asdf.bash

$ echo 'legacy_version_file = yes' >> ~/.asdfrc
$ exec $SHELL

 

$ asdf plugin add ruby
$ asdf plugin add nodejs

 

$ brew install rbenv ruby-build

$ echo 'if which rbenv > /dev/null; then eval "$(rbenv init -)"; fi' >> ~/.bash_profile
$ source ~/.bash_profile

 

$ source ~/.zshrc

/Users/goodgods/.zshrc:5: permission denied: /Users/goodgods/.asdf/asdf.sh
/Users/goodgods/.zshrc:6: permission denied: /Users/goodgods/.asdf/completions/asdf.bash

$ chmod 755 /Users/goodgods/.asdf/asdf.sh

$ chmod 755 /Users/goodgods/.asdf/completions/asdf.bash

 

$ asdf install ruby 3.2.2

To follow progress, use 'tail -f /var/folders/4n/jmhh9dq501q3h4x0xbvhz8gc0000gn/T/ruby-build.20231018013346.97385.log' or pass --verbose
Downloading openssl-3.1.3.tar.gz...
-> https://dqw8nmjcqpjn7.cloudfront.net/f0316a2ebd89e7f2352976445458689f80302093788c466692fb2a188b2eacf6
Installing openssl-3.1.3...
Installed openssl-3.1.3 to /Users/goodgods/.asdf/installs/ruby/3.2.2

Downloading ruby-3.2.2.tar.gz...
-> https://cache.ruby-lang.org/pub/ruby/3.2/ruby-3.2.2.tar.gz
Installing ruby-3.2.2...
ruby-build: using readline from homebrew
ruby-build: using libyaml from homebrew
Installed ruby-3.2.2 to /Users/goodgods/.asdf/installs/ruby/3.2.2

$ asdf global ruby 3.2.2

 

$ sudo gem update --system

Updating rubygems-update
Fetching rubygems-update-3.4.21.gem
Successfully installed rubygems-update-3.4.21
Parsing documentation for rubygems-update-3.4.21
Installing ri documentation for rubygems-update-3.4.21
Done installing documentation for rubygems-update after 0 seconds
Parsing documentation for rubygems-update-3.4.21
Done installing documentation for rubygems-update after 0 seconds
Installing RubyGems 3.4.21
  Successfully built RubyGem
  Name: bundler
  Version: 2.4.21
  File: bundler-2.4.21.gem
Bundler 2.4.21 installed
RubyGems 3.4.21 installed
Regenerating binstubs
Regenerating plugins
Parsing documentation for rubygems-3.4.21
Installing ri documentation for rubygems-3.4.21


# 3.4.21 / 2023-10-17


## Enhancements:


* Abort `setup.rb` if Ruby is too old. Pull request
  [#7011](https://github.com/rubygems/rubygems/pull/7011) by
  deivid-rodriguez
* Remove usage of Dir.chdir that only execute a subprocess. Pull request
  [#6930](https://github.com/rubygems/rubygems/pull/6930) by segiddins
* Freeze more strings in generated gemspecs. Pull request
  [#6974](https://github.com/rubygems/rubygems/pull/6974) by segiddins
* Use pure-ruby YAML parser for loading configuration at RubyGems. Pull
  request [#6615](https://github.com/rubygems/rubygems/pull/6615) by hsbt
* Installs bundler 2.4.21 as a default gem.


## Documentation:


* Update suggested variable for bindir. Pull request
  [#7028](https://github.com/rubygems/rubygems/pull/7028) by hsbt
* Fix invalid links in documentation. Pull request
  [#7008](https://github.com/rubygems/rubygems/pull/7008) by simi


# 3.4.20 / 2023-09-27


## Enhancements:


* Raise `Gem::Package::FormatError` when gem encounters corrupt EOF.
  Pull request [#6882](https://github.com/rubygems/rubygems/pull/6882)
  by martinemde
* Allow skipping empty license `gem build` warning by setting license to
  `nil`. Pull request
  [#6879](https://github.com/rubygems/rubygems/pull/6879) by jhong97
* Update SPDX license list as of 2023-06-18. Pull request
  [#6891](https://github.com/rubygems/rubygems/pull/6891) by
  github-actions[bot]
* Update SPDX license list as of 2023-04-28. Pull request
  [#6642](https://github.com/rubygems/rubygems/pull/6642) by segiddins
* Update SPDX license list as of 2023-01-26. Pull request
  [#6310](https://github.com/rubygems/rubygems/pull/6310) by segiddins
* Installs bundler 2.4.20 as a default gem.


## Bug fixes:


* Fixed false positive SymlinkError in symbolic link directory. Pull
  request [#6947](https://github.com/rubygems/rubygems/pull/6947) by
  negi0109
* Ensure that loading multiple gemspecs with legacy YAML class references
  does not warn. Pull request
  [#6889](https://github.com/rubygems/rubygems/pull/6889) by segiddins
* Fix NoMethodError when choosing a too big number from `gem uni` list.
  Pull request [#6901](https://github.com/rubygems/rubygems/pull/6901) by
  amatsuda


## Performance:


* Reduce allocations for stub specifications. Pull request
  [#6972](https://github.com/rubygems/rubygems/pull/6972) by segiddins


# 3.4.19 / 2023-08-17


## Enhancements:


* Installs bundler 2.4.19 as a default gem.


## Performance:


* Speedup building docs when updating rubygems. Pull request
  [#6864](https://github.com/rubygems/rubygems/pull/6864) by
  deivid-rodriguez


# 3.4.18 / 2023-08-02


## Enhancements:


* Add poller to fetch WebAuthn OTP. Pull request
  [#6774](https://github.com/rubygems/rubygems/pull/6774) by jenshenny
* Remove side effects when unmarshaling old `Gem::Specification`. Pull
  request [#6825](https://github.com/rubygems/rubygems/pull/6825) by nobu
* Ship rubygems executables in `exe` folder. Pull request
  [#6704](https://github.com/rubygems/rubygems/pull/6704) by hsbt
* Installs bundler 2.4.18 as a default gem.


# 3.4.17 / 2023-07-14


## Enhancements:


* Installs bundler 2.4.17 as a default gem.


## Performance:


* Avoid unnecessary work for private local gem installation. Pull request
  [#6810](https://github.com/rubygems/rubygems/pull/6810) by
  deivid-rodriguez


# 3.4.16 / 2023-07-10


## Enhancements:


* Installs bundler 2.4.16 as a default gem.


# 3.4.15 / 2023-06-29


## Enhancements:


* Installs bundler 2.4.15 as a default gem.


## Bug fixes:


* Autoload shellwords when it's needed. Pull request
  [#6734](https://github.com/rubygems/rubygems/pull/6734) by ioquatix


## Documentation:


* Update command to test local gem command changes. Pull request
  [#6761](https://github.com/rubygems/rubygems/pull/6761) by jenshenny


# 3.4.14 / 2023-06-12


## Enhancements:


* Load plugin immediately. Pull request
  [#6673](https://github.com/rubygems/rubygems/pull/6673) by kou
* Installs bundler 2.4.14 as a default gem.


## Documentation:


* Clarify what the `rubygems-update` gem is for, and link to source code
  and guides. Pull request
  [#6710](https://github.com/rubygems/rubygems/pull/6710) by davetron5000


# 3.4.13 / 2023-05-09


## Enhancements:


* Installs bundler 2.4.13 as a default gem.


# 3.4.12 / 2023-04-11


## Enhancements:


* [Experimental] Add WebAuthn Support to the CLI. Pull request
  [#6560](https://github.com/rubygems/rubygems/pull/6560) by jenshenny
* Installs bundler 2.4.12 as a default gem.


# 3.4.11 / 2023-04-10


## Enhancements:


* Installs bundler 2.4.11 as a default gem.




------------------------------------------------------------------------------


RubyGems installed the following executables:
/Users/goodgods/.asdf/installs/ruby/3.2.2/bin/gem
/Users/goodgods/.asdf/installs/ruby/3.2.2/bin/bundle
/Users/goodgods/.asdf/installs/ruby/3.2.2/bin/bundler


Ruby Interactive (ri) documentation was installed. ri is kind of like man 
pages for Ruby libraries. You may access it like this:
  ri Classname
  ri Classname.class_method
  ri Classname#instance_method
If you do not wish to install this documentation in the future, use the
--no-document flag, or set it as the default in your ~/.gemrc file. See
'gem help env' for details.


RubyGems system software updated

 

$ which ruby

/Users/goodgods/.asdf/shims/ruby

$ ruby -v

ruby 3.2.2 (2023-03-30 revision e51014f9c0) [arm64-darwin22]

$ asdf install nodejs 18.16.1

Cloning node-build...
Downloading node-v18.16.1-darwin-arm64.tar.gz...
-> https://nodejs.org/dist/v18.16.1/node-v18.16.1-darwin-arm64.tar.gz
Installing node-v18.16.1-darwin-arm64...
Installed node-v18.16.1-darwin-arm64 to /Users/goodgods/.asdf/installs/nodejs/18.16.1

$ asdf global nodejs 18.16.1

$ which node

/Users/goodgods/.asdf/shims/node

$ node -v

v18.16.1

4. cocoapods 설치

$ sudo gem install cocoapods

Fetching atomos-0.1.3.gem
Fetching CFPropertyList-3.0.6.gem
Fetching colored2-3.1.2.gem
Fetching claide-1.1.0.gem
Fetching nanaimo-0.3.0.gem
Fetching xcodeproj-1.23.0.gem
Fetching ruby-macho-2.5.1.gem
Fetching nap-1.1.0.gem
Fetching molinillo-0.8.0.gem
Fetching gh_inspector-1.1.3.gem
Fetching fourflusher-2.3.1.gem
Fetching escape-0.0.4.gem
Fetching cocoapods-try-1.2.0.gem
Fetching netrc-0.11.0.gem
Fetching cocoapods-trunk-1.6.0.gem
Fetching cocoapods-search-1.0.1.gem
Fetching cocoapods-plugins-1.0.0.gem
Fetching cocoapods-downloader-1.6.3.gem
Fetching cocoapods-deintegrate-1.0.5.gem
Fetching ffi-1.16.3.gem
Fetching ethon-0.16.0.gem
Fetching typhoeus-1.4.0.gem
Fetching public_suffix-4.0.7.gem
Fetching fuzzy_match-2.0.4.gem
Fetching concurrent-ruby-1.2.2.gem
Fetching httpclient-2.8.3.gem
Fetching algoliasearch-1.27.5.gem
Fetching addressable-2.8.5.gem
Fetching tzinfo-2.0.6.gem
Fetching i18n-1.14.1.gem
Fetching connection_pool-2.4.1.gem
Fetching activesupport-7.1.1.gem
Fetching cocoapods-1.13.0.gem
Fetching cocoapods-core-1.13.0.gem
Successfully installed nanaimo-0.3.0
Successfully installed colored2-3.1.2
Successfully installed claide-1.1.0
Successfully installed CFPropertyList-3.0.6
Successfully installed atomos-0.1.3
/Users/goodgods/.asdf/lib/commands/reshim.bash: line 104: /Users/goodgods/.asdf/shims/update_rubygems: Permission denied
Successfully installed xcodeproj-1.23.0
Successfully installed ruby-macho-2.5.1
Successfully installed nap-1.1.0
Successfully installed molinillo-0.8.0
Successfully installed gh_inspector-1.1.3
Successfully installed fourflusher-2.3.1
Successfully installed escape-0.0.4
Successfully installed cocoapods-try-1.2.0
Successfully installed netrc-0.11.0
Successfully installed cocoapods-trunk-1.6.0
Successfully installed cocoapods-search-1.0.1
Successfully installed cocoapods-plugins-1.0.0
Successfully installed cocoapods-downloader-1.6.3
Successfully installed cocoapods-deintegrate-1.0.5
Building native extensions. This could take a while...
Successfully installed ffi-1.16.3
Successfully installed ethon-0.16.0
Successfully installed typhoeus-1.4.0
Successfully installed public_suffix-4.0.7
/Users/goodgods/.asdf/lib/commands/reshim.bash: line 104: /Users/goodgods/.asdf/shims/update_rubygems: Permission denied
Successfully installed fuzzy_match-2.0.4
Successfully installed concurrent-ruby-1.2.2
/Users/goodgods/.asdf/lib/commands/reshim.bash: line 104: /Users/goodgods/.asdf/shims/update_rubygems: Permission denied
Successfully installed httpclient-2.8.3
A new major version is available for Algolia! Please now use the https://rubygems.org/gems/algolia gem to get the latest features.
Successfully installed algoliasearch-1.27.5
Successfully installed addressable-2.8.5
Successfully installed tzinfo-2.0.6
Successfully installed i18n-1.14.1
Successfully installed connection_pool-2.4.1
Successfully installed activesupport-7.1.1
Successfully installed cocoapods-core-1.13.0
/Users/goodgods/.asdf/lib/commands/reshim.bash: line 104: /Users/goodgods/.asdf/shims/update_rubygems: Permission denied
/Users/goodgods/.asdf/lib/commands/reshim.bash: line 104: /Users/goodgods/.asdf/shims/update_rubygems: Permission denied
Successfully installed cocoapods-1.13.0
Parsing documentation for nanaimo-0.3.0
Installing ri documentation for nanaimo-0.3.0
Parsing documentation for colored2-3.1.2
Installing ri documentation for colored2-3.1.2
Parsing documentation for claide-1.1.0
Installing ri documentation for claide-1.1.0
Parsing documentation for CFPropertyList-3.0.6
Installing ri documentation for CFPropertyList-3.0.6
Parsing documentation for atomos-0.1.3
Installing ri documentation for atomos-0.1.3
Parsing documentation for xcodeproj-1.23.0
Installing ri documentation for xcodeproj-1.23.0
Parsing documentation for ruby-macho-2.5.1
Installing ri documentation for ruby-macho-2.5.1
Parsing documentation for nap-1.1.0
Installing ri documentation for nap-1.1.0
Parsing documentation for molinillo-0.8.0
Installing ri documentation for molinillo-0.8.0
Parsing documentation for gh_inspector-1.1.3
Installing ri documentation for gh_inspector-1.1.3
Parsing documentation for fourflusher-2.3.1
Installing ri documentation for fourflusher-2.3.1
Parsing documentation for escape-0.0.4
Installing ri documentation for escape-0.0.4
Parsing documentation for cocoapods-try-1.2.0
Installing ri documentation for cocoapods-try-1.2.0
Parsing documentation for netrc-0.11.0
Installing ri documentation for netrc-0.11.0
Parsing documentation for cocoapods-trunk-1.6.0
Installing ri documentation for cocoapods-trunk-1.6.0
Parsing documentation for cocoapods-search-1.0.1
Installing ri documentation for cocoapods-search-1.0.1
Parsing documentation for cocoapods-plugins-1.0.0
Installing ri documentation for cocoapods-plugins-1.0.0
Parsing documentation for cocoapods-downloader-1.6.3
Installing ri documentation for cocoapods-downloader-1.6.3
Parsing documentation for cocoapods-deintegrate-1.0.5
Installing ri documentation for cocoapods-deintegrate-1.0.5
Parsing documentation for ffi-1.16.3
Installing ri documentation for ffi-1.16.3
Parsing documentation for ethon-0.16.0
Installing ri documentation for ethon-0.16.0
Parsing documentation for typhoeus-1.4.0
Installing ri documentation for typhoeus-1.4.0
Parsing documentation for public_suffix-4.0.7
Installing ri documentation for public_suffix-4.0.7
Parsing documentation for fuzzy_match-2.0.4
Installing ri documentation for fuzzy_match-2.0.4
Parsing documentation for concurrent-ruby-1.2.2
Installing ri documentation for concurrent-ruby-1.2.2
Parsing documentation for httpclient-2.8.3
Installing ri documentation for httpclient-2.8.3
Parsing documentation for algoliasearch-1.27.5
Installing ri documentation for algoliasearch-1.27.5
Parsing documentation for addressable-2.8.5
Installing ri documentation for addressable-2.8.5
Parsing documentation for tzinfo-2.0.6
Installing ri documentation for tzinfo-2.0.6
Parsing documentation for i18n-1.14.1
Installing ri documentation for i18n-1.14.1
Parsing documentation for connection_pool-2.4.1
Installing ri documentation for connection_pool-2.4.1
Parsing documentation for activesupport-7.1.1
Couldn't find file to include 'activesupport/README.rdoc' from lib/active_support.rb
Installing ri documentation for activesupport-7.1.1
Parsing documentation for cocoapods-core-1.13.0
Installing ri documentation for cocoapods-core-1.13.0
Parsing documentation for cocoapods-1.13.0
Installing ri documentation for cocoapods-1.13.0
Done installing documentation for nanaimo, colored2, claide, CFPropertyList, atomos, xcodeproj, ruby-macho, nap, molinillo, gh_inspector, fourflusher, escape, cocoapods-try, netrc, cocoapods-trunk, cocoapods-search, cocoapods-plugins, cocoapods-downloader, cocoapods-deintegrate, ffi, ethon, typhoeus, public_suffix, fuzzy_match, concurrent-ruby, httpclient, algoliasearch, addressable, tzinfo, i18n, connection_pool, activesupport, cocoapods-core, cocoapods after 7 seconds
34 gems installed

5. 버전 확인

$ pod -v

/Users/goodgods/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/activesupport-7.1.1/lib/active_support/core_ext/array/conversions.rb:108:in `<class:Array>': undefined method `deprecator' for ActiveSupport:Module (NoMethodError)

  deprecate to_default_s: :to_s, deprecator: ActiveSupport.deprecator
                                                          ^^^^^^^^^^^
Did you mean?  deprecate_constant
from /Users/goodgods/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/activesupport-7.1.1/lib/active_support/core_ext/array/conversions.rb:8:in `<top (required)>'
from <internal:/Users/goodgods/.asdf/installs/ruby/3.2.2/lib/ruby/site_ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:86:in `require'
from <internal:/Users/goodgods/.asdf/installs/ruby/3.2.2/lib/ruby/site_ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:86:in `require'
from /Users/goodgods/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/cocoapods-1.13.0/lib/cocoapods.rb:9:in `<top (required)>'
from <internal:/Users/goodgods/.asdf/installs/ruby/3.2.2/lib/ruby/site_ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:86:in `require'
from <internal:/Users/goodgods/.asdf/installs/ruby/3.2.2/lib/ruby/site_ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:86:in `require'
from /Users/goodgods/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/cocoapods-1.13.0/bin/pod:36:in `<top (required)>'
from /Users/goodgods/.asdf/installs/ruby/3.2.2/bin/pod:25:in `load'
from /Users/goodgods/.asdf/installs/ruby/3.2.2/bin/pod:25:in `<main>'
'

$ sudo gem uninstall activesupport

You have requested to uninstall the gem:
activesupport-7.1.1

cocoapods-core-1.13.0 depends on activesupport (>= 5.0, < 8)
If you remove this gem, these dependencies will not be met.
Continue with Uninstall? [yN]  y
Successfully uninstalled activesupport-7.1.1

$ sudo gem install activesupport -v 7.0.8

Fetching activesupport-7.0.8.gem
Successfully installed activesupport-7.0.8
Parsing documentation for activesupport-7.0.8
Installing ri documentation for activesupport-7.0.8
Done installing documentation for activesupport after 0 seconds
1 gem installed

$ pod --version

1.13.0

$ pod -v

[!] Unknown command: `-v`
Did you mean: env?

Usage:

    $ pod COMMAND

      CocoaPods, the Cocoa library package manager.

Commands:

    + cache         Manipulate the CocoaPods cache
    + deintegrate   Deintegrate CocoaPods from your project
    + env           Display pod environment
    + init          Generate a Podfile for the current directory
    + install       Install project dependencies according to versions from a
                    Podfile.lock
    + ipc           Inter-process communication
    + lib           Develop pods
    + list          List pods
    + outdated      Show outdated project dependencies
    + plugins       Show available CocoaPods plugins
    + repo          Manage spec-repositories
    + search        Search for pods
    + setup         Set up the CocoaPods environment
    + spec          Manage pod specs
    + trunk         Interact with the CocoaPods API (e.g. publishing new specs)
    + try           Try a Pod!
    + update        Update outdated project dependencies and create new Podfile.lock

Options:

    --allow-root    Allows CocoaPods to run as root
    --silent        Show nothing
    --version       Show the version of the tool
    --verbose       Show more debugging information
    --no-ansi       Show output without ANSI codes
    --help          Show help banner of specified command

 

반응형
반응형

$ php -i

반응형

'Programming > PHP' 카테고리의 다른 글

date 계산  (0) 2016.05.26
Fatal error: Maximum execution time of 30 seconds exceeded  (0) 2015.10.22
error 메세지 출력  (0) 2015.10.22
bitnami  (0) 2015.10.21
phpexcel 설치  (0) 2015.10.13
반응형

 

for i in range(0,20):
    globals()['value_{}'.format(i)] = i

print(value_1)
print(value_19)

 

참고로 동적변수를 print 하였을 때 계속 null값이 나와서 당황하였으나, 이후 알고 보니 변수 선언을 해줘서 발생했던 문제이다.

아래는 잘못된 표현이다.

value_1 = value_2 = ....... value_19 = '' => 잘못된 선언
for i in range(0,20):
    globals()['value_{}'.format(i)] = i

print(value_1)
print(value_19)

 

위 잘못된 선언을 하고자 한다면

globals() 대신 locals()를 사용하면된다.

value_1 = value_2 = ....... value_19 = ''
for i in range(0,20):
    locals()['value_{}'.format(i)] = i

print(value_1)

print(value_19)
반응형

'Programming > python' 카테고리의 다른 글

bz2  (0) 2022.07.20
반응형

>> import bz2
>> str = b"sqlplus scott/tiger"

 

# compress

>> compress_str = bz2.compress(str)

>> print(compress_str)

b'BZh91AY&SYY\xf9\xdb\xc5\x00\x00\x07\x11\x80@\x00\x8a\xa4\xfe\x00 \x001\x00\x00\x08@d\xf0\xa1X\xedh\x9b\x14\x18~N\xfe.\xe4\x8ap\xa1 \xb3\xf3\xb7\x8a'

 

# decompress

>> decompress_str = bz2.decompress(compress_str)

>> print(d)

b"sqlplus scott/tiger"

 

>> print(d.decode())
sqlplus scott/tiger

 

 

# 오라클 접속 예시

>> import os

>> os.system(bz2.decompress(compress_str))

 

https://docs.python.org/3/library/bz2.html

 

bz2 — Support for bzip2 compression — Python 3.10.5 documentation

bz2 — Support for bzip2 compression Source code: Lib/bz2.py This module provides a comprehensive interface for compressing and decompressing data using the bzip2 compression algorithm. The bz2 module contains: (De)compression of files bz2.open(filename,

docs.python.org

 

반응형

'Programming > python' 카테고리의 다른 글

동적변수  (0) 2022.07.28
반응형

# 터미널에서 git으로 github 경로를 clone 했을 때 아래와 같이 에러가 발생

$ git clone git@github.com:goodgods/docker-images.git

Cloning into 'docker-images'...
The authenticity of host 'github.com (52.78.231.108)' can't be established.
ECDSA key fingerprint is SHA256:p2QAMXNIC1TJYWrVc98/R1BUu3/LiyUfQM.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added 'github.com,52.78.231.108' (ECDSA) to the list of known hosts.
git@github.com: Permission denied (publickey).
fatal: Could not read from remote repository.

# 해결

$ ssh-keygen -t rsa -C "email "

Generating public/private rsa key pair.
Enter file in which to save the key (/Users/goodgods/.ssh/id_rsa): => ssh가 설치되는 경로,  [Enter] 누른다.
Enter passphrase (empty for no passphrase): => 암호 설정, 암호를 설정하지 않으려면 그냥 [Enter] 누른다.
Enter same passphrase again: => 암호 again
Your identification has been saved in /Users/goodgods/.ssh/id_rsa.
Your public key has been saved in /Users/goodgods/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:/QA7YAfSjN/wTo+N58yLsPeQdHcubHG7A *****@gmail.com
The key's randomart image is:
+---[RSA 3072]----+
|  .o.=o  .o...   |
|   .+o+o.. o.    |
|    .++.     |
|     +.@S + o    |
|    . o* o  .    |
|     o.o=        |
|    ....o.       |
+----[SHA256]-----+

 

## id_rsa.pub 내용 복사

$ vi /Users/goodgods/.ssh/id_rsa.pub

 

## github 접속 및 로그인

Key값에 ./ssh/id_rsa.pub 파일 내용을 가져온다.

 

## 설치 되었는지 확인 작업

$ ssh -T git@github.com

Hi goodgods! You've successfully authenticated, but GitHub does not provide shell access.

반응형
반응형

iOS 15에서 네비게이션 바가  검정색으로 변화되는 현상을 발견하였다.

시뮬레이터에 돌려서 보았을 때는 그런 증상이 있었고,

이 증상을 보자마자 단말기에서도 동일 증상이 있는지 확인 하였으나 발생되지 않았다.

뭐지 하면서 우선 관련되 내용을 찾아보았다.

https://developer.apple.com/forums/thread/683590

 

iOS 15 B2 UINavigationBar Appearan… | Apple Developer Forums

Hey All! When transitioning my app to use the nav bar appearance (introduce in ios13, but required to make navigation bar colors / backgrounds in io15) i believe i had everything all changed over and working ! in iOS 15 b2 it seems when changing navbar bac

developer.apple.com

 

해당 내용을 보고 추가해주었더니 정상 작동을 하였다.

if #available(iOS 15, *) {
    let barAppearance = UINavigationBarAppearance()
    barAppearance.backgroundColor = .white
    navigationItem.standardAppearance = barAppearance
    navigationItem.scrollEdgeAppearance = barAppearance
}

 

반응형
반응형

ituncesconnect 에 빌드된 파일을 업로드 할 때

수출규정 관련 문서가 누락되었다고 느낌표가 뜨는 경우가 있다.

 

이것은 어플에 암호화 기능이 있으면 반드시 추가를 해줘야하는 문서 인것같다.

필자는 암호화 기능을 써본적이 없다.

그래서 항상 무시를 했었다. 무시를 해도 암호화 기능만 없다면 정상적으로 처리가 되었다.

 

느낌표가 나오는 게 찝찝하다면, 아래와 같이 해도 될 것 같다.

xcode에서 info.plist에서 추가한다.

<key>ITSAppUsesNonExemptEncryption</key> <No>

 

 

추가 했을 경우 메세지가 사라졌다.

반응형

'Programming > Swift' 카테고리의 다른 글

cocoapods 설치  (0) 2023.10.18
[iOS15] navigation bar 오류  (0) 2021.09.28
[swift5] 시뮬레이터에 인증서 넣기  (0) 2020.02.25
[Swift5] 아이폰 연결시 에러  (0) 2020.02.03
[Swift5] 문자열에 대한 라인수 구하기  (0) 2020.01.29
반응형

https://github.com/ADVTOOLS/ADVTrustStore

 

ADVTOOLS/ADVTrustStore

ADVTrustStore is a simple management script to import/list/remove CA certificates to the iOS simulator. It is working for iOS 5 and iOS 6. - ADVTOOLS/ADVTrustStore

github.com

보안 관련하여 인증서를 회사에서 받았다. 이후 Xcode 시뮬레이터에서 인터넷이 되지 않았다.

결론은 시뮬레이터에도 동일한 인증서를 넣어주어야 한다.

 

위 사이트를 들어가보면 해결 방안이 잘 나와있다. 

참고로 필자도 위 사이트를 보고 해결하였다.

항상 그랬듯 찾는 시간이 오래 걸리지 해결은 쉬웠다.

 

iosCerTrustManager.py 를 다운 받는다.

$ ./iosCertTrustManager.py --help

$ ./iosCertTrustManager.py -a fileName.pem

subject= CN = goodgods.tistory.com <- 인증서

 

Import certificate to iPhone 11 Pro Max v13.3 [y/N] y

Importing to /Users/comms/Library/Developer/CoreSimulator/Devices/70B8D234-8CD5-43F7-8915-80378BB7116C/data/Library/Keychains/TrustStore.sqlite3

  Certificate added

Import certificate to iPhone 11 v13.3 [y/N] y

Importing to /Users/comms/Library/Developer/CoreSimulator/Devices/8BE1EF1C-42D4-4C17-BC25-685EBB0726C2/data/Library/Keychains/TrustStore.sqlite3

  Certificate added 

 

 

xcode 12에서 안된다면...

1. 파일경로에 한글이 포함된 폴더가 존재하면 안되는 것 같다.

2. 원하는 시뮬레이터를 실행시킨 후에 해보자.

반응형
반응형

실행 오류
상세오류

 

singing 이 맞지 않아서 생긴 문제라고 한다.

signing 부분을 수동으로 관리하고 있었는데, 이부분을 auto로 했더니 잘된다.

 

다만 이렇게 되면 실배포할때는 또 안될 것 같다는 생각이든다.

그럴땐 다시 수동으로 해줘야할 것같은데, Target을 복사해서 singing 부분만 바꿔서 사용해야할지 고민을 해봐야할 것 같다.

 

 

반응형
반응형

let message = "abcdefg\n1234567\n가나다라마바사\nABCDEFG"

let line = message.reduce(into: 0) { (count,letter) in

    if letter == "\n" {

        count += 1

    }

}

 

print(line)

 

https://stackoverflow.com/questions/46490920/count-the-number-of-lines-in-a-swift-string

반응형

'Programming > Swift' 카테고리의 다른 글

[swift5] 시뮬레이터에 인증서 넣기  (0) 2020.02.25
[Swift5] 아이폰 연결시 에러  (0) 2020.02.03
xcode git 연동 문제  (0) 2020.01.16
[swift] slide animation  (0) 2019.11.21
[cocoaPods] 프로젝트 만들어 보기  (0) 2019.10.22
반응형

pc를 재설치하고 Xcode에 git 셋팅 후 작업을 해보았다.

그러나 아래와 같은 메세지를 보여주며 작동이 되지 않는다.

 

이런 경우 Fix 버튼을 눌러서 Author Name, Author Email 값을 넣어준다.

끝.

반응형
반응형

case 1.

let transition = CATransition()

transition.type = CATransitionType.push

transition.subtype = CATransitionSubtype.fromLeft

memoView.layer.add(transition, forKey: nil)

memoView.addSubview(countChartView)

memoView.addSubview(closeMemoButton)

case 2.

UIView.transition(with: self.memoView, duration: 1.0, options: [.transitionFlipFromRight], animations: {

      memoView.addSubview(countChartView)

//       self.memoView.removeFromSuperview()

}, completion: nil)

 

 

반응형

'Programming > Swift' 카테고리의 다른 글

[Swift5] 문자열에 대한 라인수 구하기  (0) 2020.01.29
xcode git 연동 문제  (0) 2020.01.16
[cocoaPods] 프로젝트 만들어 보기  (0) 2019.10.22
[iOS13] 당황스럽게 변경된 점  (0) 2019.10.22
[Swift] opacity  (0) 2019.03.22
반응형

본 내용은 2019년 2월 28일에 메모장에 작성된 것을 복붙한 것이다.

기억이 잘 안나지만, 이게 작동이 되었는지는 알 수 없다.

다만 했다는 기억만으로 이렇게 남겨 놓는다.

 

 

1. Github repository 만들기

 

2. cocoaPods 사이트에서 동일한 이름이 있는지 확인하자.

    ex. https://cocoapods.org/pods/mySamplePods 접속하던가, 사이트내에서 검색을 해보아라.

 

3. cocoaPods 프로젝트 만들기

$ pod lib create demoPods

/Users/sk/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/cocoapods-1.6.1/lib/cocoapods/executable.rb:89: warning: Insecure world writable dir /Users/sk/Documents/2016/hadoop/hadoop-1.2.1/sbin in PATH, mode 040777

Cloning `https://github.com/CocoaPods/pod-template.git` into `demoPods`.

Configuring demoPods template.

/Users/sk/Documents/2016/Development/cocoaPods/demoPods/setup/TemplateConfigurator.rb:207: warning: Insecure world writable dir /Users/sk/Documents/2016/hadoop/hadoop-1.2.1/sbin in PATH, mode 040777

security: SecKeychainSearchCopyNext: The specified item could not be found in the keychain.

 

-----------------------------------------------------------------------------------------------------------------------------

 

To get you started we need to ask a few questions, this should only take a minute.

 

If this is your first time we recommend running through with the guide: 

 - https://guides.cocoapods.org/making/using-pod-lib-create.html

 ( hold cmd and double click links to open in a browser. )

 

 

What platform do you want to use?? [ iOS / macOS ]

 > iOS

 

What language do you want to use?? [ Swift / ObjC ]

 > Swift

 

Would you like to include a demo application with your library? [ Yes / No ]

 > Yes

 

Which testing frameworks will you use? [ Quick / None ]

 > None

 

Would you like to do view based testing? [ Yes / No ]

 > No

security: SecKeychainSearchCopyNext: The specified item could not be found in the keychain.

security: SecKeychainSearchCopyNext: The specified item could not be found in the keychain.

security: SecKeychainSearchCopyNext: The specified item could not be found in the keychain.

security: SecKeychainSearchCopyNext: The specified item could not be found in the keychain.

security: SecKeychainSearchCopyNext: The specified item could not be found in the keychain.

security: SecKeychainSearchCopyNext: The specified item could not be found in the keychain.

 

Running pod install on your new library.

 

/Users/sk/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/cocoapods-1.6.1/lib/cocoapods/executable.rb:89: warning: Insecure world writable dir /Users/sk/Documents/2016/hadoop/hadoop-1.2.1/sbin in PATH, mode 040777

Analyzing dependencies

Fetching podspec for `demoPods` from `../`

Downloading dependencies

Installing demoPods (0.1.0)

Generating Pods project

Integrating client project

 

[!] Please close any current Xcode sessions and use `demoPods.xcworkspace` for this project from now on.

Sending stats

Pod installation complete! There is 1 dependency from the Podfile and 1 total pod installed.

 

[!] Automatically assigning platform `ios` with version `9.3` on target `demoPods_Example` because no platform was specified. Please specify a platform for this target in your Podfile. See `https://guides.cocoapods.org/syntax/podfile.html#platform`.

 

 Ace! you're ready to go!

 We will start you off by opening your project in Xcode

  open 'demoPods/Example/demoPods.xcworkspace'

 

To learn more about the template see `https://github.com/CocoaPods/pod-template.git`.

To learn more about creating a new pod, see `http://guides.cocoapods.org/making/making-a-cocoapod`. 

 - 위 keycahin 찾을수없다는 메세지가 나오는데 모르겠음. 

 - 명령어를 실행시킨 위치에서 하위 폴더가 생성 것이다.

 - Xcode 자동 실행된다.

 

4. mySamplePods.podspec 수정

 - 수정할 대상은 s.name, s.version, s.homepage 등이 있다.
 - 하지만 주어진 포맷대로 수정을 해보았지만 오류가 많다.
 - 나의 방법은 그동안 평소 쓰던 다른 사람들이 만들어 놓은 cocoapods GitHub 라이브러리 들어가서 podspec 파일을 가져와서 그대로 수정해주면 된다.

 

5. 파일을 생성하고 스위프트 버전을 넣어준다.

$ vi .swift-version

4.2 <- 버전

6. pod lib lint

 - .podspec 파일을 맞게 작성했는지 체크를 한다.

 

7. Error 체크

 - 에러가 것이다. 여러가지 에러가 나온다. 정말 울화가 치밀어 오른다. 너무 많은 에러를 접했는데 그나마 자주 등장하는 에러만 적어 보았다.

## 1 ##

WARN  | [iOS] swift: The validator used Swift 3.2 by default because no Swift version was specified. To specify a Swift version during validation, add the `swift_version` attribute in your podspec. Note that usage of the `--swift-version` parameter or a `.swift-version` file is now deprecated.
.swift-version 파일을 생성하였지만, 그래도 위와 같은 에러가 발생한다. 이유모름
“pod lib lint —swift-version=4.2” 같이 실행하라.
—swift-version=4.2 옵션은 아래에서도 동일하게 사용된다.

 

## 2 ##
ERROR | [iOS] file patterns: The `resources` pattern did not match any file.
resources 폴더 또는 파일이 존재않는 것이다. 혹은 경로를 잘못 입력하였거나

 

## 3 ##
WARN  | url: The URL (https://github.com/Name/mySamplePods) is not reachable.
유효한 웹페이지를 입력해야한다. 일단 접속되는 아무 URL 입력해도 되는 같음.

 

## 4 ##
demoPods passed validation.
문구가 나오면 성공한 것이다.

 

8. git push

## $ git init  => 존재한다고 하면 그냥 무시.
Reinitialized existing Git repository in /cocoaPods/mySamplePods/.git/


## $ git add -all
## $ git commit -m “Initial commit”
## $ git tag 0.1.0 => 동일 버전을 입력
## $ git remote add origin https://github.com/developer/mySamplePods.git

## $ git push -u origin master —tags => 에러!! ~ 짱나
error: failed to push some refs to 'https://github.com/developer/mySamplePods.git'
=> 이럴 경우 찾아보니 해결 방법은 많은 같더라. 한개 해봤는데 안돼!
## $ git pull --rebase origin master
## $ git push origin master
=> 강제적으로 넣는게 있다고 해서 그냥 이걸로 했음. $ git push origin +master
## github 사이트에가서 제대로 업로드가 되었는지 확인 해보자. 

 

9. CocoaPods 등록 : 인증작업

$ pod trunk register myEamilAddress@gmail.com mySamplePodsTrunk --description=“mySamplePods.PG"

명령어가 실행이 된 후 메일 내용 확인

 

위 메일 내용의 링크를 클릭하면 이와 같은 페이지가 나타난다.

 

10. CocoaPods 등록 : 업로드

$ pod trunk push demoPods.podspec --swift-version=4.2

에러가 나서 확인을 했더니, .podspec 파일의 값이 리셋되어 있는 것이 아닌가 ㅠㅠ
다시 수정하여 재실행 하였다. 결국에는 아래와 같이 나왔다. 성공이다.

수정이 되었는지 알수없다. 다만 git push 할때 강제로 해서 그럴 같다는 생각이 든다.
https://cocoapods.org/pods/mySamplePods 접속을 해보면 접속이된다.

그러나 이 작업이 성공하지 못하면, 잘못된 페이지라고 나올 것이다.

완료된 메세지

11. 이제 사용 해볼까?

현재버전

Xcode 보면 Pods 프로젝트에서 Development Pods 에서 작업을 하면 되는 같다.
Development Pods > mySamplePods > Pod > Classes > *.swift  —> Classes 없으면 만들어 주면 된다.
수정을 했다고 가정하고, .podspec 파일 버전업을 시켜준다.

그리고 위에서 했던 처럼 git 올리고 cocoapods 올리면 된다.
cocoapods 사이트가서 확인해보면 버전이 올라간 것을 확인 있다.

 

버전업

12. 테스트로 임시적으로 프로젝트를 만들어서 pod install 해보자.

반응형

'Programming > Swift' 카테고리의 다른 글

xcode git 연동 문제  (0) 2020.01.16
[swift] slide animation  (0) 2019.11.21
[iOS13] 당황스럽게 변경된 점  (0) 2019.10.22
[Swift] opacity  (0) 2019.03.22
[Swift] UserDefaults.standard int형식으로 불러오기  (0) 2019.02.18
반응형

1. present(_:animated:completion:)

화면전환 시 사용되는 present의 기존 iOS13 이전까지만 해도 default가 fullScreen 이였다.

하지만 iOS13 부터 formsheet가 되었다. 설정을 위해서는 automatic으로 지정해야한다.

그래서 기존 처럼 fullScreen 을 하기 위해서는 아래와 같이 지정한다.

cell.modalPresentationStyle = .fullScreen

self.present(cell, animated: true, completion: nil)

//자세한 내용

https://zeddios.tistory.com/828

https://stackoverflow.com/questions/56435510/presenting-modal-in-ios-13-fullscreen

https://zonneveld.dev/ios-13-viewcontroller-presentation-style-modalpresentationstyle/

 

2. adMob 전면 광고

잘 되던 전면광고가 formSheet처럼 보여지게 되었고, 광고가 전부 보여지지 않고, 반쪽만 보여지게 되었다.

Google-Mobile-Ads-SDK 를 최신버전으로 설치하자.

필자 같은 경우 7.3 버전이였고 7.5로 업데이트를 하였더니, 아무문제 없었다.

 

2-1. adMob 광고

info.Plist에 이것도 추가를 해줘야한다. 앱이 실행되자마자 크래쉬가 된다.

# Error

Google Ad Manager publishers, follow instructions here: https://googlemobileadssdk.page.link/ad-manager-ios-update-plist

위 문구를 찾아보았다.

//https://stackoverflow.com/questions/55577811/xcode-error-when-added-admob-plugin-to-ionic-project

 

info.Plist 에 GADIsAdManagerApp 를 추가하고 Boolean 값으로 YES로 설정해주면 된다.

 

반응형
반응형

UIView를 반투명하려면 opacity를 사용한다.

let background = UIView()

background.layer.backgroundColor = UIColor.black.cgColor

background.layer.opacity = 0.5 


하지만 이 뷰안에 다른 레이블이 포함되었을 경우, 포함된 레이블도 같이 투명하게 되는 경우가 있다.

let background = UIView()

background.layer.backgroundColor = UIColor.black.cgColor

background.layer.opacity = 0.5

let title = UILabel()

backgroud.addSubview(title)


이럴 경우 이렇게 해보자

let background = UIView()

background.layer.backgroundColor = (UIColor.black.cgColor).copy(alpha: 0.5)

let title = UILabel()

background.addSubview(title)


반응형
반응형

        // 저장할때는 동일하다.

        UserDefaults.standard.set(5, forKey:"num")

        

        // 불러올 때

        UserDefaults.standard.integer(forKey: "num")


반응형
반응형

        let taskText = "All Tasks (task)"

        let attributed = NSMutableAttributedString(string: taskText)

        let strokeTextAttributes = [

//            NSAttributedString.Key.strokeColor : UIColor.black,

            NSAttributedString.Key.foregroundColor : UIColor.black,

//            NSAttributedString.Key.strokeWidth : 2.0,

            NSAttributedString.Key.font : UIFont.boldSystemFont(ofSize: 18)

            ] as [NSAttributedString.Key : Any]

        

        attributed.addAttributes(strokeTextAttributes, range: (taskText as NSString).range(of: "(task)"))

        titleLabel.attributedText = attributed



반응형
반응형

    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {

        // Override point for customization after application launch.

        UINavigationBar.appearance().barTintColor = UIColor.white//.init(red: 23.0/255, green: 197.0/255, blue: 157.0/255, alpha: 1.0)

        

        // To change colour of tappable items.

        UINavigationBar.appearance().tintColor = .black

        

        // To apply textAttributes to title i.e. colour, font etc.

        UINavigationBar.appearance().titleTextAttributes = [.foregroundColor : UIColor.black, .font : UIFont.init(name: "AvenirNext-DemiBold", size: 22.0)!]

        

        // To control navigation bar's translucency.

        UINavigationBar.appearance().isTranslucent = false


        return true

    }


반응형
반응형

override func viewDidLoad() {

        super.viewDidLoad()

        self.navigationController?.navigationBar.setBackgroundImage(UIImage(), for: UIBarMetrics.default)

        self.navigationController?.navigationBar.shadowImage = UIImage()

}


반응형
반응형

사실 이게 무엇인지 모른다.

다만 추측하건데, 이미지의 색상을 지원하는 포맷이랄까?

RGB 또는 256 컬러 이런게 업그레이드 되어 색상을 얼마나 지원줄 수있는지의 설정값 같다.



1. 어떻게 알았는가?


collectinView 에 저장된 이미지를 보여주기 위해 구현 하였다.

ipad 시뮬레이터에서만 이미지가 부분적으로 보여지고 있었다.

iphone 에서는 잘되는 것이 pad 에서만 안되고 있으니, 미치고 팔짝 뛸 노릇이였다.


보여지는 이미지와 보여지지 않는 이미지를 비교를 해보았다.

Xcode에서 아래와 같이 보여졌다.


- 보여지는 이미지


- 보여지지 않는 이미지



위 두 개의 이미지를 비교했을 때  Color Space가 유독 눈에 들어온다.

sRGB  와 Apple Wide Color

Apple Wide Color는 무엇인가? ㅠㅠ

아무튼 해결 방법은 Apple Wide Color를 sRGB로 바꿔주면 되는 거 아닌가



2.해결

1.기본 사진 어플리케이션에 이미지를 넣어준다.

2.해당 이미지를 선택하고 command + shift + E 를 누르면 아래와 같이 나온다.



3. 색상프로파일을 선택하고, sRGB로 선택하고 내보내기를 누르면 바뀐형식의 이미지 파일 생성된다.

4. 생성된 파일을 올리고 컴파일을 해보면 정상적으로 작동된다.



3.결론

그리고 왠지 모르게 sRGB보다 apple wide color 가 더 색을 많이 지원해 줄 것 같다는 생각이들었다.

그런데 apple wide color 인데 apple꺼인 xcode에서 지원이 안된다는 것은 좀 이상하지 않은가


구글링을 해본 결과, xcode 버그 일것 같다는 의견들이 많았다.

나도 그냥 이렇게 생각하고 싶다.

반응형
반응형


키보드가 활성화 될 때 하단 부분은 가려지게 될 것이다.

반드시 보여져야 하는 레이어들이라면 키보드 위로 올려서 보여질 수 있게 해보자.

let inputTyping = UITextView()

let buttonExecution = UIButton()

override func viewDidLoad() {

    super.viewDidLoad()

    let tap:UITapGestureRecognizer = UITapGestureRecognizer(target: self, action: #selector(self.dismissKeyboard))

    self.view.addGestureRecognizer(tap)

    NotificationCenter.default.addObserver(self, selector: #selector(self.keyboardShow), name: NSNotification.Name.UIKeyboardWillShow, object: nil)

    NotificationCenter.default.addObserver(self, selector: #selector(self.keyboardHide), name: NSNotification.Name.UIKeyboardWillHide, object: nil)

}

@objc func dismissKeyboard() {

    self.view.endEditing(true)

}

@objc func keyboardShow(notification: NSNotification) {

        if let keyboardSize = (notification.userInfo?[UIKeyboardFrameEndUserInfoKey] as? NSValue)?.cgRectValue {

            if self.view.frame.origin.y == 0 {

                self.view.frame.origin.y -= keyboardSize.height

                self. inputTyping.frame.origin.y -= keyboardSize.height

                self. buttonExecution.frame.origin.y -= keyboardSize.height

        }

    }

}

@objc func keyboardHide(notification: NSNotification) {

    if let keyboardSize = (notification.userInfo?[UIKeyboardFrameEndUserInfoKey] as? NSValue)?.cgRectValue {

        if self.view.frame.origin.y != 0 {

            self.view.frame.origin.y += keyboardSize.height

             self. inputTyping.frame.origin.y += keyboardSize.height

            self. buttonExecution.frame.origin.y += keyboardSize.height

        }

    }



나의 삽질은 어디까지 인 것인가?


화면의 반을 차지하는 imageView, 그 아래 textView, 그 아래 button 이 위치하도록 구현을 하였다.

여기서 내가 원하던 것은 키보드가 활성화 될 때 일부로 버튼이 보여지지 않게 하고 imageView 와 textView 창만 올라가게 끔 하려고 했다.

물론 위 소스와 동일하게 했을 시 잘 올라간다.

여기서 더 욕심을 내서 textView를 키보드 바로 위로 맞춰서 하는게 나의 목표였다.

이해가 되질 않는다면 아래 그림을 보면 될 것이다.



그런데....

키보드 바로 위로 textView를 맞춰지지 않는 것이다.

키보드에 가려져 보이지 않거나, 반만 보이거나, 너무 위로 올라가서 키보드와의 간격이 넓어지거나

온갖(?) 방법을 다 해보았다.

온갖 방법이란 내 머리속의 수학 아닌 산수를 동원하여, 위치값까지 하나하나 찾아가고,

"일단 키보드가 바라보는 디바이스의 위치값과 뷰안에 존재하는 위치값은 다를 수 있지!!" 라며

말이 되는 가설과 말도 안되는 가정들을 노트에 수십번을 적어가며

계산하고 계산하였다.


이렇게 구구절절 얘기하는 것은 그만큼 삽질을 많이 했다는 얘기이다.

결국에는 내가 세운 계산법으로는 해내지 못하였다.


포기하고 버튼도 위로 올려버렸다.

위 소스에서 한줄만 더 추가하면 된다.

소스의 파란색 글씨가 그것이다.

1. keyboardShow => self. buttonExecution.frame.origin.y -= keyboardSize.height

2. keyboardHide => self. buttonExecution.frame.origin.y += keyboardSize.height  


허무하게 이 한줄을 넣고 시뮬레이션을 돌리는 순간.

유레카!!!!


이 한줄 추가하면서 모든게 제대로 잘 보여지는데,

아래 버튼 사이즈만 내려볼까?

라는 생각이 들어버렸다.


되면 당연히 좋지만, 한편으로는 엄청 허무할 것 같다는 생각이 들었다.

성공

@objc func keyboardShow(notification: NSNotification) {

        if let keyboardSize = (notification.userInfo?[UIKeyboardFrameEndUserInfoKey] as? NSValue)?.cgRectValue {

            let keyboardResize = keyboardSize.height - createButton.frame.height

            if self.view.frame.origin.y == 0 {

                self.view.frame.origin.y -= keyboardResize

                self. textView.frame.origin.y -= keyboardResize

        }

    }

}


성공은 했지만, 버튼을 위로 올리는 것이 나을 것 같아서 적용은 하지 않았다.

추후에 적용할 일이 생기면 참고하기 위해서 이렇게 글로 남겨 놓는다.

매번 느끼는 것이지만 항상 허무한 결론이다.


참고 URL

https://stackoverflow.com/questions/26070242/move-view-with-keyboard-using-swift


반응형
반응형

1. 이미지 사이즈

https://developer.apple.com/ios/human-interface-guidelines/icons-and-images/custom-icons/

필자는 25사이즈로 한다.

참고로 이미지는 png 확장자를 사용하며, 투명바탕에 흰색 이미지를 사용하는 것이 좋은 것 같다.


2. 탭바 선택하였을 때 이미지가 변화되도록 하려면



반응형
반응형

언제부터인지 몰라도 갑자기 크롬 브라우저에서 jqplot 차트를 이미지화 시켜 엑셀파일에 저장해 놓은 소스가 작동이 안되고 메모리가 부족하다는 이미지만 계속 내뿜고 있었다.


처음에는 몰랐다. 그래서 원인을 찾는데도 한참 걸렸다.

파폭, IE에서는 무난하게 잘되고 있었고 유독 크롬만 이런 것이다.


브라우저 문제라고 판단하였지만, 쉽게 해결 되지는 않았다.


쿼리가 문제가 있나 싶어서 온갖 튜닝을 해봤지만, 결과는 똑같았고

결국에 jqplot이 문제라는 것을 알았다.


이 중에서 출력된 jqplot 차트를 이미지화 시키는 부분이 문제라는 것도 나중에 알게되었다.


이제 이것을 해결 하기 위해 많은 것을 파헤치기 시작했다.


결론은 아래 파일을 추가해주고, head 에 jqplot과 관련 된 곳에 추가적으로 지정해 두었다. 해결하였다.

jqplot.toImage.js


<head>

        <script src="./jqplot/plugins/jqplot........"></script>

<script src="./jqplot/plugins/jqplot.toImage.js"></script>

</head>



아래 URL은 확실하게 참고한 URL이다.

https://stackoverflow.com/questions/12182598/jqplot-as-image

https://bitbucket.org/ef4/jqplot/src/a59e7e7a5e97ea721a7b8571612b334e8c025b36/src/jqplot.toImage.js?at=default&fileviewer=file-view-default








반응형

'Programming > JavaScript' 카테고리의 다른 글

브라우저 창 크기에 따른 변화  (0) 2017.08.08
특정 태그 제외  (0) 2017.06.14
javascript 에서 replaceAll  (0) 2015.10.23
반응형

시뮬레이터를 하는 아래와 같은 메세지로 인해 다운이 되었다.


libsystem_kernel.dylib`__abort_with_payload: 


내가 사용할 것은 UIImagePicker이다.

엄청 난 삽질 끝에 알아낸 사실은 Info.plist에 추가해 줘야한다는 것을 깜빡 잊고 있었다.

Privacy - Photo Library Usage Description 


반응형
반응형

import UIKit


var totalCount = 18

var gemCard = 1

var ranArray = [1,2,3,4,5,6,7,8,9,10,11,12,13]


while(totalCount>0) {

    

    let randomIndex = Int(arc4random_uniform(UInt32(ranArray.count)))

    print(ranArray[randomIndex])

    

    ranArray.remove(at: randomIndex)

    

    totalCount-=2

} 


반응형
반응형

https://www.youtube.com/watch?v=dqad3XuMwHI


1. 해당 음악 파일을 추가하였을 경우 Build Phases 에 추가가 되었는지 확인해 보자. (ex. sample.mp3)

   추가가 안되어있으면 + 버튼으로 추가해 주면 된다.


2. 어플이 종료 되어도 백그라운드에서 돌아갈 수 있게 하려면 아래와 같이 설정 해야 한다.


3. 소스

import UIKit

import AVFoundation


class ViewController: UIViewController {


    var audioPlayer = AVAudioPlayer()

    

    override func viewDidLoad() {

        super.viewDidLoad()

        // Do any additional setup after loading the view, typically from a nib.

        do {

            audioPlayer = try AVAudioPlayer(contentsOf: URL.init(fileURLWithPath: Bundle.main.path(forResource: "sample", ofType: "mp3")!))

            audioPlayer.prepareToPlay()

            

            // 백그라운드에서도 돌아갈 수 있게 하는 코드

            var audioSession = AVAudioSession.sharedInstance()

            do {

                try audioSession.setCategory(AVAudioSessionCategoryPlayback)

            } catch {

                

            }

            

        } catch {

            print(error)

        }

    }


    override func didReceiveMemoryWarning() {

        super.didReceiveMemoryWarning()

        // Dispose of any resources that can be recreated.

    }

    

    @IBAction func play(_ sender: Any) {

        audioPlayer.play()

        

    }


    @IBAction func pause(_ sender: Any) {

        if audioPlayer.isPlaying {

            audioPlayer.pause()

        } else {

            

        }

    }

    

    @IBAction func restart(_ sender: Any) {

        if audioPlayer.isPlaying {

            audioPlayer.currentTime = 0

            audioPlayer.play()

        } else {

            audioPlayer.play()

        }

        

    }

} 


4. 시뮬레이터를 돌렸을 경우 백그라운드 설정을 굳이 안해도, 어플이 종료가 되어도 음악이 나왔다.

   그러나 아이폰에 직접 넣어서 해보았더니, 백그라운드 설정해야지 되더라!

반응형
반응형
반응형
반응형

func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize {

    let width = collectionView.frame.width / 4 - 1

    return CGSize(width: width, height: width)

}

 

func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, minimumLineSpacingForSectionAt section: Int) -> CGFloat {

    return 1.0

}

    

func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, minimumInteritemSpacingForSectionAt section: Int) -> CGFloat {

    return 1.0


반응형

'Programming > Swift' 카테고리의 다른 글

[AVPlayer] background audio  (0) 2017.09.11
ttf, otf 폰트 추가하는 법  (0) 2017.09.09
UIImageView 를 다른 UIImageView로 동일한 크기로 처리  (0) 2017.08.21
[ERROR] csqlite, stdatomic.h  (0) 2017.05.18
background to foreground  (0) 2017.04.27
반응형

var TempImageView: UIImageView? = nil

var img: UIImageView? = nil


img.image = UIImage(data: "aaaa.png");


if let MainSize = TempImageView?.frame.size {

    img.frame.size = MainSize

    TempImageView?.contentMode = UIViewContentMode.scaleAspectFill

    TempImageView?.clipsToBounds = true


    TempImageView?.addSubview(img)

} 

생각나는 대로 작성을 하였기 때문에 작동은 안될 것 같다.

다만 위와 비슷하게 작업으로 한다면 처리 될 것이다.


반응형

'Programming > Swift' 카테고리의 다른 글

ttf, otf 폰트 추가하는 법  (0) 2017.09.09
[Swift] CollectionView Layout 비율 맞추기  (0) 2017.09.04
[ERROR] csqlite, stdatomic.h  (0) 2017.05.18
background to foreground  (0) 2017.04.27
버튼을 통한 Boolean  (0) 2017.04.17
반응형

왼쪽,오른쪽의 2개의 div가 존재한다고 가정하였을때,

브라우저 창이 작아지면 width가 작아져 오른쪽 div가 아래로 내려가는 현상이 발생하는 경우가 생긴다.


나는 js로 width 사이즈를 동적으로 주고 있었기 때문에 js로 해결을 하려고한다.

$(function() {

    $(window).resize(function() {

        var width = $(this).width();

        var("#Right").width(width - $("#Left").width());

    });

}); 


반응형

'Programming > JavaScript' 카테고리의 다른 글

[ERROR] jqplot 차트 이미지 출력 문제점  (0) 2017.12.07
특정 태그 제외  (0) 2017.06.14
javascript 에서 replaceAll  (0) 2015.10.23

+ Recent posts