您的位置:首页 > 其它

那些年我们被xcode坑过得。。。

2015-10-29 13:27 381 查看
1、切换运行环境, 编译中间文件不会自动重新编译


这个是真机环境,我编译跑得挺好;

好,接下来我切换到模拟器:

然后编译

出现以下一大堆错误


如图:


神奇了,里面竟然没有这个架构,我郁闷了,怎么会,是不是编译设置没有搞好;事实把我打败了。于是我摸索编译选项



没有问题啊,我专门认真研究了每一个选项,仍然一无所获

神奇,今天我再次查这个问题的问题的时候我突然意识到是不是clean下就好了,没想到啊没想到



果然是这个问题,和当年修改了头文件,不会重新编exe的坑是一样的

第二个问题:


The
executable gets signed with invalid entitlements in Xcode

32down
votefavorite
5

I got this error with Xcode 5 when I try to run the app on my device.

The executable was signed with invalid entitlement

It worked fine with Xcode 4.x. Anyone knows how to get rid of the error?



ios xcode code-signing provisioning-profile
shareimprove
this question
edited Jun
12 at 12:07





Michal
4,33072665

asked Oct 25 '13 at 4:42





Emmy
1,15921224

add
a comment


19 Answers

activeoldestvotes

up vote31down
vote
What worked for me was restarting Xcode.

shareimprove
this answer
edited Jul
18 '14 at 9:06

answered Apr 15 '14 at 7:35





Bear with me
15.9k65584

add
a comment
up vote15down
voteaccepted
I found out the problem. The app I created on developer.apple.com does not include inter-app-audio. The project entitlements plist file on Xcode has inter-app-audio set to YES (by default). Once I changed the setting on my app configuration on developer.apple.com
to enable the inter-app-audio. Then my app runs on my devices. I guess that is apple's new rule to make your app settings consistent on both developer.apple.com and your xcode project setting.

shareimprove
this answer
answered Oct 26 '13 at 0:42





Emmy
1,15921224

5
I toggled the Inter-App Audio capability to ON and then to OFF again, and this way the app worked... WT*? – Ferran
Maylinch Oct
7 '14 at 19:51
1
Ferran answer works for me. WT* – doxsi Dec
1 '14 at 8:28
Wow, unbelievable. Still a applicable fix, though for me it was the App Groups capability. – Keller May
4 at 14:57
add
a comment
up vote12down
vote
I was able to fix this by toggling on/off "Game Center" entitlement in Xcode 5 :-)

shareimprove
this answer
answered Feb 28 '14 at 17:31





dig
2,53622856

3
THANK YOU! You have no idea how frustrated I was this whole morning until I stumbled on your answer. Definitely fixed
it for me. – Gasper
Kolenc Jul
8 '14 at 14:43
add
a comment
up vote7down
vote
I think your problem lies because of the profile that you were using xCode4.6 and now you are using xCode5.

You need to refresh certs/prov profiles via XCode > Preferences > Accounts

XCode > Preferences > Accounts > Click on your DEV ACCOUNT > View Details button (bottom right) > Signing Iden/PPs screen appears > hit Refresh.

Then choose again from build settings the correct profile and clean and build your project.

Hope this helps you.

shareimprove
this answer
answered Oct 25 '13 at 5:39





Manthan
3,1301441

1
Thanks for your help. I found out the problem. The app I created on developer.apple.com does not include inter-app-audio.
The project entitlements plist file on Xcode has inter-app-audio set to YES (by default). Once I changed the setting on my app configuration on developer.apple.com to enable the inter-app-audio. Then my app runs on my devices. I guess that is apple's new rule
to make your app settings consistent on both developer.apple.com and your xcode project setting. – Emmy Oct
26 '13 at 0:43
Unfortunately it didn't work for me :/ – Or
Shanoon Oct
7 '14 at 6:52
add
a comment
up vote6down
vote
I had to match the app's capabilities in Xcode5 under
Capabilities ->
In-App purchase -> ON
Game Center -> ON


