可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
I'm trying to build an extension project and Xcode keeps throwing the error in subject.
Needless to day, the extension's bundle id is prefixed with app's bundle id.
Product Name: ro.chitza.TodayPics.$(TARGET_NAME:rfc1034identifier
I've tried cleaning the build folder and rebuilding, no luck. The funny thing is the entire project got built for a few times, but after some code and UI changes it started failing. Even if I create new projects, the same thing happens after about 5-6 builds.
Did anyone else encounter this error? Any hints for a solution or workaround?
回答1:
Try a Clean before the Build. This fixed the problem for me (Xcode 6b2).
回答2:
It looks like the bundle ID behavior changed when WatchOS 2 arrived.
Previously I had an extension bundle identifier like this:
com.mycompany.myappname.watchkitextension
Somewhere else on Stackoverflow it was mentioned that the extension bundle identifier should be in this format, but no matter what I tried Xcode kept throwing errors at me.
The only possible solution is changing the extension bundle identifier to:
com.mycompany.myappname.watchkitapp.watchkitextension
I am pretty sure this wasn't the case with an WatchOS 1 app. A problem because of this change is that you can't actually generate an app id for the bundle identifier com.mycompany.myappname.watchkitextension
. This isn't necessary, just set all provisioning profiles in the build settings to automatic and don't forget to use the right code signing certificate for you release/ad-hoc/debug schemes.
I actually found out that this approach works because Xcode suggested fixing the problem and this is what it did.
回答3:
I had to manually change the BundleID in the extension's info.plist to what I needed.
I filed a radar : rdar://17487465
回答4:
I made changes like:
Main app bundle id: com.myapp.testapp
and
Extension app bundle id: com.myapp.testapp.myextension
and its works!!!
回答5:
this helped me:
The extension needs to have the parent's bundle ID as its prefix.
For example, if you app is com.ronnathan.myapp, your extension has to be com.ronnathan.myapp.today. You renamed the app target, now go into the extension target and change the name to match.
taken from here
回答6:
Target->General-->Embedded Binaries delete the older and select the new this was how i solved this problem
回答7:
In my case, this error occurred when I changed App bundle identifier. I also have WatchKit App in my project.
To fix this, update the WatchKit Extension and WatchKit App bundle Id prefix with the new bundle id of your app. Check info.plist in both targets.
Also update the following -
Update the following with the new Watch App bundle id.
WatchKit Extension > Info.plist - NSExtension->NSExtensionAttributes->WKAppBundleIdentifier
Update the following with the new app id.
WatchKit App > Info.plist - WKCompanionAppBundleIdentifier
After changing all the values don't forget to Clean product once.
回答8:
I got the same error, you probably add a extension like Today widget, since the extension is also a binary itself so it has its own plist, and make sure in extension's plist the bundle id is prefixed with app's bundle id. Hope this helps.
回答9:
Make sure your:
Target App A -> Built Settings -> Code Signing -> Release
is the same with:
Target App A (Extension) -> Built Settings -> Code Signing -> Release
回答10:
It might have happened that you duplicated your targets to do a clone app. For instance you selected each of your targets and duplicated them. When you cloned your watchkit extension target its target membership could be automatically assigned to the original watch app.
To fix this, you would need to go to yours original "WatchKit extension.appex" file in Project Navigator and unselect Target Membership in File Inspector for your new clone watch app target. You should do the opposite for your duplicated "Watchkit extension-copy.appex" and make sure it has only duplicated "watch app-copy" target selected there.
回答11:
I tried most of the solutions given here, but it did not helped me to fix the issue in Xcode 9.4
This SO Answer helped me fix the issue.
What i did is simply
Unchecking the Automatically manage signing for all the targets and the project
In code signing making it iOS Developer for all the targets and the project.
Clean the project, then close the project and open it.
Now Enable the Automatically manage signing for the target and choose the developer account. Then build it.
It fixed me the error. I don't know when Apple will fix these type of issues. It eats lot of hours.
Edit: I am using This answer too, That my target bundle id is com.companyname.projectname and for the extension bundle id com.companyname.projectname.myextension
回答12:
The problem is likely that you added a folder using "Create folder references" when adding it to your project (like I did). @Jacob's fix didn't work for me :(
I had to delete the folder reference I added to my project, then clean and build, and that fixed it for me.
回答13:
Just delete apps provision profiles from ~/Library/MobileDevice/Provisioning Profiles, reload Xcode and fix issues when Xcode prompts so (or manually download them from iOS dev center).
Fixed this problem for me.
回答14:
I was having the same problems. Changing the CFBundleIdentifier for my WatchKit extension to something other than the original value used when I first added the WatchKit extension and re-setting my shared app group entitlement fixed it for me.
回答15:
I just clean derived folder and it helps me in these situations.
回答16:
Go to each target > Build Settings > Product Bundle Identifier > (Rename to whatever)
回答17:
This was Helpful for me:
I was getting:
Xcode couldn't find any iOS App Development provisioning profiles matching
So I changed the Bundle Identifier name i.e com.example.something
to com.example.something1
, and then cleaned the build.
Make sure you change all the dependant bundle id as well..njoy!!
回答18:
Make sure bundle identifier of Extension have prefixed with app bundle identifier.
If its same and still giving error, then go to the .plist file of Extension and change their Bundle Identifier.