tag:crieit.net,2005:https://crieit.net/tags/Xcode/feed
「Xcode」の記事 - Crieit
Crieitでタグ「Xcode」に投稿された最近の記事
2021-12-15T18:22:37+09:00
https://crieit.net/tags/Xcode/feed
tag:crieit.net,2005:PublicArticle/17856
2021-12-15T18:22:37+09:00
2021-12-15T18:22:37+09:00
https://crieit.net/posts/Swift-Cartography
SwiftでCartographyを使う方法
<pre><code>//画面の横幅の長さを取得する変数を宣言
let width = UIScreen.main.bounds.size.width
//banner画像
let banner_image:UIImage = UIImage(named:"logo")!
let imageView = UIImageView(image:banner_image)
self.view.addSubview(imageView)
constrain(imageView, view) { banner_image, view in
banner_image.top == banner_image.superview!.top + 120
banner_image.left == banner_image.superview!.left + 25
banner_image.width == width - 50
banner_image.height == (width - 50) / 2
}
</code></pre>
<p>参考URL</p>
<p><a target="_blank" rel="nofollow noopener" href="https://wagtechblog.com/programing/swift-cartography.html">https://wagtechblog.com/programing/swift-cartography.html</a></p>
wawa
tag:crieit.net,2005:PublicArticle/17749
2021-11-11T17:42:02+09:00
2021-11-21T08:11:46+09:00
https://crieit.net/posts/iPadOS-15
iPadOS 15 にするとカーソルキーが動かなくなる問題の修正方法
<p><a target="_blank" rel="nofollow noopener" href="https://qiita.com/danjiro/items/253e5a33a38599098274">フリーソフト9VAeきゅうべえ</a> 、iPad版について。<br />
iPad OS 15 にすると、キーボードのカーソルキーがきかなくなった。Alt+カーソルキーは動作するが、カーソルキーだけ押すと反応しない。</p>
<p>調べると、UIKeyCommand の wantsPriorityOverSystemBehavior を YES に設定しないといけないらしい。カーソルキーがOSのショートカットに割り当てられたみたいだ。<br />
修正には、Xcode 13 (Big Sur以上)が必要</p>
<p>修正前</p>
<pre><code>- (NSArray *)keyCommands {
return @[
[UIKeyCommand keyCommandWithInput: UIKeyInputUpArrow modifierFlags: 0 action: @selector(keyUp)],
[UIKeyCommand keyCommandWithInput: UIKeyInputDownArrow modifierFlags: 0 action: @selector(keyDown)],
[UIKeyCommand keyCommandWithInput: UIKeyInputLeftArrow modifierFlags: 0 action: @selector(keyLeft)],
[UIKeyCommand keyCommandWithInput: UIKeyInputRightArrow modifierFlags: 0 action: @selector(keyRight)]
];
}
</code></pre>
<p>修正後</p>
<pre><code>- (NSArray *)keyCommands {
UIKeyCommand *ukey = [UIKeyCommand keyCommandWithInput: UIKeyInputUpArrow modifierFlags: 0 action: @selector(keyUp)];
UIKeyCommand *dkey = [UIKeyCommand keyCommandWithInput: UIKeyInputDownArrow modifierFlags: 0 action: @selector(keyDown)];
UIKeyCommand *lkey = [UIKeyCommand keyCommandWithInput: UIKeyInputLeftArrow modifierFlags: 0 action: @selector(keyLeft)];
UIKeyCommand *rkey = [UIKeyCommand keyCommandWithInput: UIKeyInputRightArrow modifierFlags: 0 action: @selector(keyRight)];
if (@available(iOS 11.0, *)) if(@available(iOS 15.0, *)){
ukey.wantsPriorityOverSystemBehavior = YES;
dkey.wantsPriorityOverSystemBehavior = YES;
lkey.wantsPriorityOverSystemBehavior = YES;
rkey.wantsPriorityOverSystemBehavior = YES;
}
return @[ ukey, dkey, lkey, rkey ];
}
</code></pre>
<p>if (@available(iOS 11.0, *)) をいれておかないと、iOS 10 で落ちた。</p>
Danjiro Daiwa
tag:crieit.net,2005:PublicArticle/15860
2020-04-22T00:15:11+09:00
2020-04-22T00:15:11+09:00
https://crieit.net/posts/Xcode-Display-Name
XcodeでDisplay Nameを変更したらアップロードできなくなった
<p>XcodeでアプリをArchiveしてアップロードしようとしたら下記のようなエラーが出るようになった。ちなみにGodotで作ったアプリのためもしかしたら普通のアプリでは出ないのかもしれない。</p>
<pre><code>Store submission configuration cannot be requested. Bundle ID not found.
</code></pre>
<p>事前にやったことといえばXcode上でDisplay Nameを変えただけ。名称の表記ゆれがあるということでリジェクトされてしまったので、ストアに登録済みのものを正とし、Xcode側を変更した形。</p>
<p>いろいろ調べてみたが特にBundle IDは変わってはいないし、再度Profileをダウンロードしてきてもうまくいかない。</p>
<p>ふと気になってGitの差分をみてみたところ、Display Nameだけではなくてappファイル名とか、色々なものが連動して変わっていることに気づいた。もしかして……と思い一旦stashして元に戻してArchiveし、Validationを行ってみるとなんと正常に完了……。</p>
<p>どうもDisplay Nameに連動して色々変わって別アプリのようになってしまっていたらしい。Bundle IDが変わっていたわけではないので全然意味はわからないが。</p>
<p>ということで、余計なところを変更しないよう、Xcodeを閉じてシェルで文字列を検索してVimで直接タイトルを変更した。それでArchiveしてアップロードしてみたところ、正常にアップでき、申請してリリースすることが出来た。</p>
だら@Crieit開発者
tag:crieit.net,2005:PublicArticle/15565
2019-11-27T19:05:00+09:00
2019-11-27T19:05:00+09:00
https://crieit.net/posts/Code-sign-error-bundle-format-unrecognized-invalid-or-unsuitable
Code sign error : bundle format unrecognized, invalid, or unsuitableの解決方法の一つ
<p>Xcodeにて突然、タイトルのようにCodeSign failedというエラーが出てビルドできなくなった。</p>
<p>調べてみるとDerivedDataを削除するとか、再起動するとかの情報が出てくるので試してみるが復旧しない。むちゃくちゃ急いでいるときだったので非常に焦った。もしかしてApple Store Connectの方で何か更新とかをしないと駄目なのか……と思ったが、だいぶ昔に解説を見様見真似でやった程度なので何も覚えていない。このタイミングで非常に絶望……。もう無理……。</p>
<p>しかし、問題がではじめた前のコミットに戻してビルドしてみると動いた。どうも証明書とかの問題ではなさそう。しかし最新のコミットに戻すとやはり再発。</p>
<p>わけも分からず調べていると下記のようなページを見つけた。</p>
<p><a target="_blank" rel="nofollow noopener" href="https://stackoverflow.com/questions/29271548/code-sign-error-bundle-format-unrecognized-invalid-or-unsuitable">ios - Code sign error : bundle format unrecognized, invalid, or unsuitable - Stack Overflow</a></p>
<p>そこには「Xcode、Resourcesのことあんまり好きじゃないんだってさ……」</p>
<p>は、まさか……。</p>
<p>そう、最新のコミットではresourcesという名前でフォルダの参照をプロジェクトに追加していた。まさかと思い、半信半疑だったが名前をwwwにして再度フォルダの参照を追加してみてビルドしてみた。</p>
<p>いけたああああ!!!!!!</p>
だら@Crieit開発者
tag:crieit.net,2005:PublicArticle/14591
2018-11-02T15:43:53+09:00
2018-11-02T15:43:53+09:00
https://crieit.net/posts/window-is-not-equal-to
「window is not equal to」というログメッセージ
<p>ログに"window is not equal to"というメッセージが出力された。windowとあるので、Storyboardに問題があるのかと思ったが違った。また、メッセージの中にあるViewControllerが原因でもなかった。遷移元のViewControllerでperformSegue(withIdentifier:sender:)を2回呼んでいたことが原因だった。</p>
<blockquote>
<p>'s window is not equal to 's view's window!</p>
</blockquote>
<h3 id="ヒントになった"><a href="#%E3%83%92%E3%83%B3%E3%83%88%E3%81%AB%E3%81%AA%E3%81%A3%E3%81%9F">ヒントになった</a></h3>
<p><a target="_blank" rel="nofollow noopener" href="https://teratail.com/questions/12348">teratail「window is not equal to」というログメッセージ</a></p>
<h3 id="問題のコード"><a href="#%E5%95%8F%E9%A1%8C%E3%81%AE%E3%82%B3%E3%83%BC%E3%83%89">問題のコード</a></h3>
<pre><code class="swift">if user == nil {
self.performSegue(withIdentifier: "segueA", sender: nil)
return // このreturnを忘れた
}
self.performSegue(withIdentifier: "segueB", sender: nil)
// 終了
</code></pre>
<p>今回のケースでは、userがnilでないときに追加して他のことをするならguard文で書くのが妥当。上記のコードでは、遷移先の選択のみなので、guard文ではなくif else で並列に書くと意図が明確になると思う。</p>
あぜち(おばあちゃん)