with that in the provisoning profile.

shareimprove
this answer
answered Jun 18 '14 at 7:53





Nithin Haridas
7112

Also it solved "Invalid token" error response of APNs. – hiroshi Oct
10 '14 at 2:32
adding game center entitlement and removing it back , worked for me as well. No idea why. – sleepwalkerfxOct
28 '14 at 7:37
add
a comment
up vote2down
vote
I had the same problem in XCode 5. This helped me anyway.
XCode > Preferences > Location tab > DerivedData


Press a little left arrow to open DerivedData in Finder. Move to trash folder of your project and rebuild.



shareimprove
this answer
edited Jul
23 '14 at 9:42





Jayprakash Dubey
5,18813652

answered Jan 27 '14 at 17:05





Prcela
2,0521428

1
This seems to be not working in my favor. – Jayprakash
Dubey Jul
23 '14 at 9:32
add
a comment
up vote2down
vote
If restarting xcode doesn't work make a new provision profile and be sure to include your test devices.

shareimprove
this answer
edited Oct
24 '14 at 19:11





matthias_h
6,71041028

answered Oct 24 '14 at 18:39





mohammad alabid
18715

Restarting/cleaning didn't work for me, but then I realized I hadn't added my new test phone to the Ad Hoc profile I
was using to build with. I regenerated/downloaded a updated profile and the error went away. Note: you may get a "security" error after doing this, which means the device needs you to authorize the app, just tap the app on device for the "trust developer"
alert to activate. – Randy
Hill Apr
8 at 20:52
add
a comment
up vote2down
vote
xcode 6.1 (HealthKit sample)

I was getting this error due to HealthKit integration: I had enabled In-App Purchase, Game Center and Healkit solved my issue.. The same I have enabled in Provision profile.





shareimprove
this answer
answered Dec 1 '14 at 13:31





Vinod Joshi
2,4881525

Had to do the same for keychain sharing. I also had an app extension, I had to do it in both places to make it work. – CaseyB Dec
22 '14 at 20:35
add
a comment
up vote2down
vote
(Xcode 6.1)

The problem for me was in my Build Settings; I had my Provisioning Profile set to an App Store Production Profile when trying to deploy to a device. I switched it to 'Automatic' and it resolved my issue. You could also set it to your Dev Provision Profile.

I also have 2 Certificates, so I added my second Certificate to my dev provision. Others probably won't have this problem.

shareimprove
this answer
answered Jan 26 at 18:35





Ian Newland
715

Thanks! Switching it to 'Automatic' did it for me – Emastmagy
MastMagy Jan
30 at 17:57
Strange that changing to automatic fixed it, but it worked for me. I had my provisioning profile set to com.mycompany.*
and was getting this error. There were red FixMe under the Capabilities tab, but after fixing those issue I still received the invalid entitlements error. I then tried changing my provisioning profile from com.mycompany.* to automatic and it fixed the issue.
I double checked that the bundleID is com.mycompany.blabla, so seems to be some sort of Xcode bug. I am using Xcode 6.3.2. – Jim
Range Jun
15 at 23:06
add
a comment
up vote2down
vote
The solution for latest Xcode 6.3.2:

First you have to check what is enabled in your Member center for your specific AppID:



Then in your appropriate target in Xcode you have to enabled the same capabilities: In this case:
App
Group
,
Game
Center
,
In-App
Purchase
. All of them have to be enabled in your target in Xcode.



However it doesn't matter for DEBUG mode:



it very matters for your RELEASE mode:


Note that
Game
Center
and
In-App
Purchase
are enabled by default in Member Center but are disabled in Xcode's target.

shareimprove
this answer
edited Jun
12 at 12:40

answered Jun 12 at 12:00





Bartłomiej Semańczyk
5,20044370

add
a comment
up vote2down
vote
In my case, the device wasn't added. So I had to add the device and generate a new provisioning profile.

shareimprove
this answer
answered Sep 8 at 6:19





Xavi Valero
69522966

add
a comment
up vote1down
vote
I solve this by deleting all
"PROVISIONING_PROFILE=..."
and
"PROVISIONING_PROFILE[sdk=iphoneos*]"
= ...
in project.pbxproj and restart Xcode and set provisioning profiles for the target again.

shareimprove
this answer
answered May 8 '14 at 2:38





BabyPanda
1,219714

add
a comment
up vote1down
vote
Had some issue. Resolve: go to right target -> capabilities -> for me there was issue with "In-App Purchase" and button to fix it. Off-on operation fixed issue.

shareimprove
this answer
answered Oct 27 '14 at 12:05





Hope Notopovich
314

add
a comment
up vote1down
vote
In my case: I need enable Inter-App Audio in

Capabilities
-> Inter-App Audio


I think because I use Parse.com Notification, it need link to AudioToolbox.framework

shareimprove
this answer
answered Nov 13 '14 at 4:10





Nguyen Tran
787

add
a comment
up vote1down
vote
Enabling Capabilities -> Inter-App Audio fixed this issue for me as well. I am also trying to send push notifications through parse

shareimprove
this answer
answered Feb 6 at 3:06





jstn
864

add
a comment
up vote1down
vote
Simple clean-and-build seemed to fix it for me.

shareimprove
this answer
answered Feb 6 at 18:11





Maxwell
2,78611235

add
a comment
up vote1down
vote
The answers here seem a bit inadequate so I'm adding my two cents:

The real solution is that there is generally a mismatch between what is stored in your provisioning profile (check at developer.apple.com -> members -> certificates -> the cert you're using [be sure to check if dev/production) and what is enabled in your app
(double click project name), under horizontal menu select'Capabilities' (next to 'General').

If you've recently changed one of these, be sure to refresh your certificates under XCode -> Preferences -> Accounts -> Details -> Refresh Icon and restart XCode.

shareimprove
this answer
answered Aug 5 at 7:44





jdero
73221129

add
a comment
up vote1down
vote
In my case APNS certificate is expired, remove the expired certificate and regenerate the provisioning profile fixes the issue.

shareimprove
this answer
answered Aug 11 at 9:28





BillChan
4913

add
a comment
up vote0down
vote
It seems to be a little bug inside Xcode. Try to archive it anyway, even there is a problem with
entitlements
.
If your entitlements are fine, it will be uploaded without any problem. Apple accept it, and your app will be published to the AppStore.

I did it, and it worked:)

32down
votefavorite
5

I got this error with Xcode 5 when I try to run the app on my device.

The executable was signed with invalid entitlement

It worked fine with Xcode 4.x. Anyone knows how to get rid of the error?



ios xcode code-signing provisioning-profile
shareimprove
this question
edited Jun
12 at 12:07





Michal
4,33072665

asked Oct 25 '13 at 4:42





Emmy
1,15921224

add
a comment


19 Answers

activeoldestvotes

up vote31down
vote
What worked for me was restarting Xcode.

shareimprove
this answer
edited Jul
18 '14 at 9:06

answered Apr 15 '14 at 7:35





Bear with me
15.9k65584

add
a comment
up vote15down
voteaccepted
I found out the problem. The app I created on developer.apple.com does not include inter-app-audio. The project entitlements plist file on Xcode has inter-app-audio set to YES (by default). Once I changed the setting on my app configuration on developer.apple.com
to enable the inter-app-audio. Then my app runs on my devices. I guess that is apple's new rule to make your app settings consistent on both developer.apple.com and your xcode project setting.

shareimprove
this answer
answered Oct 26 '13 at 0:42





Emmy
1,15921224

5
I toggled the Inter-App Audio capability to ON and then to OFF again, and this way the app worked... WT*? – Ferran
Maylinch Oct
7 '14 at 19:51
1
Ferran answer works for me. WT* – doxsi Dec
1 '14 at 8:28
Wow, unbelievable. Still a applicable fix, though for me it was the App Groups capability. – Keller May
4 at 14:57
add
a comment
up vote12down
vote
I was able to fix this by toggling on/off "Game Center" entitlement in Xcode 5 :-)

shareimprove
this answer
answered Feb 28 '14 at 17:31





dig
2,53622856

3
THANK YOU! You have no idea how frustrated I was this whole morning until I stumbled on your answer. Definitely fixed
it for me. – Gasper
Kolenc Jul
8 '14 at 14:43
add
a comment
up vote7down
vote
I think your problem lies because of the profile that you were using xCode4.6 and now you are using xCode5.

You need to refresh certs/prov profiles via XCode > Preferences > Accounts

XCode > Preferences > Accounts > Click on your DEV ACCOUNT > View Details button (bottom right) > Signing Iden/PPs screen appears > hit Refresh.

Then choose again from build settings the correct profile and clean and build your project.

Hope this helps you.

shareimprove
this answer
answered Oct 25 '13 at 5:39





Manthan
3,1301441

1
Thanks for your help. I found out the problem. The app I created on developer.apple.com does not include inter-app-audio.
The project entitlements plist file on Xcode has inter-app-audio set to YES (by default). Once I changed the setting on my app configuration on developer.apple.com to enable the inter-app-audio. Then my app runs on my devices. I guess that is apple's new rule
to make your app settings consistent on both developer.apple.com and your xcode project setting. – Emmy Oct
26 '13 at 0:43
Unfortunately it didn't work for me :/ – Or
Shanoon Oct
7 '14 at 6:52
add
a comment
up vote6down
vote
I had to match the app's capabilities in Xcode5 under
Capabilities ->
In-App purchase -> ON
Game Center -> ON


with that in the provisoning profile.

shareimprove
this answer
answered Jun 18 '14 at 7:53





Nithin Haridas
7112

Also it solved "Invalid token" error response of APNs. – hiroshi Oct
10 '14 at 2:32
adding game center entitlement and removing it back , worked for me as well. No idea why. – sleepwalkerfxOct
28 '14 at 7:37
add
a comment
up vote2down
vote
I had the same problem in XCode 5. This helped me anyway.
XCode > Preferences > Location tab > DerivedData


Press a little left arrow to open DerivedData in Finder. Move to trash folder of your project and rebuild.



shareimprove
this answer
edited Jul
23 '14 at 9:42





Jayprakash Dubey
5,18813652

answered Jan 27 '14 at 17:05





Prcela
2,0521428

1
This seems to be not working in my favor. – Jayprakash
Dubey Jul
23 '14 at 9:32
add
a comment
up vote2down
vote
If restarting xcode doesn't work make a new provision profile and be sure to include your test devices.

shareimprove
this answer
edited Oct
24 '14 at 19:11





matthias_h
6,71041028

answered Oct 24 '14 at 18:39





mohammad alabid
18715

Restarting/cleaning didn't work for me, but then I realized I hadn't added my new test phone to the Ad Hoc profile I
was using to build with. I regenerated/downloaded a updated profile and the error went away. Note: you may get a "security" error after doing this, which means the device needs you to authorize the app, just tap the app on device for the "trust developer"
alert to activate. – Randy
Hill Apr
8 at 20:52
add
a comment
up vote2down
vote
xcode 6.1 (HealthKit sample)

I was getting this error due to HealthKit integration: I had enabled In-App Purchase, Game Center and Healkit solved my issue.. The same I have enabled in Provision profile.





shareimprove
this answer
answered Dec 1 '14 at 13:31





Vinod Joshi
2,4881525

Had to do the same for keychain sharing. I also had an app extension, I had to do it in both places to make it work. – CaseyB Dec
22 '14 at 20:35
add
a comment
up vote2down
vote
(Xcode 6.1)

The problem for me was in my Build Settings; I had my Provisioning Profile set to an App Store Production Profile when trying to deploy to a device. I switched it to 'Automatic' and it resolved my issue. You could also set it to your Dev Provision Profile.

I also have 2 Certificates, so I added my second Certificate to my dev provision. Others probably won't have this problem.

shareimprove
this answer
answered Jan 26 at 18:35





Ian Newland
715

Thanks! Switching it to 'Automatic' did it for me – Emastmagy
MastMagy Jan
30 at 17:57
Strange that changing to automatic fixed it, but it worked for me. I had my provisioning profile set to com.mycompany.*
and was getting this error. There were red FixMe under the Capabilities tab, but after fixing those issue I still received the invalid entitlements error. I then tried changing my provisioning profile from com.mycompany.* to automatic and it fixed the issue.
I double checked that the bundleID is com.mycompany.blabla, so seems to be some sort of Xcode bug. I am using Xcode 6.3.2. – Jim
Range Jun
15 at 23:06
add
a comment
up vote2down
vote
The solution for latest Xcode 6.3.2:

First you have to check what is enabled in your Member center for your specific AppID:



Then in your appropriate target in Xcode you have to enabled the same capabilities: In this case:
App
Group
,
Game
Center
,
In-App
Purchase
. All of them have to be enabled in your target in Xcode.



However it doesn't matter for DEBUG mode:



it very matters for your RELEASE mode:


Note that
Game
Center
and
In-App
Purchase
are enabled by default in Member Center but are disabled in Xcode's target.

shareimprove
this answer
edited Jun
12 at 12:40

answered Jun 12 at 12:00





Bartłomiej Semańczyk
5,20044370

add
a comment
up vote2down
vote
In my case, the device wasn't added. So I had to add the device and generate a new provisioning profile.

shareimprove
this answer
answered Sep 8 at 6:19





Xavi Valero
69522966

add
a comment
up vote1down
vote
I solve this by deleting all
"PROVISIONING_PROFILE=..."
and
"PROVISIONING_PROFILE[sdk=iphoneos*]"
= ...
in project.pbxproj and restart Xcode and set provisioning profiles for the target again.

shareimprove
this answer
answered May 8 '14 at 2:38





BabyPanda
1,219714

add
a comment
up vote1down
vote
Had some issue. Resolve: go to right target -> capabilities -> for me there was issue with "In-App Purchase" and button to fix it. Off-on operation fixed issue.

shareimprove
this answer
answered Oct 27 '14 at 12:05





Hope Notopovich
314

add
a comment
up vote1down
vote
In my case: I need enable Inter-App Audio in

Capabilities
-> Inter-App Audio


I think because I use Parse.com Notification, it need link to AudioToolbox.framework

shareimprove
this answer
answered Nov 13 '14 at 4:10





Nguyen Tran
787

add
a comment
up vote1down
vote
Enabling Capabilities -> Inter-App Audio fixed this issue for me as well. I am also trying to send push notifications through parse

shareimprove
this answer
answered Feb 6 at 3:06





jstn
864

add
a comment
up vote1down
vote
Simple clean-and-build seemed to fix it for me.

shareimprove
this answer
answered Feb 6 at 18:11





Maxwell
2,78611235

add
a comment
up vote1down
vote
The answers here seem a bit inadequate so I'm adding my two cents:

The real solution is that there is generally a mismatch between what is stored in your provisioning profile (check at developer.apple.com -> members -> certificates -> the cert you're using [be sure to check if dev/production) and what is enabled in your app
(double click project name), under horizontal menu select'Capabilities' (next to 'General').

If you've recently changed one of these, be sure to refresh your certificates under XCode -> Preferences -> Accounts -> Details -> Refresh Icon and restart XCode.

shareimprove
this answer
answered Aug 5 at 7:44





jdero
73221129

add
a comment
up vote1down
vote
In my case APNS certificate is expired, remove the expired certificate and regenerate the provisioning profile fixes the issue.

shareimprove
this answer
answered Aug 11 at 9:28





BillChan
4913

add
a comment
up vote0down
vote
It seems to be a little bug inside Xcode. Try to archive it anyway, even there is a problem with
entitlements
.
If your entitlements are fine, it will be uploaded without any problem. Apple accept it, and your app will be published to the AppStore.

I did it, and it worked:)

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: